DBZ-3218 Handle duplicate warnings for deprecated options
This commit is contained in:
parent
a3ddd3861f
commit
6856dd9a80
@ -235,7 +235,7 @@ public static DecimalHandlingMode parse(String value, String defaultValue) {
|
|||||||
.withType(Type.LIST)
|
.withType(Type.LIST)
|
||||||
.withWidth(Width.LONG)
|
.withWidth(Width.LONG)
|
||||||
.withImportance(Importance.LOW)
|
.withImportance(Importance.LOW)
|
||||||
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateTableExcludeList)
|
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateTableBlacklist)
|
||||||
.withInvisibleRecommender()
|
.withInvisibleRecommender()
|
||||||
.withDescription(
|
.withDescription(
|
||||||
"A comma-separated list of regular expressions that match the fully-qualified names of tables to be excluded from monitoring (deprecated, use \""
|
"A comma-separated list of regular expressions that match the fully-qualified names of tables to be excluded from monitoring (deprecated, use \""
|
||||||
@ -273,7 +273,7 @@ public static DecimalHandlingMode parse(String value, String defaultValue) {
|
|||||||
.withType(Type.LIST)
|
.withType(Type.LIST)
|
||||||
.withWidth(Width.LONG)
|
.withWidth(Width.LONG)
|
||||||
.withImportance(Importance.LOW)
|
.withImportance(Importance.LOW)
|
||||||
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateColumnExcludeList)
|
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateColumnBlacklist)
|
||||||
.withInvisibleRecommender()
|
.withInvisibleRecommender()
|
||||||
.withDescription("Regular expressions matching columns to exclude from change events (deprecated, use \"" + COLUMN_EXCLUDE_LIST.name() + "\" instead)");
|
.withDescription("Regular expressions matching columns to exclude from change events (deprecated, use \"" + COLUMN_EXCLUDE_LIST.name() + "\" instead)");
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ public static DecimalHandlingMode parse(String value, String defaultValue) {
|
|||||||
.withType(Type.LIST)
|
.withType(Type.LIST)
|
||||||
.withWidth(Width.LONG)
|
.withWidth(Width.LONG)
|
||||||
.withImportance(Importance.MEDIUM)
|
.withImportance(Importance.MEDIUM)
|
||||||
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateColumnExcludeList)
|
.withValidation(Field::isListOfRegex)
|
||||||
.withDescription("Regular expressions matching columns to include in change events");
|
.withDescription("Regular expressions matching columns to include in change events");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -300,7 +300,7 @@ public static DecimalHandlingMode parse(String value, String defaultValue) {
|
|||||||
.withType(Type.LIST)
|
.withType(Type.LIST)
|
||||||
.withWidth(Width.LONG)
|
.withWidth(Width.LONG)
|
||||||
.withImportance(Importance.LOW)
|
.withImportance(Importance.LOW)
|
||||||
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateColumnExcludeList)
|
.withValidation(Field::isListOfRegex)
|
||||||
.withInvisibleRecommender()
|
.withInvisibleRecommender()
|
||||||
.withDescription("Regular expressions matching columns to include in change events (deprecated, use \"" + COLUMN_INCLUDE_LIST.name() + "\" instead)");
|
.withDescription("Regular expressions matching columns to include in change events (deprecated, use \"" + COLUMN_INCLUDE_LIST.name() + "\" instead)");
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ public static DecimalHandlingMode parse(String value, String defaultValue) {
|
|||||||
.withType(Type.LIST)
|
.withType(Type.LIST)
|
||||||
.withWidth(Width.LONG)
|
.withWidth(Width.LONG)
|
||||||
.withImportance(Importance.LOW)
|
.withImportance(Importance.LOW)
|
||||||
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateSchemaExcludeList)
|
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateSchemaBlacklist)
|
||||||
.withInvisibleRecommender()
|
.withInvisibleRecommender()
|
||||||
.withDescription("The schemas for which events must not be captured (deprecated, use \"" + SCHEMA_EXCLUDE_LIST.name() + "\" instead)");
|
.withDescription("The schemas for which events must not be captured (deprecated, use \"" + SCHEMA_EXCLUDE_LIST.name() + "\" instead)");
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ public static DecimalHandlingMode parse(String value, String defaultValue) {
|
|||||||
.withType(Type.LIST)
|
.withType(Type.LIST)
|
||||||
.withWidth(Width.LONG)
|
.withWidth(Width.LONG)
|
||||||
.withImportance(Importance.LOW)
|
.withImportance(Importance.LOW)
|
||||||
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateDatabaseExcludeList)
|
.withValidation(Field::isListOfRegex, RelationalDatabaseConnectorConfig::validateDatabaseBlacklist)
|
||||||
.withInvisibleRecommender()
|
.withInvisibleRecommender()
|
||||||
.withDescription("A comma-separated list of regular expressions that match database names to be excluded from monitoring (deprecated, use \""
|
.withDescription("A comma-separated list of regular expressions that match database names to be excluded from monitoring (deprecated, use \""
|
||||||
+ DATABASE_EXCLUDE_LIST.name() + "\" instead)");
|
+ DATABASE_EXCLUDE_LIST.name() + "\" instead)");
|
||||||
@ -637,9 +637,20 @@ public Boolean isFullColummnScanRequired() {
|
|||||||
return getConfig().getBoolean(SNAPSHOT_FULL_COLUMN_SCAN_FORCE);
|
return getConfig().getBoolean(SNAPSHOT_FULL_COLUMN_SCAN_FORCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int validateColumnBlacklist(Configuration config, Field field, Field.ValidationOutput problems) {
|
||||||
|
String blacklist = Configuration.getFallbackStringProperty(config, COLUMN_INCLUDE_LIST, COLUMN_WHITELIST);
|
||||||
|
String whitelist = Configuration.getFallbackStringProperty(config, COLUMN_EXCLUDE_LIST, COLUMN_BLACKLIST);
|
||||||
|
|
||||||
|
if (whitelist != null && blacklist != null) {
|
||||||
|
problems.accept(COLUMN_BLACKLIST, blacklist, COLUMN_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private static int validateColumnExcludeList(Configuration config, Field field, Field.ValidationOutput problems) {
|
private static int validateColumnExcludeList(Configuration config, Field field, Field.ValidationOutput problems) {
|
||||||
String includeList = Configuration.getFallbackStringProperty(config, COLUMN_INCLUDE_LIST, COLUMN_WHITELIST);
|
String includeList = config.getString(COLUMN_INCLUDE_LIST);
|
||||||
String excludeList = Configuration.getFallbackStringProperty(config, COLUMN_EXCLUDE_LIST, COLUMN_BLACKLIST);
|
String excludeList = config.getString(COLUMN_EXCLUDE_LIST);
|
||||||
|
|
||||||
if (includeList != null && excludeList != null) {
|
if (includeList != null && excludeList != null) {
|
||||||
problems.accept(COLUMN_EXCLUDE_LIST, excludeList, COLUMN_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
problems.accept(COLUMN_EXCLUDE_LIST, excludeList, COLUMN_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||||
@ -657,15 +668,25 @@ public TableIdToStringMapper getTableIdMapper() {
|
|||||||
return tableIdMapper;
|
return tableIdMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int validateTableBlacklist(Configuration config, Field field, ValidationOutput problems) {
|
||||||
|
String whitelist = Configuration.getFallbackStringProperty(config, TABLE_INCLUDE_LIST, TABLE_WHITELIST);
|
||||||
|
String blacklist = Configuration.getFallbackStringProperty(config, TABLE_EXCLUDE_LIST, TABLE_BLACKLIST);
|
||||||
|
|
||||||
|
if (whitelist != null && blacklist != null) {
|
||||||
|
problems.accept(TABLE_BLACKLIST, blacklist, TABLE_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private static int validateTableExcludeList(Configuration config, Field field, ValidationOutput problems) {
|
private static int validateTableExcludeList(Configuration config, Field field, ValidationOutput problems) {
|
||||||
String includeList = Configuration.getFallbackStringProperty(config, TABLE_INCLUDE_LIST, TABLE_WHITELIST);
|
String includeList = config.getString(TABLE_WHITELIST);
|
||||||
String excludeList = Configuration.getFallbackStringProperty(config, TABLE_EXCLUDE_LIST, TABLE_BLACKLIST);
|
String excludeList = config.getString(TABLE_BLACKLIST);
|
||||||
|
|
||||||
if (includeList != null && excludeList != null) {
|
if (includeList != null && excludeList != null) {
|
||||||
problems.accept(TABLE_EXCLUDE_LIST, excludeList, TABLE_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
problems.accept(TABLE_EXCLUDE_LIST, excludeList, TABLE_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,9 +711,20 @@ public Map<TableId, String> getSnapshotSelectOverridesByTable() {
|
|||||||
return Collections.unmodifiableMap(snapshotSelectOverridesByTable);
|
return Collections.unmodifiableMap(snapshotSelectOverridesByTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int validateSchemaBlacklist(Configuration config, Field field, Field.ValidationOutput problems) {
|
||||||
|
String whitelist = Configuration.getFallbackStringProperty(config, SCHEMA_INCLUDE_LIST, SCHEMA_WHITELIST);
|
||||||
|
String blacklist = Configuration.getFallbackStringProperty(config, SCHEMA_EXCLUDE_LIST, SCHEMA_BLACKLIST);
|
||||||
|
|
||||||
|
if (whitelist != null && blacklist != null) {
|
||||||
|
problems.accept(SCHEMA_BLACKLIST, blacklist, SCHEMA_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private static int validateSchemaExcludeList(Configuration config, Field field, Field.ValidationOutput problems) {
|
private static int validateSchemaExcludeList(Configuration config, Field field, Field.ValidationOutput problems) {
|
||||||
String includeList = Configuration.getFallbackStringProperty(config, SCHEMA_INCLUDE_LIST, SCHEMA_WHITELIST);
|
String includeList = config.getString(SCHEMA_INCLUDE_LIST);
|
||||||
String excludeList = Configuration.getFallbackStringProperty(config, SCHEMA_EXCLUDE_LIST, SCHEMA_BLACKLIST);
|
String excludeList = config.getString(SCHEMA_EXCLUDE_LIST);
|
||||||
|
|
||||||
if (includeList != null && excludeList != null) {
|
if (includeList != null && excludeList != null) {
|
||||||
problems.accept(SCHEMA_EXCLUDE_LIST, excludeList, SCHEMA_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
problems.accept(SCHEMA_EXCLUDE_LIST, excludeList, SCHEMA_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||||
@ -711,6 +743,16 @@ private static int validateDatabaseExcludeList(Configuration config, Field field
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int validateDatabaseBlacklist(Configuration config, Field field, ValidationOutput problems) {
|
||||||
|
String whitelist = Configuration.getFallbackStringProperty(config, DATABASE_INCLUDE_LIST, DATABASE_WHITELIST);
|
||||||
|
String blacklist = Configuration.getFallbackStringProperty(config, DATABASE_EXCLUDE_LIST, DATABASE_BLACKLIST);
|
||||||
|
if (whitelist != null && blacklist != null) {
|
||||||
|
problems.accept(DATABASE_BLACKLIST, blacklist, DATABASE_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private static int validateMessageKeyColumnsField(Configuration config, Field field, Field.ValidationOutput problems) {
|
private static int validateMessageKeyColumnsField(Configuration config, Field field, Field.ValidationOutput problems) {
|
||||||
String msgKeyColumns = config.getString(MSG_KEY_COLUMNS);
|
String msgKeyColumns = config.getString(MSG_KEY_COLUMNS);
|
||||||
int problemCount = 0;
|
int problemCount = 0;
|
||||||
|
@ -70,7 +70,7 @@ public void shouldThrowValidationOnDuplicateOldColumnFilterConfigurationOld() {
|
|||||||
.with(COLUMN_BLACKLIST, ".+bb")
|
.with(COLUMN_BLACKLIST, ".+bb")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
List<String> errorMessages = config.validate(Field.setOf(COLUMN_EXCLUDE_LIST)).get(COLUMN_EXCLUDE_LIST.name()).errorMessages();
|
List<String> errorMessages = config.validate(Field.setOf(COLUMN_BLACKLIST)).get(COLUMN_BLACKLIST.name()).errorMessages();
|
||||||
assertThat(errorMessages).isNotEmpty();
|
assertThat(errorMessages).isNotEmpty();
|
||||||
assertThat(errorMessages.get(0)).isEqualTo(RelationalDatabaseConnectorConfig.COLUMN_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
assertThat(errorMessages.get(0)).isEqualTo(RelationalDatabaseConnectorConfig.COLUMN_INCLUDE_LIST_ALREADY_SPECIFIED_ERROR_MSG);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user