This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 89d37d920e [fix](transaction) Fix running transaction num always be 
zero when execute show proc '/transactions' stmt (#9106)
89d37d920e is described below

commit 89d37d920e059f81c5b14ead72adced6892420cb
Author: caiconghui <55968745+caicong...@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-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to