You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/04/26 15:52:06 UTC
[incubator-doris] 03/15: [fix](transaction) Fix running transaction num always be zero when execute show proc '/transactions' stmt (#9106)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
commit 4157e34f9e89e5f7fa0aa6269e367e35dfb9cfca
Author: caiconghui <55...@users.noreply.github.com>
AuthorDate: Sat Apr 23 21:37:18 2022 +0800
[fix](transaction) Fix running transaction num always be zero when execute show proc '/transactions' stmt (#9106)
---
.../java/org/apache/doris/transaction/DatabaseTransactionMgr.java | 6 ++----
.../java/org/apache/doris/transaction/GlobalTransactionMgr.java | 3 ++-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
index 5ee51575aa..f26a4a773a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
@@ -124,10 +124,10 @@ public class DatabaseTransactionMgr {
// count the number of running txns of database, except for the routine load txn
- private int runningTxnNums = 0;
+ private volatile int runningTxnNums = 0;
// count only the number of running routine load txns of database
- private int runningRoutineLoadTxnNums = 0;
+ private volatile int runningRoutineLoadTxnNums = 0;
private Catalog catalog;
@@ -195,12 +195,10 @@ public class DatabaseTransactionMgr {
return labelToTxnIds.get(label);
}
- @VisibleForTesting
protected int getRunningTxnNums() {
return runningTxnNums;
}
- @VisibleForTesting
protected int getRunningRoutineLoadTxnNums() {
return runningRoutineLoadTxnNums;
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java b/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
index a4fac836f5..b51cc9c0d9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
@@ -441,8 +441,9 @@ public class GlobalTransactionMgr implements Writable {
long runningNum = 0;
try {
DatabaseTransactionMgr dbMgr = getDatabaseTransactionMgr(dbId);
- runningNum = dbMgr.getRunningTxnNums();
+ runningNum = dbMgr.getRunningTxnNums() + dbMgr.getRunningRoutineLoadTxnNums();
} catch (AnalysisException e) {
+ LOG.warn("get database running transaction num failed", e);
}
info.add(runningNum);
infos.add(info);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org