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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2a5a1099f8a [fix](wal) replay wal abort txn failed when execute failed 
(#55881)
2a5a1099f8a is described below

commit 2a5a1099f8abc6de57988ad27a815ced335a27ca
Author: meiyi <[email protected]>
AuthorDate: Thu Sep 11 19:00:46 2025 +0800

    [fix](wal) replay wal abort txn failed when execute failed (#55881)
    
    Problem Summary:
    when replay wal failed and then abort txn, the db_id is not set, will
    get:
    ```
    2025-09-10 15:30:00,687 DEBUG (thrift-server-pool-21|177) 
[FrontendServiceImpl.loadTxnRollback():1902] receive txn rollback request: 
TLoadTxnRollbackRequest(user:admin, passwd:, db:, tbl:, user_ip:, txnId:-1, 
reason:[OK], tbls:[], 
label:group_commit_454b486649018fd4_f8985d893061b7b9_test_wait), backend: 
[172.20.56.196](http://172.20.56.196/)
    2025-09-10 15:30:00,687 WARN (thrift-server-pool-21|177) 
[FrontendServiceImpl.loadTxnRollback():1920] failed to rollback txn, id: -1, 
label: group_commit_454b486649018fd4_f8985d893061b7b9_test_wait 
org.apache.doris.common.MetaNotFoundException: errCode = 7, detailMessage = db 
does not exist at 
org.apache.doris.service.FrontendServiceImpl.loadTxnRollbackImpl(FrontendServiceImpl.java:1964)
    ```
    
    ### Release note
---
 be/src/olap/wal/wal_table.cpp                            |  4 ++++
 .../group_commit/test_group_commit_replay_wal.groovy     | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/be/src/olap/wal/wal_table.cpp b/be/src/olap/wal/wal_table.cpp
index 83d2b280dc7..e990ec452e6 100644
--- a/be/src/olap/wal/wal_table.cpp
+++ b/be/src/olap/wal/wal_table.cpp
@@ -243,6 +243,8 @@ Status WalTable::_handle_stream_load(int64_t wal_id, const 
std::string& wal,
     RETURN_IF_ERROR(_construct_sql_str(wal, label, sql_str));
     std::shared_ptr<StreamLoadContext> ctx = 
std::make_shared<StreamLoadContext>(_exec_env);
     ctx->sql_str = sql_str;
+    ctx->db_id = _db_id;
+    ctx->table_id = _table_id;
     ctx->wal_id = wal_id;
     ctx->label = label;
     ctx->need_commit_self = false;
@@ -253,6 +255,8 @@ Status WalTable::_handle_stream_load(int64_t wal_id, const 
std::string& wal,
     ctx->load_src_type = TLoadSourceType::RAW;
     ctx->max_filter_ratio = 1;
     auto st = _http_stream_action->process_put(nullptr, ctx);
+    DBUG_EXECUTE_IF("WalTable::_handle_stream_load.fail",
+                    { st = 
Status::InternalError("WalTable::_handle_stream_load.fail"); });
     if (st.ok()) {
         // wait stream load finish
         RETURN_IF_ERROR(ctx->future.get());
diff --git 
a/regression-test/suites/insert_p0/group_commit/test_group_commit_replay_wal.groovy
 
b/regression-test/suites/insert_p0/group_commit/test_group_commit_replay_wal.groovy
index 0fbc3ec0a8d..856515b3350 100644
--- 
a/regression-test/suites/insert_p0/group_commit/test_group_commit_replay_wal.groovy
+++ 
b/regression-test/suites/insert_p0/group_commit/test_group_commit_replay_wal.groovy
@@ -100,7 +100,23 @@ suite("test_group_commit_replay_wal", "nonConcurrent") {
             sleep(100)
         }
 
+        // replay wal fail
+        
GetDebugPoint().enableDebugPointForAllBEs("WalTable::_handle_stream_load.fail")
         GetDebugPoint().clearDebugPointsForAllFEs()
+        getRowCount(4)
+
+        int expectedRowCount = 8
+        for (int i = 0; i < 30; i++) {
+            def result = sql "select count(*) from ${tableName}"
+            logger.info("table: ${tableName}, rowCount: ${result}, i: ${i}")
+            if (result[0][0] == expectedRowCount) {
+                break
+            }
+            sleep(1000)
+            if (i >= 4) {
+                
GetDebugPoint().disableDebugPointForAllBEs("WalTable::_handle_stream_load.fail")
+            }
+        }
         getRowCount(8)
         // check wal count is 0
     } catch (Exception e) {


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

Reply via email to