DBZ-6240 Rename the configuration name 'schema.change.event.include.list' to 'schema.change.event.exclude.list'

This commit is contained in:
sunxiaojian 2023-08-08 19:48:37 +08:00 committed by Jiri Pechanec
parent 8943047809
commit 43c7c0a3f6
3 changed files with 12 additions and 12 deletions

View File

@ -33,8 +33,8 @@
public class SchemaChangeEventFilter<R extends ConnectRecord<R>> implements Transformation<R> {
private static final Logger LOGGER = LoggerFactory.getLogger(SchemaChangeEventFilter.class);
private static final Field SCHEMA_CHANGE_EVENT_INCLUDE_LIST = Field.create("schema.change.event.include.list")
.withDisplayName("Schema change event include list")
private static final Field SCHEMA_CHANGE_EVENT_EXCLUDE_LIST = Field.create("schema.change.event.exclude.list")
.withDisplayName("Schema change event exclude list")
.withType(ConfigDef.Type.STRING)
.withWidth(ConfigDef.Width.SHORT)
.withImportance(ConfigDef.Importance.LOW)
@ -49,8 +49,8 @@ public class SchemaChangeEventFilter<R extends ConnectRecord<R>> implements Tran
public void configure(Map<String, ?> configs) {
final Configuration config = Configuration.from(configs);
smtManager = new SmtManager<>(config);
smtManager.validate(config, Field.setOf(SCHEMA_CHANGE_EVENT_INCLUDE_LIST));
final String includeSchemaChangeEvents = config.getString(SCHEMA_CHANGE_EVENT_INCLUDE_LIST);
smtManager.validate(config, Field.setOf(SCHEMA_CHANGE_EVENT_EXCLUDE_LIST));
final String includeSchemaChangeEvents = config.getString(SCHEMA_CHANGE_EVENT_EXCLUDE_LIST);
this.includeSchemaChangeEvents = Arrays.stream(includeSchemaChangeEvents.split(",")).map(typeName -> SchemaChangeEvent.SchemaChangeEventType.valueOf(typeName))
.collect(Collectors.toSet());
@ -85,7 +85,7 @@ public R apply(R record) {
@Override
public ConfigDef config() {
final ConfigDef config = new ConfigDef();
Field.group(config, null, SCHEMA_CHANGE_EVENT_INCLUDE_LIST);
Field.group(config, null, SCHEMA_CHANGE_EVENT_EXCLUDE_LIST);
return config;
}

View File

@ -30,7 +30,7 @@
*/
public class SchemaChangeEventFilterTest extends AbstractExtractStateTest {
private static final String SCHEMA_CHANGE_EVENT_INCLUDE_LIST = "schema.change.event.include.list";
private static final String SCHEMA_CHANGE_EVENT_EXCLUDE_LIST = "schema.change.event.exclude.list";
private static final String SCHEMA_HISTORY_CHANGE_SCHEMA_NAME = "io.debezium.connector.schema.Change";
@Test
@ -38,7 +38,7 @@ public void whenNoDeclaredConfigExceptionIsThrew() {
try (SchemaChangeEventFilter<SourceRecord> transform = new SchemaChangeEventFilter<>()) {
final Map<String, String> props = new HashMap<>();
assertThatThrownBy(() -> transform.configure(props)).isInstanceOf(ConfigException.class).hasMessageContaining(
"Invalid value null for configuration schema.change.event.include.list: The 'schema.change.event.include.list' value is invalid: A value is required");
"Invalid value null for configuration schema.change.event.exclude.list: The 'schema.change.event.exclude.list' value is invalid: A value is required");
}
}
@ -46,7 +46,7 @@ public void whenNoDeclaredConfigExceptionIsThrew() {
public void testSchemaChangeContainsEventTypeFilter() {
try (SchemaChangeEventFilter<SourceRecord> transform = new SchemaChangeEventFilter<>()) {
final Map<String, String> props = new HashMap<>();
props.put(SCHEMA_CHANGE_EVENT_INCLUDE_LIST, "ALTER,CREATE");
props.put(SCHEMA_CHANGE_EVENT_EXCLUDE_LIST, "ALTER,CREATE");
transform.configure(props);
final SourceRecord record = createSchemaChangeRecordContainsEventType();
assertThat(transform.apply(record));
@ -57,7 +57,7 @@ public void testSchemaChangeContainsEventTypeFilter() {
public void testSchemaChangeNonEventTypeFilter() {
try (SchemaChangeEventFilter<SourceRecord> transform = new SchemaChangeEventFilter<>()) {
final Map<String, String> props = new HashMap<>();
props.put(SCHEMA_CHANGE_EVENT_INCLUDE_LIST, "ALTER,CREATE");
props.put(SCHEMA_CHANGE_EVENT_EXCLUDE_LIST, "ALTER,CREATE");
transform.configure(props);
final SourceRecord record = createSchemaChangeRecordNonEventType();
assertThat(transform.apply(record)).isNull();
@ -68,7 +68,7 @@ public void testSchemaChangeNonEventTypeFilter() {
public void testSchemaChangeNonContainsEventTypeFilter() {
try (SchemaChangeEventFilter<SourceRecord> transform = new SchemaChangeEventFilter<>()) {
final Map<String, String> props = new HashMap<>();
props.put(SCHEMA_CHANGE_EVENT_INCLUDE_LIST, "ALTER,CREATE");
props.put(SCHEMA_CHANGE_EVENT_EXCLUDE_LIST, "ALTER,CREATE");
transform.configure(props);
final SourceRecord record = createSchemaChangeRecordNonContainsEventType();
assertThat(transform.apply(record)).isNull();

View File

@ -25,7 +25,7 @@ For example, to filter out `DROP` and `TRUNCATE` from captured DDL event message
----
transforms=filterTableDropAndTruncateEvent
transforms.filterTableDropAndTruncateEvent.type=io.debezium.transforms.SchemaChangeEventFilter
transforms.filterTableDropAndTruncateEvent.schema.change.event.include.list=DROP,TRUNCATE
transforms.filterTableDropAndTruncateEvent.schema.change.event.exclude.list=DROP,TRUNCATE
----
The following example shows the changes in the values of event records before and after being filtered by the SchemaChangeEventFilter
@ -130,7 +130,7 @@ The following table lists the configuration options that you can use with the `S
|Valid Values
|Importance
|[[schema-change-event-filter-include-list]]<<schema-change-event-filter-include-list, `schema.change.event.include.list`>>
|[[schema-change-event-exclude-list]]<<schema-change-event-exclude-list, `schema.change.event.exclude.list`>>
|A comma-separated list of schema change events that need to be filtered, set to one or more of the following options:
* `CREATE`