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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new baac2416eee branch-3.0: [Fix](recycler) Fix recycler fail when dealing 
with rowset [0-1] #47324 (#47335)
baac2416eee is described below

commit baac2416eeeedbe7f75856af114ec6b2ed68055d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jan 23 13:17:47 2025 +0800

    branch-3.0: [Fix](recycler) Fix recycler fail when dealing with rowset 
[0-1] #47324 (#47335)
    
    Cherry-picked from #47324
    
    Co-authored-by: abmdocrt <lianyuk...@selectdb.com>
---
 cloud/src/recycler/recycler.cpp | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/cloud/src/recycler/recycler.cpp b/cloud/src/recycler/recycler.cpp
index 62a161e3edb..763c3e80651 100644
--- a/cloud/src/recycler/recycler.cpp
+++ b/cloud/src/recycler/recycler.cpp
@@ -1680,6 +1680,30 @@ int InstanceRecycler::recycle_tablet(int64_t tablet_id) {
     
TEST_SYNC_POINT_CALLBACK("InstanceRecycler::recycle_tablet.create_rowset_meta", 
&resp);
 
     for (const auto& rs_meta : resp.rowset_meta()) {
+        /*
+        * For compatibility, we skip the loop for [0-1] here. 
+        * The purpose of this loop is to delete object files,
+        * and since [0-1] only has meta and doesn't have object files, 
+        * skipping it doesn't affect system correctness. 
+        *
+        * If not skipped, the check "if (!rs_meta.has_resource_id())" below 
+        * would return error -1 directly, causing the recycle operation to 
fail.
+        *
+        * [0-1] doesn't have resource id is a bug.
+        * In the future, we will fix this problem, after that,
+        * we can remove this if statement.
+        *
+        * TODO(Yukang-Lian): remove this if statement when [0-1] has resource 
id in the future.
+        */
+
+        if (rs_meta.end_version() == 1) {
+            // Assert that [0-1] has no resource_id to make sure
+            // this if statement will not be forgetted to remove
+            // when the resource id bug is fixed
+            DCHECK(!rs_meta.has_resource_id()) << "rs_meta" << 
rs_meta.ShortDebugString();
+            recycle_rowsets_number += 1;
+            continue;
+        }
         if (!rs_meta.has_resource_id()) {
             LOG_WARNING("rowset meta does not have a resource id, impossible!")
                     .tag("rs_meta", rs_meta.ShortDebugString())
@@ -1687,6 +1711,7 @@ int InstanceRecycler::recycle_tablet(int64_t tablet_id) {
                     .tag("tablet_id", tablet_id);
             return -1;
         }
+        DCHECK(rs_meta.has_resource_id()) << "rs_meta" << 
rs_meta.ShortDebugString();
         auto it = accessor_map_.find(rs_meta.resource_id());
         // possible if the accessor is not initilized correctly
         if (it == accessor_map_.end()) [[unlikely]] {


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

Reply via email to