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 Stefan Miklosovic
Stephen Powis Stephen Powis
Steven Siahetiong Steven Siahetiong
Subodh Kant Chaturvedi
Sungho Hwang Sungho Hwang
Syed Muhammad Sufyian Syed Muhammad Sufyian
Tapani Moilanen Tapani Moilanen

View File

@ -851,13 +851,7 @@ public static AutoCreateMode parse(String value, String defaultValue) {
.withDescription( .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.") "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) .withDefault(Boolean.TRUE)
.withValidation(Field::isBoolean, (config, field, problems) -> { .withValidation(Field::isBoolean, PostgresConnectorConfig::validateFlushLsnSource);
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;
});
private final LogicalDecodingMessageFilter logicalDecodingMessageFilter; private final LogicalDecodingMessageFilter logicalDecodingMessageFilter;
private final HStoreHandlingMode hStoreHandlingMode; private final HStoreHandlingMode hStoreHandlingMode;
@ -1071,6 +1065,14 @@ private static int validateLogicalDecodingMessageExcludeList(Configuration confi
return 0; 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 @Override
public String getContextName() { public String getContextName() {
return Module.contextName(); return Module.contextName();

View File

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