DBZ-769 Try to release table locks during exception

This commit is contained in:
Jiri Pechanec 2018-09-18 09:17:48 +02:00 committed by Gunnar Morling
parent 6f0d11cc64
commit 6fe48b7764

View File

@ -699,6 +699,21 @@ protected void execute() {
}
}
} catch (Throwable e) {
if (isLocked) {
try {
sql.set("UNLOCK TABLES");
mysql.execute(sql.get());
}
catch (Exception eUnlock) {
logger.error("Removing of table locks not completed successfully", eUnlock);
}
try {
mysql.connection().rollback();
}
catch (Exception eRollback) {
logger.error("Execption while rollback is executed", eRollback);
}
}
failed(e, "Aborting snapshot due to error when last running '" + sql.get() + "': " + e.getMessage());
}
}