Skip to content

Translate Debezium 1.x connector config keys in both readers - #313

Open
sahusanket wants to merge 1 commit into
developfrom
fix/debezium-legacy-config-keys
Open

sahusanket wants to merge 1 commit into
developfrom
fix/debezium-legacy-config-keys

Conversation

@sahusanket

Copy link
Copy Markdown
Contributor

What was wrong

Debezium 2.x removed the *.whitelist / *.blacklist aliases and renamed database.history.* to schema.history.internal.*. Users pass connector settings as source.connector.* runtime arguments, and the readers only translated some of the old keys after the 2.3.7 upgrade:

  • column.blacklist was dropped by both readers. A pipeline that used it to keep PII columns out of the target started replicating them.
  • MySQL ignored column.whitelist, which SQL Server already translated.
  • SQL Server turned database.history.store.only.monitored.tables.ddl into schema.history.internal.store.only.monitored.tables.ddl, which is not a Debezium 2.x setting. The real key is schema.history.internal.store.only.captured.tables.ddl, so the setting silently stayed at its default.

What this change does

  • Adds DebeziumLegacyConfigs in delta-plugins-common, which both readers already depend on, so there is one translation table instead of two diverging loops. It maps:
    • column.whitelist to column.include.list
    • column.blacklist to column.exclude.list
    • database.history.store.only.monitored.tables.ddl to schema.history.internal.store.only.captured.tables.ddl
    • any other database.history.X to schema.history.internal.X (unchanged behavior)
  • If a user gives both the old key and the new key, the new key wins. Before, the SQL Server result depended on HashMap iteration order. The old key is still passed through as before, which Debezium 2.x ignores.
  • table.whitelist keeps its Debezium 1.9.7 behavior per connector. SQL Server still maps it to table.include.list: the reader used to set table.whitelist itself, so a user value replaced the table list. MySQL still ignores it: the reader set table.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.blacklist is not mapped. CDAP always sets table.include.list, Debezium 1.9.7 never honored a blacklist next to it, and Debezium 2.x rejects having both. database.server.name is not mapped either, because the offset stores depend on the fixed dummy topic prefix (BUG-14).
  • Moves the Debezium config building in MySqlEventReader and SqlServerEventReader into a package-private createDebeziumConfig() so it can be unit tested. The default values are unchanged.

SSL: Debezium 2.x also changed the MySQL database.ssl.mode default from disabled to preferred. 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 (Debezium database.ssl.mode=preferred). If the connection fails because the server only offers TLS versions that Java 11 rejects, set the runtime argument source.connector.database.ssl.mode=disabled." release/0.10 pins disabled in a separate commit.

Commits

  • 33f5203 Translate Debezium 1.x connector config keys in both readers

Testing

New tests:

  • DebeziumLegacyConfigsTest (7): each legacy key maps, connector specific keys (SQL Server table.whitelist) map, the history key maps to captured and never to monitored, the new key wins, unrelated keys (table.whitelist without a connector mapping, table.blacklist, database.server.name, database.ssl.mode) are unchanged, input map is not modified.
  • MySqlEventReaderTest (6): column.blacklist ends up in column.exclude.list and new MySqlConnectorConfig(conf).getColumnFilter() excludes mydb.orders.secret_col; column.whitelist filters columns; table.whitelist does not replace the table list (same as 6.11.1); history key; new key wins; defaults.
  • SqlServerEventReaderTest (6): column.blacklist excludes dbo.orders.secret_col through SqlServerConnectorConfig.getColumnFilter(); column.whitelist; table.whitelist; history key goes to captured; table.include.list wins over table.whitelist; defaults.

Unit tests do not run in the default build because ${testSourceLocation} is only defined in the e2e-tests profile (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.

mvn -B clean test -DtestSourceLocation=src/test/java

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):

mvn -B test -fae -pl mysql-delta-plugins,sqlserver-delta-plugins -am -DtestSourceLocation=src/test/java -Dtest='MySqlEventReaderTest,SqlServerEventReaderTest' -DfailIfNoTests=false -Dcheckstyle.skip

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 no secret_col.

Regression sheet: BUG-13, MB-26-BUG-2.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant