Skip to content

Commit

Permalink
DBZ-7497 Add a configuration based snapshot modes configurable via co…
Browse files Browse the repository at this point in the history
…nnector properties
  • Loading branch information
mfvitale authored and jpechane committed Mar 28, 2024
1 parent 6d0cd49 commit c3aa227
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public enum SnapshotMode implements EnumeratedValue {
*/
WHEN_NEEDED("when_needed"),

/**
* Allows over snapshots by setting connectors properties prefixed with 'snapshot.mode.configuration.based'.
*/
CONFIGURATION_BASED("configuration_based"),

/**
* Inject a custom snapshotter, which allows for more control over snapshots.
*/
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/io/debezium/connector/db2/Db2ConnectorIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public void testTableIncludeList() throws Exception {
final int TABLES = 1;
final int ID_START = 10;
final Configuration config = TestHelper.defaultConfig()
.with(Db2ConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
.with(Db2ConnectorConfig.SNAPSHOT_MODE, SnapshotMode.NO_DATA)
.with(Db2ConnectorConfig.TABLE_INCLUDE_LIST, "db2inst1.tableb")
.build();
connection.execute(
Expand Down Expand Up @@ -737,7 +737,7 @@ public void testEmptySchemaWarningAfterApplyingFilters() throws Exception {
@FixFor("DBZ-775")
public void shouldConsumeEventsWithMaskedAndTruncatedColumns() throws Exception {
final Configuration config = TestHelper.defaultConfig()
.with(Db2ConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
.with(Db2ConnectorConfig.SNAPSHOT_MODE, SnapshotMode.NO_DATA)
.with("column.mask.with.12.chars", "DB2INST1.MASKED_HASHED_COLUMN_TABLE.NAME")
.with("column.mask.hash.SHA-256.with.salt.CzQMA0cB5K", "DB2INST1.MASKED_HASHED_COLUMN_TABLE.NAME2,DB2INST1.MASKED_HASHED_COLUMN_TABLE.NAME3")
.with("column.truncate.to.4.chars", "DB2INST1.TRUNCATED_COLUMN_TABLE.NAME")
Expand Down Expand Up @@ -792,7 +792,7 @@ record = tableB.get(0);
@FixFor("DBZ-775")
public void shouldRewriteIdentityKey() throws Exception {
final Configuration config = TestHelper.defaultConfig()
.with(Db2ConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
.with(Db2ConnectorConfig.SNAPSHOT_MODE, SnapshotMode.NO_DATA)
.with(Db2ConnectorConfig.MSG_KEY_COLUMNS, "(.*).tablea:id,cola")
.build();

Expand Down Expand Up @@ -823,7 +823,7 @@ public void shouldRewriteIdentityKey() throws Exception {
@FixFor({ "DBZ-1916", "DBZ-1830" })
public void shouldPropagateSourceTypeByDatatype() throws Exception {
final Configuration config = TestHelper.defaultConfig()
.with(Db2ConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
.with(Db2ConnectorConfig.SNAPSHOT_MODE, SnapshotMode.NO_DATA)
.with("datatype.propagate.source.type", ".+\\.NUMERIC,.+\\.VARCHAR,.+\\.DECIMAL,.+\\.REAL")
.build();

Expand Down

0 comments on commit c3aa227

Please sign in to comment.