DBZ-5811 Use validate method

This commit is contained in:
Jiri Pechanec 2022-12-05 12:36:58 +01:00
parent 66fb51b55a
commit 574c1b0015
3 changed files with 11 additions and 7 deletions

View File

@ -393,6 +393,7 @@ Stathis Souris
Stefan Miklosovic
Stephen Powis
Steven Siahetiong
Subodh Kant Chaturvedi
Sungho Hwang
Syed Muhammad Sufyian
Tapani Moilanen

View File

@ -851,13 +851,7 @@ public static AutoCreateMode parse(String value, String defaultValue) {
.withDescription(
"Boolean to determine if Debezium should flush LSN in the source postgres database. If set to false, user will have to flush the LSN manually outside Debezium.")
.withDefault(Boolean.TRUE)
.withValidation(Field::isBoolean, (config, field, problems) -> {
if (config.getString(PostgresConnectorConfig.SHOULD_FLUSH_LSN_IN_SOURCE_DB.name(), "true").equalsIgnoreCase("false")) {
LOGGER.warn(
"Property flush.lsn.source is set to false, the LSN will not be flushed to the database source and WAL logs will not be cleared. User is expected to handle this outside Debezium.");
}
return 0;
});
.withValidation(Field::isBoolean, PostgresConnectorConfig::validateFlushLsnSource);
private final LogicalDecodingMessageFilter logicalDecodingMessageFilter;
private final HStoreHandlingMode hStoreHandlingMode;
@ -1071,6 +1065,14 @@ private static int validateLogicalDecodingMessageExcludeList(Configuration confi
return 0;
}
private static int validateFlushLsnSource(Configuration config, Field field, Field.ValidationOutput problems) {
if (config.getString(PostgresConnectorConfig.SHOULD_FLUSH_LSN_IN_SOURCE_DB, "true").equalsIgnoreCase("false")) {
LOGGER.warn("Property '" + PostgresConnectorConfig.SHOULD_FLUSH_LSN_IN_SOURCE_DB.name()
+ "' is set to 'false', the LSN will not be flushed to the database source and WAL logs will not be cleared. User is expected to handle this outside Debezium.");
}
return 0;
}
@Override
public String getContextName() {
return Module.contextName();

View File

@ -172,3 +172,4 @@ dude0001,Mark Lambert
adasari,Anil Dasari
mkobayas,Masazumi Kobayashi
Skezzowski,Balázs Sipos
subodh,Subodh Kant Chaturvedi