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

gavinchou 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 7446007285e branch-3.0: [Fix](recycler) Delete again to double check 
when recycle tablet failed by some bugs #47475 (#47477)
7446007285e is described below

commit 7446007285e0e4be5ef6b4915fa416ba596f0d82
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Jan 28 23:00:04 2025 +0800

    branch-3.0: [Fix](recycler) Delete again to double check when recycle 
tablet failed by some bugs #47475 (#47477)
    
    Cherry-picked from #47475
    
    Co-authored-by: abmdocrt <lianyuk...@selectdb.com>
---
 cloud/src/recycler/recycler.cpp | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/cloud/src/recycler/recycler.cpp b/cloud/src/recycler/recycler.cpp
index 763c3e80651..c7c9d8e0a02 100644
--- a/cloud/src/recycler/recycler.cpp
+++ b/cloud/src/recycler/recycler.cpp
@@ -1521,25 +1521,33 @@ int InstanceRecycler::delete_rowset_data(const 
std::vector<doris::RowsetMetaClou
             InvertedIndexInfo index_info;
             int get_ret =
                     inverted_index_id_cache_->get(rs.index_id(), 
rs.schema_version(), index_info);
-            if (get_ret != 0) {
-                if (get_ret == 1) { // Schema kv not found
-                    // Check tablet existence
-                    std::string tablet_idx_key, tablet_idx_val;
-                    meta_tablet_idx_key({instance_id_, tablet_id}, 
&tablet_idx_key);
-                    if (txn_get(txn_kv_.get(), tablet_idx_key, tablet_idx_val) 
== 1) {
-                        // Tablet has been recycled, rowset data has already 
been deleted
-                        std::lock_guard lock(recycled_tablets_mtx_);
-                        recycled_tablets_.insert(tablet_id);
-                        continue;
-                    }
-                }
+            if (get_ret == 0) {
+                index_format = index_info.first;
+                index_ids = index_info.second;
+            } else if (get_ret == 1) {
+                // 1. Schema kv not found means tablet has been recycled
+                // Maybe some tablet recycle failed by some bugs
+                // We need to delete again to double check
+                // 2. Ensure this operation only deletes tablets and does not 
perform any operations on indexes,
+                // because we are uncertain about the inverted index 
information.
+                // If there are inverted indexes, some data might not be 
deleted,
+                // but this is acceptable as we have made our best effort to 
delete the data.
+                LOG_INFO(
+                        "delete rowset data schema kv not found, need to 
delete again to double "
+                        "check")
+                        .tag("instance_id", instance_id_)
+                        .tag("tablet_id", tablet_id)
+                        .tag("rowset", rs.ShortDebugString());
+                // Currently index_ids is guaranteed to be empty,
+                // but we clear it again here as a safeguard against future 
code changes
+                // that might cause index_ids to no longer be empty
+                index_ids.clear();
+            } else {
                 LOG(WARNING) << "failed to get schema kv for rowset, 
instance_id=" << instance_id_
                              << " tablet_id=" << tablet_id << " rowset_id=" << 
rowset_id;
                 ret = -1;
                 continue;
             }
-            index_format = index_info.first;
-            index_ids = std::move(index_info.second);
         }
         if (rs.rowset_state() == RowsetStatePB::BEGIN_PARTIAL_UPDATE) {
             // if rowset state is RowsetStatePB::BEGIN_PARTIAL_UPDATE, the 
number of segments data


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

Reply via email to