DBZ-5100 Do not default database.server.id

This commit is contained in:
Chris Cranford 2022-05-06 14:01:32 -04:00 committed by Jiri Pechanec
parent bf6a4b4873
commit 65017dc2d6
3 changed files with 3 additions and 11 deletions

View File

@ -7,7 +7,6 @@
import java.math.BigDecimal;
import java.time.Duration;
import java.util.Random;
import java.util.Set;
import java.util.function.Predicate;
@ -609,13 +608,12 @@ public static GtidNewChannelPosition parse(String value, String defaultValue) {
.withGroup(Field.createGroupEntry(Field.Group.CONNECTION, 1))
.withWidth(Width.LONG)
.withImportance(Importance.HIGH)
.withDefault(MySqlConnectorConfig::randomServerId)
.required()
.withValidation(Field::isPositiveLong)
.withDescription("A numeric ID of this database client, which must be unique across all "
+ "currently-running database processes in the cluster. This connector joins the "
+ "MySQL database cluster as another server (with this unique ID) so it can read "
+ "the binlog. By default, a random number is generated between 5400 and 6400.");
+ "the binlog.");
public static final Field SERVER_ID_OFFSET = Field.create("database.server.id.offset")
.withDisplayName("Cluster ID offset")
@ -1188,12 +1186,6 @@ private static int validateTimePrecisionMode(Configuration config, Field field,
return 0;
}
private static int randomServerId() {
int lowestServerId = 5400;
int highestServerId = 6400;
return lowestServerId + new Random().nextInt(highestServerId - lowestServerId);
}
@Override
protected SourceInfoStructMaker<? extends AbstractSourceInfo> getSourceInfoStructMaker(Version version) {
switch (version) {

View File

@ -129,7 +129,7 @@ public void shouldFailToValidateInvalidConfiguration() {
assertNoConfigurationErrors(result, MySqlConnectorConfig.PORT);
assertConfigurationErrors(result, MySqlConnectorConfig.USER, 1);
assertConfigurationErrors(result, MySqlConnectorConfig.SERVER_NAME, 2);
assertNoConfigurationErrors(result, MySqlConnectorConfig.SERVER_ID);
assertConfigurationErrors(result, MySqlConnectorConfig.SERVER_ID);
assertNoConfigurationErrors(result, MySqlConnectorConfig.TABLES_IGNORE_BUILTIN);
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_WHITELIST);
assertNoConfigurationErrors(result, MySqlConnectorConfig.DATABASE_INCLUDE_LIST);

View File

@ -2349,7 +2349,7 @@ The connector is also unable to recover its database history topic.
|[[mysql-property-database-server-id]]<<mysql-property-database-server-id, `+database.server.id+`>>
|_random_
|A numeric ID of this database client, which must be unique across all currently-running database processes in the MySQL cluster. This connector joins the MySQL database cluster as another server (with this unique ID) so it can read the binlog. By default, a random number between 5400 and 6400 is generated, though the recommendation is to explicitly set a value.
|A numeric ID of this database client, which must be unique across all currently-running database processes in the MySQL cluster. This connector joins the MySQL database cluster as another server (with this unique ID) so it can read the binlog.
|[[mysql-property-database-include-list]]<<mysql-property-database-include-list, `+database.include.list+`>>
|_empty string_