diff --git a/lealone-aote/src/main/java/org/lealone/transaction/aote/AOTransaction.java b/lealone-aote/src/main/java/org/lealone/transaction/aote/AOTransaction.java index 9c7c0e937..12809773a 100644 --- a/lealone-aote/src/main/java/org/lealone/transaction/aote/AOTransaction.java +++ b/lealone-aote/src/main/java/org/lealone/transaction/aote/AOTransaction.java @@ -308,14 +308,12 @@ public void checkTimeout() { if (lockedBy != null && lockStartTime != 0 && System.currentTimeMillis() - lockStartTime > session.getLockTimeout()) { boolean isDeadlock = false; - WaitingTransaction waitingTransaction = null; LinkedList waitingTransactions = waitingTransactionsRef.get(); if (waitingTransactions == null) return; for (WaitingTransaction wt : waitingTransactions) { if (wt.getTransaction() == lockedBy) { isDeadlock = true; - waitingTransaction = wt; break; } } @@ -329,23 +327,23 @@ public void checkTimeout() { break; } } + String keyStr = waitingTransaction2.getKey().toString(); if (isDeadlock) { - String msg = getMsg(transactionId, session, lockedBy, waitingTransaction2); - msg += "\r\n" - + getMsg(lockedBy.transactionId, lockedBy.session, this, waitingTransaction); + String msg = getMsg(transactionId, session, lockedBy); + msg += "\r\n" + getMsg(lockedBy.transactionId, lockedBy.session, this); + + msg += ", the locked object: " + keyStr; throw DbException.get(ErrorCode.DEADLOCK_1, msg); } else { - String msg = getMsg(transactionId, session, lockedBy, waitingTransaction2); - throw DbException.get(ErrorCode.LOCK_TIMEOUT_1, msg); + String msg = getMsg(transactionId, session, lockedBy); + throw DbException.get(ErrorCode.LOCK_TIMEOUT_1, keyStr, msg); } } } - private static String getMsg(long tid, Session session, AOTransaction transaction, - WaitingTransaction waitingTransaction) { + private static String getMsg(long tid, Session session, AOTransaction transaction) { return "transaction #" + tid + " in session " + session + " wait for transaction #" - + transaction.transactionId + " in session " + transaction.session + ", key: " - + waitingTransaction.getKey(); + + transaction.transactionId + " in session " + transaction.session; } @Override diff --git a/lealone-common/src/main/resources/org/lealone/common/resources/_messages_en.prop b/lealone-common/src/main/resources/org/lealone/common/resources/_messages_en.prop index 1d235fd39..d3d146c55 100644 --- a/lealone-common/src/main/resources/org/lealone/common/resources/_messages_en.prop +++ b/lealone-common/src/main/resources/org/lealone/common/resources/_messages_en.prop @@ -176,4 +176,4 @@ HY000=General error: {0} HY004=Unknown data type: {0} HYC00=Feature not supported: {0} -HYT00=Timeout trying to lock row {0} +HYT00=Timeout trying to lock object: {0}. Details: {1} diff --git a/lealone-common/src/main/resources/org/lealone/common/resources/_messages_zh.prop b/lealone-common/src/main/resources/org/lealone/common/resources/_messages_zh.prop index 0b75f382d..77e13d76b 100644 --- a/lealone-common/src/main/resources/org/lealone/common/resources/_messages_zh.prop +++ b/lealone-common/src/main/resources/org/lealone/common/resources/_messages_zh.prop @@ -176,4 +176,4 @@ HY000=常规错误: {0} HY004=位置数据类型: {0} HYC00=不支持的特性: {0} -HYT00=尝试锁定行 {0} 的时候超时 +HYT00=尝试锁对象 {0} 的时候超时. 详情: {1}