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 a622ae20652 [enhancement](compaction) Abort merging rowsets when the 
tablet is no more active (#40478)
a622ae20652 is described below

commit a622ae206524912a403b692908833756bf5f6e62
Author: Siyang Tang <82279870+tangsiyang2...@users.noreply.github.com>
AuthorDate: Wed Sep 11 21:13:37 2024 +0800

    [enhancement](compaction) Abort merging rowsets when the tablet is no more 
active (#40478)
    
    ## Proposed changes
    
    Merge rowsets is relatively long-term. Abort this stage if tablets are
    no more active (not ready is an active state for compaction).
---
 be/src/olap/merger.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/be/src/olap/merger.cpp b/be/src/olap/merger.cpp
index 02d77372b4b..cba828785d9 100644
--- a/be/src/olap/merger.cpp
+++ b/be/src/olap/merger.cpp
@@ -47,6 +47,7 @@
 #include "olap/storage_engine.h"
 #include "olap/tablet.h"
 #include "olap/tablet_fwd.h"
+#include "olap/tablet_meta.h"
 #include "olap/tablet_reader.h"
 #include "olap/utils.h"
 #include "util/slice.h"
@@ -136,7 +137,8 @@ Status Merger::vmerge_rowsets(BaseTabletSPtr tablet, 
ReaderType reader_type,
     size_t output_rows = 0;
     bool eof = false;
     while (!eof && !ExecEnv::GetInstance()->storage_engine().stopped()) {
-        if (tablet->tablet_state() == TABLET_SHUTDOWN) {
+        auto tablet_state = tablet->tablet_state();
+        if (tablet_state != TABLET_RUNNING && tablet_state != TABLET_NOTREADY) 
{
             tablet->clear_cache();
             return Status::Error<INTERNAL_ERROR>("tablet {} is not used any 
more",
                                                  tablet->tablet_id());
@@ -303,6 +305,12 @@ Status Merger::vertical_compact_one_group(
     size_t output_rows = 0;
     bool eof = false;
     while (!eof && !ExecEnv::GetInstance()->storage_engine().stopped()) {
+        auto tablet_state = tablet->tablet_state();
+        if (tablet_state != TABLET_RUNNING && tablet_state != TABLET_NOTREADY) 
{
+            tablet->clear_cache();
+            return Status::Error<INTERNAL_ERROR>("tablet {} is not used any 
more",
+                                                 tablet->tablet_id());
+        }
         // Read one block from block reader
         
RETURN_NOT_OK_STATUS_WITH_WARN(reader.next_block_with_aggregation(&block, &eof),
                                        "failed to read next block when merging 
rowsets of tablet " +


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

Reply via email to