DBZ-1312 Change whitelist format to schema.table ids

This commit is contained in:
Jiri Pechanec 2020-05-22 08:14:13 +02:00 committed by Gunnar Morling
parent 15577e2f99
commit 2e6b13b827
7 changed files with 18 additions and 19 deletions

View File

@ -125,7 +125,7 @@ public class OracleConnectorConfig extends HistorizedRelationalDatabaseConnector
private final OracleVersion oracleVersion;
public OracleConnectorConfig(Configuration config) {
super(OracleConnector.class, config, config.getString(SERVER_NAME), new SystemTablesPredicate(), true);
super(OracleConnector.class, config, config.getString(SERVER_NAME), new SystemTablesPredicate(), x -> x.schema() + "." + x.table(), true);
this.databaseName = config.getString(DATABASE_NAME);
this.pdbName = config.getString(PDB_NAME);

View File

@ -104,7 +104,7 @@ public void shouldApplyWhitelistConfiguration() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(
RelationalDatabaseConnectorConfig.TABLE_WHITELIST,
"ORCLPDB1\\.DEBEZIUM2\\.TABLE2,ORCLPDB1\\.DEBEZIUM\\.TABLE1,ORCLPDB1\\.DEBEZIUM\\.TABLE3")
"DEBEZIUM2\\.TABLE2,DEBEZIUM\\.TABLE1,DEBEZIUM\\.TABLE3")
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.INITIAL_SCHEMA_ONLY)
.build();
@ -156,7 +156,7 @@ public void shouldApplyBlacklistConfiguration() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(
RelationalDatabaseConnectorConfig.TABLE_BLACKLIST,
"ORCLPDB1\\.DEBEZIUM\\.TABLE2,ORCLPDB1\\.DEBEZIUM\\.CUSTOMER.*")
"DEBEZIUM\\.TABLE2,DEBEZIUM\\.CUSTOMER.*")
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.INITIAL_SCHEMA_ONLY)
.build();

View File

@ -82,7 +82,7 @@ public void before() throws SQLException {
@Test
public void shouldTakeSnapshot() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.CUSTOMER")
.build();
int expectedRecordCount = 0;
@ -131,7 +131,7 @@ public void shouldTakeSnapshot() throws Exception {
@Test
public void shouldContinueWithStreamingAfterSnapshot() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.CUSTOMER")
.build();
int expectedRecordCount = 0;
@ -202,7 +202,7 @@ public void shouldContinueWithStreamingAfterSnapshot() throws Exception {
@FixFor("DBZ-1223")
public void shouldStreamTransaction() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.CUSTOMER")
.build();
// Testing.Print.enable();
@ -293,7 +293,7 @@ private void assertTxBatch(int expectedRecordCount, int offset) throws Interrupt
@Test
public void shouldStreamAfterRestart() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.CUSTOMER")
.build();
// Testing.Print.enable();
@ -333,7 +333,7 @@ public void shouldStreamAfterRestart() throws Exception {
@Test
public void shouldStreamAfterRestartAfterSnapshot() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.CUSTOMER")
.build();
// Testing.Print.enable();
@ -369,7 +369,7 @@ public void shouldStreamAfterRestartAfterSnapshot() throws Exception {
@Test
public void shouldReadChangeStreamForExistingTable() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.CUSTOMER")
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
.build();
@ -459,7 +459,7 @@ public void shouldReadChangeStreamForExistingTable() throws Exception {
@FixFor("DBZ-835")
public void deleteWithoutTombstone() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.CUSTOMER")
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
.with(OracleConnectorConfig.TOMBSTONES_ON_DELETE, false)
.build();
@ -503,7 +503,7 @@ public void shouldReadChangeStreamForTableCreatedWhileStreaming() throws Excepti
TestHelper.dropTable(connection, "debezium.customer2");
Configuration config = TestHelper.defaultConfig()
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER2")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.CUSTOMER2")
.build();
start(OracleConnector.class, config);
@ -548,7 +548,7 @@ public void shouldReceiveHeartbeatAlsoWhenChangingNonWhitelistedTable() throws E
// received from Postgres
Configuration config = TestHelper.defaultConfig()
.with(Heartbeat.HEARTBEAT_INTERVAL, "1")
.with(OracleConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.DBZ800B")
.with(OracleConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.DBZ800B")
.build();
start(OracleConnector.class, config);

View File

@ -77,7 +77,7 @@ public void snapshotSchemaChanges() throws Exception {
final int ID_START_1 = 10;
final Configuration config = TestHelper.defaultConfig()
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.INITIAL)
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.TABLE.")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.TABLE[ABC]")
.with(RelationalDatabaseConnectorConfig.INCLUDE_SCHEMA_CHANGES, true)
.build();

View File

@ -62,15 +62,15 @@ protected Builder connectorConfig() {
private String getTableWhitelist() {
switch (name.getMethodName()) {
case "stringTypes":
return "ORCLPDB1.debezium.type_string";
return "debezium.type_string";
case "fpTypes":
case "fpTypesAsString":
case "fpTypesAsDouble":
return "ORCLPDB1.debezium.type_fp";
return "debezium.type_fp";
case "intTypes":
return "ORCLPDB1.debezium.type_int";
return "debezium.type_int";
case "timeTypes":
return "ORCLPDB1.debezium.type_time";
return "debezium.type_time";
default:
throw new IllegalArgumentException("Unexpected test method: " + name.getMethodName());
}

View File

@ -42,7 +42,6 @@ public void before() throws Exception {
protected Builder connectorConfig() {
String whitelistedTables = getAllTables().stream()
.map(t -> "ORCLPDB1." + t)
.map(t -> t.replaceAll("\\.", "\\\\."))
.collect(Collectors.joining(","));

View File

@ -74,7 +74,7 @@ public void before() throws SQLException {
@Test
public void transactionMetadata() throws Exception {
Configuration config = TestHelper.defaultConfig()
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "ORCLPDB1\\.DEBEZIUM\\.CUSTOMER")
.with(RelationalDatabaseConnectorConfig.TABLE_WHITELIST, "DEBEZIUM\\.CUSTOMER")
.with(OracleConnectorConfig.SNAPSHOT_MODE, SnapshotMode.SCHEMA_ONLY)
.with(OracleConnectorConfig.PROVIDE_TRANSACTION_METADATA, true)
.build();