提交 62308b49 authored 作者: Thomas Mueller's avatar Thomas Mueller

An out of memory error while deleting or updating many rows could result in a strange exception.

上级 87f9a57a
......@@ -230,8 +230,22 @@ public abstract class Command implements CommandInterface {
database.checkPowerOff();
if (e.getErrorCode() == ErrorCode.DEADLOCK_1) {
session.rollback();
} else if (e.getErrorCode() == ErrorCode.OUT_OF_MEMORY) {
// try to rollback, saving memory
try {
session.rollbackTo(rollback, true);
} catch (SQLException e2) {
if (e2.getErrorCode() == ErrorCode.OUT_OF_MEMORY) {
// if rollback didn't work, there is a serious problem:
// the transaction may be applied partially
// in this case we need to panic:
// close the database
session.getDatabase().shutdownImmediately();
}
throw e2;
}
} else {
session.rollbackTo(rollback);
session.rollbackTo(rollback, false);
}
throw e;
} finally {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论