You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2024/01/11 03:34:35 UTC

(doris) branch master updated: [case](wal)Add wal backpressure case (#29725)

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 8c307143447 [case](wal)Add wal backpressure case (#29725)
8c307143447 is described below

commit 8c307143447c5087f02f56428de5a1f6c3b919b1
Author: abmdocrt <Yu...@gmail.com>
AuthorDate: Thu Jan 11 11:34:28 2024 +0800

    [case](wal)Add wal backpressure case (#29725)
---
 be/src/runtime/group_commit_mgr.cpp                |  3 ++-
 be/src/vec/sink/writer/vwal_writer.cpp             |  4 +++
 ...st_wal_mem_back_pressure_fault_injection.groovy | 31 ++++++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/be/src/runtime/group_commit_mgr.cpp b/be/src/runtime/group_commit_mgr.cpp
index c7333e21d64..70baa765d9e 100644
--- a/be/src/runtime/group_commit_mgr.cpp
+++ b/be/src/runtime/group_commit_mgr.cpp
@@ -23,6 +23,7 @@
 #include <chrono>
 
 #include "client_cache.h"
+#include "common/compiler_util.h"
 #include "common/config.h"
 #include "runtime/exec_env.h"
 #include "runtime/fragment_mgr.h"
@@ -53,7 +54,7 @@ Status LoadBlockQueue::add_block(RuntimeState* runtime_state,
                     txn_id, label, load_instance_id.to_string());
         }
     }
-    if (runtime_state->is_cancelled()) {
+    if (UNLIKELY(runtime_state->is_cancelled())) {
         return Status::Cancelled(runtime_state->cancel_reason());
     }
     RETURN_IF_ERROR(status);
diff --git a/be/src/vec/sink/writer/vwal_writer.cpp b/be/src/vec/sink/writer/vwal_writer.cpp
index d429b8bbd9f..569f9bcd652 100644
--- a/be/src/vec/sink/writer/vwal_writer.cpp
+++ b/be/src/vec/sink/writer/vwal_writer.cpp
@@ -21,6 +21,8 @@
 
 #include <sstream>
 
+#include "util/debug_points.h"
+
 namespace doris {
 namespace vectorized {
 
@@ -63,6 +65,8 @@ Status VWalWriter::init() {
 }
 
 Status VWalWriter::write_wal(vectorized::Block* block) {
+    DBUG_EXECUTE_IF("VWalWriter.write_wal.fail",
+                    { return Status::InternalError("Failed to write wal!"); });
     PBlock pblock;
     size_t uncompressed_bytes = 0, compressed_bytes = 0;
     RETURN_IF_ERROR(block->serialize(_be_exe_version, &pblock, &uncompressed_bytes,
diff --git a/regression-test/suites/fault_injection_p0/test_wal_mem_back_pressure_fault_injection.groovy b/regression-test/suites/fault_injection_p0/test_wal_mem_back_pressure_fault_injection.groovy
index ea778259133..e87ddf11e05 100644
--- a/regression-test/suites/fault_injection_p0/test_wal_mem_back_pressure_fault_injection.groovy
+++ b/regression-test/suites/fault_injection_p0/test_wal_mem_back_pressure_fault_injection.groovy
@@ -123,4 +123,35 @@ suite("test_wal_mem_back_pressure_fault_injection","nonConcurrent") {
 
     thread1.join()
 
+    // new test
+ 
+    sql """ DROP TABLE IF EXISTS ${tableName} """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tableName} (
+            `k` int ,
+            `v` int ,
+        ) engine=olap
+        DISTRIBUTED BY HASH(`k`) 
+        BUCKETS 5 
+        properties("replication_num" = "1")
+        """
+
+    GetDebugPoint().clearDebugPointsForAllBEs()
+
+    def exception = false;
+    sql """ set group_commit = async_mode; """
+        try {
+            GetDebugPoint().enableDebugPointForAllBEs("VWalWriter.write_wal.fail")
+            sql """insert into ${tableName} values(1,1)"""
+            assertFalse(true);
+        } catch (Exception e) {
+            logger.info(e.getMessage())
+            assertTrue(e.getMessage().contains('Failed to write wal!'))
+            exception = true;
+        } finally {
+            GetDebugPoint().disableDebugPointForAllBEs("VWalWriter.write_wal.fail")
+            assertTrue(exception)
+        }
+
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org