DBZ-7693 Fix running mariadb-ci-gtids profile

This commit is contained in:
Chris Cranford 2024-03-28 19:58:04 -04:00 committed by Jiri Pechanec
parent 2181d8b7a3
commit 3527fdd320
9 changed files with 42 additions and 94 deletions

View File

@ -19,5 +19,7 @@ public interface BinlogConnectorTest<C extends SourceConnector> {
BinlogTestConnection getTestDatabaseConnection(String databaseName);
BinlogTestConnection getTestReplicaDatabaseConnection(String databaseName);
boolean isMariaDb();
}

View File

@ -362,7 +362,7 @@ private void alterTableWithSqlBinLogOff(String ddl, boolean replicaIsMaster) thr
if (!replicaIsMaster) {
// if it has replica, also apply the DDL because master didn't record DDL at binlog
try (BinlogTestConnection db = getTestDatabaseConnection(DATABASE.getDatabaseName())) {
try (BinlogTestConnection db = getTestReplicaDatabaseConnection(DATABASE.getDatabaseName())) {
try (JdbcConnection connection = db.connect()) {
connection.execute("SET SQL_LOG_BIN=OFF;");
connection.execute(ddl);

View File

@ -400,7 +400,7 @@ private void alterTableWithSqlBinLogOff(String ddl, boolean replicaIsMaster) thr
if (!replicaIsMaster) {
// if has replica, also apply DDL because master didn't record DDL at binlog
try (BinlogTestConnection db = getTestDatabaseConnection(DATABASE.getDatabaseName())) {
try (BinlogTestConnection db = getTestReplicaDatabaseConnection(DATABASE.getDatabaseName())) {
try (JdbcConnection connection = db.connect()) {
connection.execute("SET SQL_LOG_BIN=OFF;");
connection.execute(ddl);

View File

@ -128,4 +128,14 @@ protected static JdbcConfiguration.Builder getDefaultJdbcConfig(String databaseN
.withDatabase(databaseName)
.with("characterEncoding", "utf8");
}
protected static JdbcConfiguration.Builder getReplicaJdbcConfig(String databaseName) {
return JdbcConfiguration.copy(
Configuration.fromSystemProperties("database.replica.")
.merge(Configuration.fromSystemProperties(DRIVER_CONFIG_PREFIX)
.merge(Configuration.fromSystemProperties(DATABASE_CONFIG_PREFIX))))
.withDatabase(databaseName)
.with("characterEncoding", "utf8");
}
}

View File

@ -4,43 +4,20 @@
# --------------------------------------------------------------------------------------------
# This section specifies 5.5 and cross-version common configurations
# --------------------------------------------------------------------------------------------
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
[mariadb]
skip-host-cache
skip-name-resolve
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
#secure-file-priv=/var/lib/mysql-files
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
#log-error=/var/log/mysqld.log
#pid-file=/var/run/mysqld/mysqld.pid
# ----------------------------------------------
# Debezium ingest
# ----------------------------------------------
# Enable binary replication log and set the prefix, expiration, and log format.
# The prefix is arbitrary, expiration can be short for integration tests but would
# be longer on a production system. Row-level info is required for ingest to work.
# Server ID is required, but this will vary on production systems
server-id = 112233
log_bin = mysql-bin
binlog_format = row
server-id = 112233
log_bin = mysql-bin
binlog_format = row
log_slave_updates = on
default_authentication_plugin = mysql_native_password

View File

@ -4,50 +4,15 @@
# --------------------------------------------------------------------------------------------
# This section specifies 5.5 and cross-version common configurations
# --------------------------------------------------------------------------------------------
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
[mariadb]
skip-host-cache
skip-name-resolve
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
#secure-file-priv=/var/lib/mysql-files
user=mysqlreplica
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
#log-error=/var/log/mysqld.log
#pid-file=/var/run/mysqld/mysqld.pid
# ----------------------------------------------
# Enable GTIDs on this primary server
# ----------------------------------------------
log_slave_updates = on
# Enable binary replication log and set the prefix, expiration, and log format.
# The prefix is arbitrary, expiration can be short for integration tests but would
# be longer on a production system. Row-level info is required for ingest to work.
# Server ID is required, but this will vary on production systems
server-id = 445566
log_bin = mysql-bin-slave
binlog_format = row
# --------------------------------------------------------------------------------------------
# This section specifies MariaDB specific configuration
# --------------------------------------------------------------------------------------------
[mariadb]
user=mysql
user = mysql
symbolic-links = 0
log_slave_updates = on
server-id = 445566
log_bin = mysql-bin-slave
binlog_format = row
read_only = 1
relay_log = mysql-relay-bin
default_authentication_plugin = mysql_native_password

View File

@ -33,6 +33,11 @@ default BinlogTestConnection getTestDatabaseConnection(String databaseName) {
return MariaDbTestConnection.forTestDatabase(databaseName);
}
@Override
default BinlogTestConnection getTestReplicaDatabaseConnection(String databaseName) {
return MariaDbTestConnection.forTestReplicaDatabase(databaseName);
}
@Override
default boolean isMariaDb() {
return true;

View File

@ -95,10 +95,14 @@ public static MariaDbTestConnection forTestDatabase(String databaseName) {
* @param urlProperties url properties
* @return the connection instance; never null
*/
public static MariaDbTestConnection forTestDatabase(String databaseName, Map<String, Object> urlProperties) {
final JdbcConfiguration.Builder builder = getDefaultJdbcConfig(databaseName);
urlProperties.forEach(builder::with);
return new MariaDbTestConnection(builder.build());
}
public static MariaDbTestConnection forTestReplicaDatabase(String databaseName) {
return new MariaDbTestConnection(getReplicaJdbcConfig(databaseName).build());
}
}

View File

@ -5,28 +5,13 @@
*/
package io.debezium.connector.mariadb.zzz;
import io.debezium.connector.binlog.util.BinlogTestConnection;
import io.debezium.connector.binlog.zzz.ZZZBinlogGtidSetIT;
import io.debezium.connector.mariadb.MariaDbCommon;
import io.debezium.connector.mariadb.MariaDbConnector;
import io.debezium.connector.mariadb.Module;
import io.debezium.connector.mariadb.util.MariaDbTestConnection;
/**
* @author Chris Cranford
*/
public class ZZZMariaDbGtidSetIT extends ZZZBinlogGtidSetIT<MariaDbConnector> {
@Override
public String getConnectorName() {
return Module.name();
}
public class ZZZMariaDbGtidSetIT extends ZZZBinlogGtidSetIT<MariaDbConnector> implements MariaDbCommon {
@Override
public Class<MariaDbConnector> getConnectorClass() {
return MariaDbConnector.class;
}
@Override
public BinlogTestConnection getTestDatabaseConnection(String databaseName) {
return MariaDbTestConnection.forTestDatabase(databaseName);
}
}