DBZ-1671 add innodb_lock_wait_timeout and update info log
This commit is contained in:
parent
3f006f8c0e
commit
fc24de8dde
@ -265,12 +265,22 @@ protected void execute() {
|
|||||||
if (!isRunning()) {
|
if (!isRunning()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("Step 0: disabling autocommit and enabling repeatable read transactions");
|
|
||||||
|
final long snapshotLockTimeout = context.getConnectorConfig().snapshotLockTimeout().getSeconds();
|
||||||
|
logger.info("Step 0: disabling autocommit, enabling repeatable read transactions, and setting lock wait timeout to {}",
|
||||||
|
snapshotLockTimeout);
|
||||||
mysql.setAutoCommit(false);
|
mysql.setAutoCommit(false);
|
||||||
sql.set("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ");
|
sql.set("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ");
|
||||||
mysql.executeWithoutCommitting(sql.get());
|
mysql.executeWithoutCommitting(sql.get());
|
||||||
sql.set("SET SESSION lock_wait_timeout=" + context.getConnectorConfig().snapshotLockTimeout().getSeconds());
|
sql.set("SET SESSION lock_wait_timeout=" + snapshotLockTimeout);
|
||||||
mysql.executeWithoutCommitting(sql.get());
|
mysql.executeWithoutCommitting(sql.get());
|
||||||
|
try {
|
||||||
|
sql.set("SET SESSION innodb_lock_wait_timeout=" + snapshotLockTimeout);
|
||||||
|
mysql.executeWithoutCommitting(sql.get());
|
||||||
|
}
|
||||||
|
catch (SQLException e) {
|
||||||
|
logger.warn("Unable to set innodb_lock_wait_timeout due to error: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
// Generate the DDL statements that set the charset-related system variables ...
|
// Generate the DDL statements that set the charset-related system variables ...
|
||||||
Map<String, String> systemVariables = connectionContext.readMySqlCharsetSystemVariables();
|
Map<String, String> systemVariables = connectionContext.readMySqlCharsetSystemVariables();
|
||||||
|
Loading…
Reference in New Issue
Block a user