Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohansong committed Jan 26, 2024
1 parent f875c01 commit 247a775
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static String sanitizeTopicPrefix(final String topicName) {
StringBuilder sanitizedNameBuilder = new StringBuilder(topicName.length());
boolean changed = false;

for(int i = 0; i < topicName.length(); ++i) {
for (int i = 0; i < topicName.length(); ++i) {
char c = topicName.charAt(i);
if (isValidCharacter(c)) {
sanitizedNameBuilder.append(c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

package io.airbyte.cdk.integrations.debezium.internals.mysql;

import static io.airbyte.cdk.integrations.debezium.internals.DebeziumPropertiesManager.TOPIC_PREFIX_KEY;
import static io.airbyte.cdk.integrations.debezium.internals.mysql.MysqlCdcStateConstants.COMPRESSION_ENABLED;
import static io.debezium.config.CommonConnectorConfig.TOPIC_PREFIX;
import static io.debezium.relational.RelationalDatabaseConnectorConfig.DATABASE_NAME;

import com.fasterxml.jackson.databind.JsonNode;
Expand Down Expand Up @@ -241,7 +239,8 @@ public JsonNode constructInitialDebeziumState(final Properties properties,
// construct the db schema history.
properties.setProperty("snapshot.mode", "schema_only_recovery");
final String dbName = database.getSourceConfig().get(JdbcUtils.DATABASE_KEY).asText();
// Topic.prefix is sanitized version of database name. At this stage properties does not have this value - it's set in RelationalDbDebeziumPropertiesManager.
// Topic.prefix is sanitized version of database name. At this stage properties does not have this
// value - it's set in RelationalDbDebeziumPropertiesManager.
final AirbyteFileOffsetBackingStore offsetManager = AirbyteFileOffsetBackingStore.initializeState(
constructBinlogOffset(database, dbName, DebeziumPropertiesManager.sanitizeTopicPrefix(dbName)),
Optional.empty());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.integrations.source.mysql;

import io.airbyte.integrations.source.mysql.MySQLTestDatabase.BaseImage;
Expand All @@ -6,8 +10,10 @@
public class CdcMysqlSourceWithSpecialDbNameTest extends CdcMysqlSourceTest {

public static final String INVALID_DB_NAME = "invalid@name";

@Override
protected MySQLTestDatabase createTestDatabase() {
return MySQLTestDatabase.inWithDbName(BaseImage.MYSQL_8, INVALID_DB_NAME, ContainerModifier.INVALID_TIMEZONE_CEST).withCdcPermissions();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ public MySQLTestDatabase withoutStrictMode() {
public String getDatabaseName() {
if (databaseName.isBlank()) {
return super.getDatabaseName();
}
else {
} else {
return databaseName;
}
}
Expand All @@ -103,7 +102,7 @@ public void setDatabaseName(final String databaseName) {

@Override
protected Stream<Stream<String>> inContainerBootstrapCmd() {
System.out.println("name: " + String.format("CREATE DATABASE `%s`", getDatabaseName()));
System.out.println("name: " + String.format("CREATE DATABASE `%s`", getDatabaseName()));
return Stream.of(mysqlCmd(Stream.of(
String.format("SET GLOBAL max_connections=%d", MAX_CONNECTIONS),
String.format("CREATE DATABASE \\`%s\\`", getDatabaseName()),
Expand Down

0 comments on commit 247a775

Please sign in to comment.