Repository navigation
Translate Debezium 1.x connector config keys in both readers - #313
Open
sahusanket wants to merge 1 commit into
Open
sahusanket wants to merge 1 commit into
sahusanket wants to merge 1 commit into
Conversation
Debezium 2.x removed the *.whitelist and *.blacklist aliases and renamed database.history.* to schema.history.internal.*. The readers only mapped some of the old keys that users pass as source.connector.* runtime arguments: column.blacklist was dropped by both readers, MySQL ignored column.whitelist, and SQL Server mapped database.history.store.only.monitored.tables.ddl to a key that does not exist in Debezium 2.x. A pipeline that used column.blacklist to keep columns out of the target now replicated them. Add DebeziumLegacyConfigs in delta-plugins-common with one translation table used by both readers: column.whitelist, column.blacklist and the store.only.monitored.tables.ddl key map to their 2.x names, and other database.history.* keys keep the generic prefix rename. When both the old and the new key are given, the new key wins. table.whitelist keeps its Debezium 1.x behavior per connector: SQL Server still maps it to table.include.list (the reader used to set table.whitelist, so a user value replaced it), and MySQL still ignores it (the reader set table.include.list, which took precedence). table.blacklist and database.server.name are intentionally not mapped. Move the Debezium config building in both readers into createDebeziumConfig() so it can be unit tested.
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.
What was wrong
Debezium 2.x removed the
*.whitelist/*.blacklistaliases and renameddatabase.history.*toschema.history.internal.*. Users pass connector settings assource.connector.*runtime arguments, and the readers only translated some of the old keys after the 2.3.7 upgrade:column.blacklistwas dropped by both readers. A pipeline that used it to keep PII columns out of the target started replicating them.column.whitelist, which SQL Server already translated.database.history.store.only.monitored.tables.ddlintoschema.history.internal.store.only.monitored.tables.ddl, which is not a Debezium 2.x setting. The real key isschema.history.internal.store.only.captured.tables.ddl, so the setting silently stayed at its default.What this change does
DebeziumLegacyConfigsindelta-plugins-common, which both readers already depend on, so there is one translation table instead of two diverging loops. It maps:column.whitelisttocolumn.include.listcolumn.blacklisttocolumn.exclude.listdatabase.history.store.only.monitored.tables.ddltoschema.history.internal.store.only.captured.tables.ddldatabase.history.Xtoschema.history.internal.X(unchanged behavior)table.whitelistkeeps its Debezium 1.9.7 behavior per connector. SQL Server still maps it totable.include.list: the reader used to settable.whitelistitself, so a user value replaced the table list. MySQL still ignores it: the reader settable.include.list, which took precedence. Mapping it for MySQL would have changed 6.11.1 behavior, so the MySQL test asserts the table list is unchanged.table.blacklistis not mapped. CDAP always setstable.include.list, Debezium 1.9.7 never honored a blacklist next to it, and Debezium 2.x rejects having both.database.server.nameis not mapped either, because the offset stores depend on the fixeddummytopic prefix (BUG-14).MySqlEventReaderandSqlServerEventReaderinto a package-privatecreateDebeziumConfig()so it can be unit tested. The default values are unchanged.SSL: Debezium 2.x also changed the MySQL
database.ssl.modedefault fromdisabledtopreferred. develop keeps the Debezium 2.x default, so there is no code change for it here. Suggested 6.12 release note: "MySQL replication sources now use SSL when the server offers it (Debeziumdatabase.ssl.mode=preferred). If the connection fails because the server only offers TLS versions that Java 11 rejects, set the runtime argumentsource.connector.database.ssl.mode=disabled." release/0.10 pinsdisabledin a separate commit.Commits
Testing
New tests:
DebeziumLegacyConfigsTest(7): each legacy key maps, connector specific keys (SQL Servertable.whitelist) map, the history key maps tocapturedand never tomonitored, the new key wins, unrelated keys (table.whitelistwithout a connector mapping,table.blacklist,database.server.name,database.ssl.mode) are unchanged, input map is not modified.MySqlEventReaderTest(6):column.blacklistends up incolumn.exclude.listandnew MySqlConnectorConfig(conf).getColumnFilter()excludesmydb.orders.secret_col;column.whitelistfilters columns;table.whitelistdoes not replace the table list (same as 6.11.1); history key; new key wins; defaults.SqlServerEventReaderTest(6):column.blacklistexcludesdbo.orders.secret_colthroughSqlServerConnectorConfig.getColumnFilter();column.whitelist;table.whitelist; history key goes tocaptured;table.include.listwins overtable.whitelist; defaults.Unit tests do not run in the default build because
${testSourceLocation}is only defined in thee2e-testsprofile (MB-25-BUG-2, not fixed here), so the runs pass-DtestSourceLocation=src/test/java. JDK 11 (Amazon Corretto 11.0.33), Maven through Corp Airlock.Result: BUILD SUCCESS. delta-plugins-common 10 tests, mysql-delta-plugins 6, sqlserver-delta-plugins 13, 0 failures. Checkstyle and RAT pass.
Without the fix (the readers' override loops temporarily put back to the develop HEAD logic, new tests kept):
Result: MySqlEventReaderTest failures for column.blacklist and column.whitelist, SqlServerEventReaderTest 3 failures (column.blacklist, store.only.monitored.tables.ddl, new key wins).
Not done here: live MySQL 8.0 and SQL Server 2019 pipelines with
source.connector.column.blacklist=<db>.<table>.secret_col, checking that the BigQuery table has nosecret_col.Regression sheet: BUG-13, MB-26-BUG-2.