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 4fc69273c13 [case](cloud) add case that partial update fail to update 
tmp rowset after it write new segment in publish phase  (#45795)
4fc69273c13 is described below

commit 4fc69273c13eb52d9f5bee8dac2f33677e5ac413
Author: bobhan1 <[email protected]>
AuthorDate: Wed Dec 25 22:18:20 2024 +0800

    [case](cloud) add case that partial update fail to update tmp rowset after 
it write new segment in publish phase  (#45795)
    
    add a case that partial update fail to update tmp rowset after it write
    a new segment in publish phase. The inverted checker is expected to fail
    because of this case before https://github.com/apache/doris/pull/45626
    is merged.
---
 be/src/cloud/cloud_tablet.cpp                      |  3 +
 ...cloud_partial_update_update_tmp_rowset_fail.out | 11 +++
 ...ud_partial_update_update_tmp_rowset_fail.groovy | 93 ++++++++++++++++++++++
 3 files changed, 107 insertions(+)

diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp
index 31b7c6dd5dc..134d44c921b 100644
--- a/be/src/cloud/cloud_tablet.cpp
+++ b/be/src/cloud/cloud_tablet.cpp
@@ -717,6 +717,9 @@ Status CloudTablet::save_delete_bitmap(const TabletTxnInfo* 
txn_info, int64_t tx
 
     if (txn_info->partial_update_info && 
txn_info->partial_update_info->is_partial_update() &&
         rowset_writer->num_rows() > 0) {
+        
DBUG_EXECUTE_IF("CloudTablet::save_delete_bitmap.update_tmp_rowset.error", {
+            return Status::InternalError<false>("injected update_tmp_rowset 
error.");
+        });
         const auto& rowset_meta = rowset->rowset_meta();
         RETURN_IF_ERROR(_engine.meta_mgr().update_tmp_rowset(*rowset_meta));
     }
diff --git 
a/regression-test/data/fault_injection_p0/cloud/test_cloud_partial_update_update_tmp_rowset_fail.out
 
b/regression-test/data/fault_injection_p0/cloud/test_cloud_partial_update_update_tmp_rowset_fail.out
new file mode 100644
index 00000000000..c01f2d185c8
--- /dev/null
+++ 
b/regression-test/data/fault_injection_p0/cloud/test_cloud_partial_update_update_tmp_rowset_fail.out
@@ -0,0 +1,11 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !sql --
+1      1       1       1
+2      2       2       2
+3      3       3       2
+
+-- !sql --
+1      999     1       1
+2      666     2       2
+3      3       3       2
+
diff --git 
a/regression-test/suites/fault_injection_p0/cloud/test_cloud_partial_update_update_tmp_rowset_fail.groovy
 
b/regression-test/suites/fault_injection_p0/cloud/test_cloud_partial_update_update_tmp_rowset_fail.groovy
new file mode 100644
index 00000000000..45c2c9b4a82
--- /dev/null
+++ 
b/regression-test/suites/fault_injection_p0/cloud/test_cloud_partial_update_update_tmp_rowset_fail.groovy
@@ -0,0 +1,93 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_cloud_partial_update_update_tmp_rowset_fail", "nonConcurrent") {
+    if (!isCloudMode()) {
+        return
+    }
+
+    GetDebugPoint().clearDebugPointsForAllFEs()
+    GetDebugPoint().clearDebugPointsForAllBEs()
+
+
+    def table1 = "test_partial_update_update_tmp_rowset_fail"
+    sql "DROP TABLE IF EXISTS ${table1} FORCE;"
+    sql """ CREATE TABLE IF NOT EXISTS ${table1} (
+            `k1` int NOT NULL,
+            `c1` int,
+            `c2` int,
+            `c3` int
+            )UNIQUE KEY(k1)
+        DISTRIBUTED BY HASH(k1) BUCKETS 1
+        PROPERTIES (
+            "enable_unique_key_merge_on_write" = "true",
+            "disable_auto_compaction" = "true",
+            "replication_num" = "1"); """
+
+    sql "insert into ${table1} values(1,1,1,1);"
+    sql "insert into ${table1} values(2,2,2,2);"
+    sql "insert into ${table1} values(3,3,3,2);"
+    sql "sync;"
+    qt_sql "select * from ${table1} order by k1;"
+
+    try {
+        // let two partial update load have conflicts
+        
GetDebugPoint().enableDebugPointForAllFEs("CloudGlobalTransactionMgr.getDeleteBitmapUpdateLock.enable_spin_wait")
+        
GetDebugPoint().enableDebugPointForAllFEs("CloudGlobalTransactionMgr.getDeleteBitmapUpdateLock.block")
+
+        // this will case the older partial update fail in publish phase after 
it write a new segment due to conflict
+        // and before it updates the num_segments field of tmp rowset's meta 
+        
GetDebugPoint().enableDebugPointForAllBEs("CloudTablet::save_delete_bitmap.update_tmp_rowset.error")
+
+        def t1 = Thread.start {
+            try {
+                sql "set enable_unique_key_partial_update=true;"
+                sql "sync;"
+                sql "insert into ${table1}(k1,c1) values(1,999),(2,666);"
+            } catch(Exception e) {
+                logger.info(e.getMessage())
+            }
+        }
+        Thread.sleep(800)
+
+        def t2 = Thread.start {
+            try {
+                sql "set enable_unique_key_partial_update=true;"
+                sql "sync;"
+                sql "insert into ${table1}(k1,c2) values(1,888),(2,777);"
+            } catch(Exception e) {
+                logger.info(e.getMessage())
+            }
+        }
+        Thread.sleep(800)
+
+
+        
GetDebugPoint().disableDebugPointForAllFEs("CloudGlobalTransactionMgr.getDeleteBitmapUpdateLock.enable_spin_wait")
+        
GetDebugPoint().disableDebugPointForAllFEs("CloudGlobalTransactionMgr.getDeleteBitmapUpdateLock.block")
+
+
+        t1.join()
+        t2.join()
+
+        qt_sql "select * from ${table1} order by k1;"        
+    } catch(Exception e) {
+        logger.info(e.getMessage())
+        throw e
+    } finally {
+        GetDebugPoint().clearDebugPointsForAllBEs()
+    }
+}


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

Reply via email to