DBZ-5045 Remove deprecated DATABASE_WHITELIST
This commit is contained in:
parent
f84893a8b4
commit
0cbb57f4bf
@ -32,7 +32,7 @@ public final class Filters {
|
||||
* @param config the configuration; may not be null
|
||||
*/
|
||||
public Filters(Configuration config) {
|
||||
String dbIncludeList = config.getFallbackStringProperty(MongoDbConnectorConfig.DATABASE_INCLUDE_LIST, MongoDbConnectorConfig.DATABASE_WHITELIST);
|
||||
String dbIncludeList = config.getString(MongoDbConnectorConfig.DATABASE_INCLUDE_LIST);
|
||||
String dbExcludeList = config.getFallbackStringProperty(MongoDbConnectorConfig.DATABASE_EXCLUDE_LIST, MongoDbConnectorConfig.DATABASE_BLACKLIST);
|
||||
if (dbIncludeList != null && !dbIncludeList.trim().isEmpty()) {
|
||||
databaseFilter = Predicates.includes(dbIncludeList);
|
||||
|
@ -42,7 +42,6 @@ public class MongoDbConnectorConfig extends CommonConnectorConfig {
|
||||
protected static final String COLLECTION_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG = "\"collection.include.list\" is already specified";
|
||||
protected static final String COLLECTION_WHITELIST_ALREADY_SPECIFIED_ERROR_MSG = "\"collection.whitelist\" is already specified";
|
||||
protected static final String DATABASE_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG = "\"database.include.list\" is already specified";
|
||||
protected static final String DATABASE_WHITELIST_ALREADY_SPECIFIED_ERROR_MSG = "\"database.whitelist\" is already specified";
|
||||
|
||||
protected static final Pattern PATTERN_SPILT = Pattern.compile(",");
|
||||
|
||||
@ -359,20 +358,6 @@ public boolean isFullUpdate() {
|
||||
.withValidation(Field::isListOfRegex)
|
||||
.withDescription("A comma-separated list of regular expressions that match the database names for which changes are to be captured");
|
||||
|
||||
/**
|
||||
* Old, backwards-compatible "whitelist" property.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Field DATABASE_WHITELIST = Field.create("database.whitelist")
|
||||
.withDisplayName("Deprecated: Include Databases")
|
||||
.withType(Type.LIST)
|
||||
.withWidth(Width.LONG)
|
||||
.withImportance(Importance.LOW)
|
||||
.withValidation(Field::isListOfRegex)
|
||||
.withInvisibleRecommender()
|
||||
.withDescription("A comma-separated list of regular expressions that match the database names for which changes are to be captured (deprecated, use \""
|
||||
+ DATABASE_INCLUDE_LIST.name() + "\" instead)");
|
||||
|
||||
/**
|
||||
* A comma-separated list of regular expressions that match the databases to be excluded.
|
||||
* Must not be used with {@link #DATABASE_INCLUDE_LIST}.
|
||||
@ -589,7 +574,6 @@ public boolean isFullUpdate() {
|
||||
SSL_ALLOW_INVALID_HOSTNAMES,
|
||||
CURSOR_MAX_AWAIT_TIME_MS)
|
||||
.events(
|
||||
DATABASE_WHITELIST,
|
||||
DATABASE_INCLUDE_LIST,
|
||||
DATABASE_BLACKLIST,
|
||||
DATABASE_EXCLUDE_LIST,
|
||||
@ -712,10 +696,10 @@ private static int validateDatabaseExcludeList(Configuration config, Field field
|
||||
}
|
||||
|
||||
private static int validateDatabaseBlacklist(Configuration config, Field field, ValidationOutput problems) {
|
||||
String whitelist = config.getFallbackStringPropertyWithWarning(DATABASE_INCLUDE_LIST, DATABASE_WHITELIST);
|
||||
String whitelist = config.getString(DATABASE_INCLUDE_LIST);
|
||||
String blacklist = config.getFallbackStringPropertyWithWarning(DATABASE_EXCLUDE_LIST, DATABASE_BLACKLIST);
|
||||
if (whitelist != null && blacklist != null) {
|
||||
problems.accept(DATABASE_BLACKLIST, blacklist, DATABASE_WHITELIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||
problems.accept(DATABASE_BLACKLIST, blacklist, DATABASE_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -46,10 +46,6 @@ public Configurator maxBatchSize(int maxBatchSize) {
|
||||
}
|
||||
|
||||
public Configurator includeDatabases(String regexList) {
|
||||
if (Math.random() >= 0.5) {
|
||||
Testing.debug("Using \"" + MongoDbConnectorConfig.DATABASE_WHITELIST.name() + "\" config property");
|
||||
return with(MongoDbConnectorConfig.DATABASE_WHITELIST, regexList);
|
||||
}
|
||||
Testing.debug("Using \"" + MongoDbConnectorConfig.DATABASE_INCLUDE_LIST.name() + "\" config property");
|
||||
return with(MongoDbConnectorConfig.DATABASE_INCLUDE_LIST, regexList);
|
||||
}
|
||||
|
@ -98,7 +98,6 @@ public void shouldFailToValidateInvalidConfiguration() {
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.USER);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.PASSWORD);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.AUTO_DISCOVER_MEMBERS);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.DATABASE_WHITELIST);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.DATABASE_INCLUDE_LIST);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.DATABASE_BLACKLIST);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.DATABASE_EXCLUDE_LIST);
|
||||
@ -225,7 +224,6 @@ public void shouldValidateAcceptableConfiguration() {
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.USER);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.PASSWORD);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.AUTO_DISCOVER_MEMBERS);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.DATABASE_WHITELIST);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.DATABASE_INCLUDE_LIST);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.DATABASE_BLACKLIST);
|
||||
assertNoConfigurationErrors(result, MongoDbConnectorConfig.DATABASE_EXCLUDE_LIST);
|
||||
|
@ -133,7 +133,6 @@ public void shouldFailToValidateInvalidConfiguration() {
|
||||
assertConfigurationErrors(result, MySqlConnectorConfig.SERVER_NAME, 2);
|
||||
assertConfigurationErrors(result, MySqlConnectorConfig.SERVER_ID);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.TABLES_IGNORE_BUILTIN);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_WHITELIST);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_INCLUDE_LIST);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_BLACKLIST);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_EXCLUDE_LIST);
|
||||
@ -183,7 +182,6 @@ public void shouldValidateAcceptableConfiguration() {
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.SERVER_NAME);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.SERVER_ID);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.TABLES_IGNORE_BUILTIN);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_WHITELIST);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_INCLUDE_LIST);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_BLACKLIST);
|
||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_EXCLUDE_LIST);
|
||||
@ -270,7 +268,7 @@ public void shouldConsumeAllEventsFromDatabaseUsingSnapshot() throws SQLExceptio
|
||||
|
||||
@Test
|
||||
public void shouldConsumeAllEventsFromDatabaseUsingSnapshotOld() throws SQLException, InterruptedException {
|
||||
shouldConsumeAllEventsFromDatabaseUsingSnapshotByField(MySqlConnectorConfig.DATABASE_WHITELIST, 18775);
|
||||
shouldConsumeAllEventsFromDatabaseUsingSnapshotByField(MySqlConnectorConfig.DATABASE_INCLUDE_LIST, 18775);
|
||||
}
|
||||
|
||||
private void shouldConsumeAllEventsFromDatabaseUsingSnapshotByField(Field dbIncludeListField, int serverId) throws SQLException, InterruptedException {
|
||||
@ -1045,7 +1043,7 @@ public void shouldHandleIncludedTables() throws SQLException, InterruptedExcepti
|
||||
final String tables = String.format("%s.customers, %s.orders", DATABASE.getDatabaseName(), DATABASE.getDatabaseName());
|
||||
config = DATABASE.defaultConfig()
|
||||
.with(MySqlConnectorConfig.TABLE_INCLUDE_LIST, tables)
|
||||
.with(MySqlConnectorConfig.DATABASE_WHITELIST, ".*")
|
||||
.with(MySqlConnectorConfig.DATABASE_INCLUDE_LIST, ".*")
|
||||
.build();
|
||||
|
||||
dropDatabases();
|
||||
|
@ -288,40 +288,6 @@ public void shouldCreateSnapshotOfSingleDatabaseWithSchemaChanges() throws Excep
|
||||
assertThat(orders.numberOfValueSchemaChanges()).isEqualTo(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup a DATABASE_WHITELIST filter that filters all events.
|
||||
* Verify all events are properly filtered.
|
||||
* Verify numberOfFilteredEvents metric is incremented correctly.
|
||||
*/
|
||||
@Test
|
||||
@FixFor("DBZ-1206")
|
||||
public void shouldFilterAllRecordsBasedOnDatabaseWhitelistFilter() throws Exception {
|
||||
// Define configuration that will ignore all events from MySQL source.
|
||||
config = simpleConfig()
|
||||
.with(MySqlConnectorConfig.DATABASE_WHITELIST, "db-does-not-exist")
|
||||
.build();
|
||||
|
||||
// Start the connector ...
|
||||
start(MySqlConnector.class, config);
|
||||
waitForStreamingRunning("mysql", DATABASE.getServerName(), "streaming");
|
||||
|
||||
// Lets wait for at least 35 events to be filtered.
|
||||
final int expectedFilterCount = 35;
|
||||
final long numberFiltered = filterAtLeast(expectedFilterCount, 20, TimeUnit.SECONDS);
|
||||
|
||||
// All events should have been filtered.
|
||||
assertThat(numberFiltered).isGreaterThanOrEqualTo(expectedFilterCount);
|
||||
|
||||
// There should be no schema changes
|
||||
assertThat(schemaChanges.recordCount()).isEqualTo(0);
|
||||
|
||||
// There should be no records
|
||||
assertThat(store.collectionCount()).isEqualTo(0);
|
||||
|
||||
// There should be no skipped
|
||||
assertThat(getNumberOfSkippedEvents()).isEqualTo(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup a DATABASE_INCLUDE_LIST filter that filters all events.
|
||||
* Verify all events are properly filtered.
|
||||
|
@ -52,7 +52,6 @@ public abstract class RelationalDatabaseConnectorConfig extends CommonConnectorC
|
||||
|
||||
protected static final String SCHEMA_INCLUDE_LIST_NAME = "schema.include.list";
|
||||
protected static final String SCHEMA_EXCLUDE_LIST_NAME = "schema.exclude.list";
|
||||
protected static final String DATABASE_WHITELIST_NAME = "database.whitelist";
|
||||
protected static final String DATABASE_INCLUDE_LIST_NAME = "database.include.list";
|
||||
protected static final String DATABASE_BLACKLIST_NAME = "database.blacklist";
|
||||
protected static final String DATABASE_EXCLUDE_LIST_NAME = "database.exclude.list";
|
||||
@ -66,7 +65,6 @@ public abstract class RelationalDatabaseConnectorConfig extends CommonConnectorC
|
||||
public static final String COLUMN_WHITELIST_ALREADY_SPECIFIED_ERROR_MSG = "\"column.whitelist\" is already specified";
|
||||
public static final String SCHEMA_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG = "\"schema.include.list\" is already specified";
|
||||
public static final String DATABASE_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG = "\"database.include.list\" is already specified";
|
||||
public static final String DATABASE_WHITELIST_ALREADY_SPECIFIED_ERROR_MSG = "\"database.whitelist\" is already specified";
|
||||
|
||||
public static final long DEFAULT_SNAPSHOT_LOCK_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(10);
|
||||
public static final String DEFAULT_UNAVAILABLE_VALUE_PLACEHOLDER = "__debezium_unavailable_value";
|
||||
@ -385,16 +383,6 @@ public static DecimalHandlingMode parse(String value, String defaultValue) {
|
||||
.withValidation(Field::isListOfRegex)
|
||||
.withDescription("The databases for which changes are to be captured");
|
||||
|
||||
@Deprecated
|
||||
public static final Field DATABASE_WHITELIST = Field.create(DATABASE_WHITELIST_NAME)
|
||||
.withDisplayName("Deprecated: Include Databases")
|
||||
.withType(Type.LIST)
|
||||
.withWidth(Width.LONG)
|
||||
.withImportance(Importance.LOW)
|
||||
.withValidation(Field::isListOfRegex)
|
||||
.withInvisibleRecommender()
|
||||
.withDescription("The databases for which changes are to be captured (deprecated, use \"" + DATABASE_INCLUDE_LIST.name() + "\" instead)");
|
||||
|
||||
/**
|
||||
* A comma-separated list of regular expressions that match database names to be excluded from monitoring.
|
||||
* Must not be used with {@link #DATABASE_INCLUDE_LIST}.
|
||||
@ -790,10 +778,10 @@ private static int validateDatabaseExcludeList(Configuration config, Field field
|
||||
}
|
||||
|
||||
private static int validateDatabaseBlacklist(Configuration config, Field field, ValidationOutput problems) {
|
||||
String whitelist = config.getFallbackStringPropertyWithWarning(DATABASE_INCLUDE_LIST, DATABASE_WHITELIST);
|
||||
String includeList = config.getString(DATABASE_INCLUDE_LIST);
|
||||
String blacklist = config.getFallbackStringPropertyWithWarning(DATABASE_EXCLUDE_LIST, DATABASE_BLACKLIST);
|
||||
if (whitelist != null && blacklist != null) {
|
||||
problems.accept(DATABASE_BLACKLIST, blacklist, DATABASE_WHITELIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||
if (includeList != null && blacklist != null) {
|
||||
problems.accept(DATABASE_BLACKLIST, blacklist, DATABASE_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -36,10 +36,7 @@ public class RelationalTableFilters implements DataCollectionFilters {
|
||||
public RelationalTableFilters(Configuration config, TableFilter systemTablesFilter, TableIdToStringMapper tableIdMapper) {
|
||||
// Define the filter that provides the list of tables that could be captured if configured
|
||||
final TableSelectionPredicateBuilder eligibleTables = Selectors.tableSelector()
|
||||
.includeDatabases(
|
||||
config.getFallbackStringProperty(
|
||||
RelationalDatabaseConnectorConfig.DATABASE_INCLUDE_LIST,
|
||||
RelationalDatabaseConnectorConfig.DATABASE_WHITELIST))
|
||||
.includeDatabases(config.getString(RelationalDatabaseConnectorConfig.DATABASE_INCLUDE_LIST))
|
||||
.excludeDatabases(
|
||||
config.getFallbackStringProperty(
|
||||
RelationalDatabaseConnectorConfig.DATABASE_EXCLUDE_LIST,
|
||||
@ -76,10 +73,7 @@ public RelationalTableFilters(Configuration config, TableFilter systemTablesFilt
|
||||
|
||||
// Define the database filter using the include and exclude lists for database names ...
|
||||
this.databaseFilter = Selectors.databaseSelector()
|
||||
.includeDatabases(
|
||||
config.getFallbackStringProperty(
|
||||
RelationalDatabaseConnectorConfig.DATABASE_INCLUDE_LIST,
|
||||
RelationalDatabaseConnectorConfig.DATABASE_WHITELIST))
|
||||
.includeDatabases(config.getString(RelationalDatabaseConnectorConfig.DATABASE_INCLUDE_LIST))
|
||||
.excludeDatabases(
|
||||
config.getFallbackStringProperty(
|
||||
RelationalDatabaseConnectorConfig.DATABASE_EXCLUDE_LIST,
|
||||
|
Loading…
Reference in New Issue
Block a user