DBZ-212 Remove PostgreSQL getLogicalName function

This commit is contained in:
krizhan 2019-03-13 18:51:01 -04:00 committed by Gunnar Morling
parent b2529352cc
commit 38f3856c31
2 changed files with 3 additions and 12 deletions

View File

@ -575,6 +575,7 @@ public static SchemaRefreshMode parse(String value) {
.withType(Type.STRING)
.withWidth(Width.MEDIUM)
.withImportance(Importance.HIGH)
.withValidation(Field::isRequired)
.withDescription("Unique name that identifies the database server and all recorded offsets, and"
+ "that is used as a prefix for all schemas and topics. "
+ "Each distinct Postgres installation should have a separate namespace and monitored by "
@ -859,7 +860,7 @@ public static SchemaRefreshMode parse(String value) {
protected PostgresConnectorConfig(Configuration config) {
super(
config,
getLogicalName(config),
config.getString(SERVER_NAME),
null, // TODO whitelist handling implemented locally here for the time being
null
);
@ -873,16 +874,6 @@ protected PostgresConnectorConfig(Configuration config) {
this.schemaRefreshMode = SchemaRefreshMode.parse(config.getString(SCHEMA_REFRESH_MODE));
}
private static String getLogicalName(Configuration config) {
String logicalName = config.getString(PostgresConnectorConfig.SERVER_NAME);
if (logicalName == null) {
logicalName = config.getString(HOSTNAME) + ":" + config.getInteger(PORT) + "/" + config.getString(DATABASE_NAME);
}
return logicalName;
}
protected String hostname() {
return config.getString(HOSTNAME);
}

View File

@ -126,13 +126,13 @@ public void shouldValidateConfiguration() throws Exception {
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.HOSTNAME, 1);
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.USER, 1);
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.DATABASE_NAME, 1);
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.SERVER_NAME, 1);
// validate the non required fields
validateField(validatedConfig, PostgresConnectorConfig.PLUGIN_NAME, LogicalDecoder.DECODERBUFS.getValue());
validateField(validatedConfig, PostgresConnectorConfig.SLOT_NAME, ReplicationConnection.Builder.DEFAULT_SLOT_NAME);
validateField(validatedConfig, PostgresConnectorConfig.DROP_SLOT_ON_STOP, Boolean.FALSE);
validateField(validatedConfig, PostgresConnectorConfig.PORT, PostgresConnectorConfig.DEFAULT_PORT);
validateField(validatedConfig, PostgresConnectorConfig.SERVER_NAME, null);
validateField(validatedConfig, PostgresConnectorConfig.TOPIC_SELECTION_STRATEGY, PostgresConnectorConfig.TopicSelectionStrategy.TOPIC_PER_TABLE);
validateField(validatedConfig, PostgresConnectorConfig.MAX_QUEUE_SIZE, PostgresConnectorConfig.DEFAULT_MAX_QUEUE_SIZE);
validateField(validatedConfig, PostgresConnectorConfig.MAX_BATCH_SIZE, PostgresConnectorConfig.DEFAULT_MAX_BATCH_SIZE);