[enhancement](transaction) Reduce hold writeLock time for DatabaseTransactionMgr to improve stability of stream load (#17380)

Clear transaction state log occupies too much time, so we change clear transaction log level from info to debug


Co-authored-by: caiconghui1 <caiconghui1@jd.com>
This commit is contained in:
caiconghui
2023-03-03 19:06:39 +08:00
committed by GitHub
parent 5c265d8183
commit eea0cbec74

View File

@ -1383,7 +1383,9 @@ public class DatabaseTransactionMgr {
dbExpiredTxnIds.put(dbId, expiredTxnIds);
BatchRemoveTransactionsOperation op = new BatchRemoveTransactionsOperation(dbExpiredTxnIds);
editLog.logBatchRemoveTransactions(op);
LOG.info("Remove {} expired transactions", MAX_REMOVE_TXN_PER_ROUND - leftNum);
if (LOG.isDebugEnabled()) {
LOG.debug("Remove {} expired transactions", MAX_REMOVE_TXN_PER_ROUND - leftNum);
}
}
} finally {
writeUnlock();
@ -1416,7 +1418,9 @@ public class DatabaseTransactionMgr {
if (txnIds.isEmpty()) {
labelToTxnIds.remove(transactionState.getLabel());
}
LOG.info("transaction [" + txnId + "] is expired, remove it from transaction manager");
if (LOG.isDebugEnabled()) {
LOG.debug("transaction [" + txnId + "] is expired, remove it from transaction manager");
}
} else {
// should not happen, add a warn log to observer
LOG.warn("transaction state is not found when clear transaction: " + txnId);