Repository navigation
[split 1/22] python: remove eval() from checksum fstr(), fix silent error swallowing, per-table LOCK TABLES READ lifecycle - #1356
Merged
Conversation
…ng, per-table LOCK TABLES READ lifecycle
Python tooling only - no Java changes.
- fstr() in mysql_table_checksum.py, clickhouse_table_checksum.py, mysql_table_count.py was `eval(f"f'{template}'")`: any text reaching the template executed as Python. Replaced with literal `{partition_expression}` substitution; mysql_table_checksum_test.py (previously a placeholder that asserted True == False on every run) now pins that the eval cannot come back.
- Thread-pool result loops read future.result() BEFORE checking future.exception(), so the first exception propagated un-logged and later ones were lost; now handled per-future with the table name logged.
- top_level_table_checksum.py: per-table `LOCK TABLES ... READ` with try/finally unlock + connection close (lock released even when a checksum subprocess dies). New tests/test_table_locking.py covers the lock lifecycle.
- db/clickhouse.py: cursor closed in finally; yaml.safe_load; credentials no longer logged in debug output.
- db/mysql.py: user/password URL-quoted so special characters in credentials do not break the SQLAlchemy URL.
- tests/__main__.py: parameterized INSERT instead of %-interpolated SQL.
Verified: `python -m unittest db_compare.tests.mysql_table_checksum_test db_compare.tests.test_table_locking` - all pass.
Part of the split of #1353 into independently mergeable sub-PRs (each <= 10 files), so the 2.10.0 branch can absorb the fixes incrementally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python tooling only - no Java changes.
eval(f"f'{template}'"): any text reaching the template executed as Python. Replaced with literal{partition_expression}substitution; mysql_table_checksum_test.py (previously a placeholder that asserted True == False on every run) now pins that the eval cannot come back.LOCK TABLES ... READwith try/finally unlock + connection close (lock released even when a checksum subprocess dies). New tests/test_table_locking.py covers the lock lifecycle.Verified:
python -m unittest db_compare.tests.mysql_table_checksum_test db_compare.tests.test_table_locking- all pass.Part of the split of #1353 into independently mergeable sub-PRs (each <= 10 files), so the 2.10.0 branch can absorb the fixes incrementally.
Split out of #1353, which this series replaces. Each sub-PR is <= 10 files; the union of all 22 reproduces the #1353 tree exactly (verified by tree SHA).