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

yangzhg 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 9d25bfe  [Bug] Fix bug that database not found when replaying batch 
transaction remove log (#5815)
9d25bfe is described below

commit 9d25bfe98058da589b9685896557e37ca90894f7
Author: Mingyu Chen <[email protected]>
AuthorDate: Mon May 17 11:50:46 2021 +0800

    [Bug] Fix bug that database not found when replaying batch transaction 
remove log (#5815)
    
    * [Bug] Fix bug that database not found when replaying batch transaction 
remove log
    
    [GlobalTransactionMgr.replayBatchRemoveTransactions():353] replay batch 
remove transactions failed. db 0
    org.apache.doris.common.AnalysisException: errCode = 2, detailMessage = 
databaseTransactionMgr[0] does not exist
            at 
org.apache.doris.transaction.GlobalTransactionMgr.getDatabaseTransactionMgr(GlobalTransactionMgr.java:84)
 ~[palo-fe.jar:3.4.0]
            at 
org.apache.doris.transaction.GlobalTransactionMgr.replayBatchRemoveTransactions(GlobalTransactionMgr.java:350)
 [palo-fe.jar:3.4.0]
            at org.apache.doris.persist.EditLog.loadJournal(EditLog.java:601) 
[palo-fe.jar:3.4.0]
            at 
org.apache.doris.catalog.Catalog.replayJournal(Catalog.java:2452) 
[palo-fe.jar:3.4.0]
            at 
org.apache.doris.master.Checkpoint.runAfterCatalogReady(Checkpoint.java:101) 
[palo-fe.jar:3.4.0]
            at 
org.apache.doris.common.util.MasterDaemon.runOneCycle(MasterDaemon.java:58) 
[palo-fe.jar:3.4.0]
            at org.apache.doris.common.util.Daemon.run(Daemon.java:116) 
[palo-fe.jar:3.4.0]
    
    The id of information_scheam database is 0, and it has no txn at all.
---
 be/src/runtime/plan_fragment_executor.cpp                    |  2 +-
 .../org/apache/doris/transaction/DatabaseTransactionMgr.java | 12 +++++++-----
 .../test/java/org/apache/doris/planner/QueryPlanTest.java    |  4 ++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/be/src/runtime/plan_fragment_executor.cpp 
b/be/src/runtime/plan_fragment_executor.cpp
index 005cfe5..815d0d1 100644
--- a/be/src/runtime/plan_fragment_executor.cpp
+++ b/be/src/runtime/plan_fragment_executor.cpp
@@ -241,7 +241,7 @@ Status PlanFragmentExecutor::open() {
     // may block
     // TODO: if no report thread is started, make sure to send a final profile
     // at end, otherwise the coordinator hangs in case we finish w/ an error
-    if (_is_report_success && !_report_status_cb.empty() && 
config::status_report_interval > 0) {
+    if (_is_report_success && _report_status_cb && 
config::status_report_interval > 0) {
         std::unique_lock<std::mutex> l(_report_thread_lock);
         _report_thread = boost::thread(&PlanFragmentExecutor::report_profile, 
this);
         // make sure the thread started up, otherwise report_profile() might 
get into a race
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 45d15dc..a33b3ae 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
@@ -1122,11 +1122,13 @@ public class DatabaseTransactionMgr {
             leftNum = unprotectedRemoveExpiredTxns(currentMillis, 
expiredTxnIds, finalStatusTransactionStateDequeShort, leftNum);
             leftNum = unprotectedRemoveExpiredTxns(currentMillis, 
expiredTxnIds, finalStatusTransactionStateDequeLong, leftNum);
 
-            Map<Long, List<Long>> dbExpiredTxnIds = Maps.newHashMap();
-            dbExpiredTxnIds.put(dbId, expiredTxnIds);
-            BatchRemoveTransactionsOperation op = new 
BatchRemoveTransactionsOperation(dbExpiredTxnIds);
-            editLog.logBatchRemoveTransactions(op);
-            LOG.info("Remove {} expired transactions", 
MAX_REMOVE_TXN_PER_ROUND - leftNum);
+            if (!expiredTxnIds.isEmpty()) {
+                Map<Long, List<Long>> dbExpiredTxnIds = Maps.newHashMap();
+                dbExpiredTxnIds.put(dbId, expiredTxnIds);
+                BatchRemoveTransactionsOperation op = new 
BatchRemoveTransactionsOperation(dbExpiredTxnIds);
+                editLog.logBatchRemoveTransactions(op);
+                LOG.info("Remove {} expired transactions", 
MAX_REMOVE_TXN_PER_ROUND - leftNum);
+            }
         } finally {
             writeUnlock();
         }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
index c9f3000..3ce7198 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
@@ -497,7 +497,7 @@ public class QueryPlanTest {
 
         testBitmapQueryPlan(
                 "select count(*) from test.bitmap_table where id2 = 1;",
-                "type not match, originType=BITMAP, targeType=DOUBLE"
+                "Bitmap type dose not support operand: `id2` = 1"
         );
 
     }
@@ -556,7 +556,7 @@ public class QueryPlanTest {
 
         testHLLQueryPlan(
                 "select count(*) from test.hll_table where id2 = 1",
-                "type not match, originType=HLL, targeType=DOUBLE"
+                "Hll type dose not support operand: `id2` = 1"
         );
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to