From f1b85d86f88fa3c0fe1e8cdd880dca5c1a69aaf3 Mon Sep 17 00:00:00 2001 From: Yukang-Lian Date: Mon, 27 Jan 2025 22:34:58 +0800 Subject: [PATCH 1/3] 1 --- cloud/src/recycler/recycler.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/cloud/src/recycler/recycler.cpp b/cloud/src/recycler/recycler.cpp index 763c3e8065105a..ca7dd8a1a277bc 100644 --- a/cloud/src/recycler/recycler.cpp +++ b/cloud/src/recycler/recycler.cpp @@ -1521,25 +1521,28 @@ int InstanceRecycler::delete_rowset_data(const std::vectorget(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 = std::move(index_info.second); + } else if (get_ret == 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 + 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()); + for (int64_t i = 0; i < num_segments; ++i) { + file_paths.push_back(segment_path(tablet_id, rowset_id, i)); } + } 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 From 51605aa7b7a51c33bee6dacf298c1ba65ac7e95f Mon Sep 17 00:00:00 2001 From: Yukang-Lian Date: Mon, 27 Jan 2025 23:02:27 +0800 Subject: [PATCH 2/3] 2 --- cloud/src/recycler/recycler.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cloud/src/recycler/recycler.cpp b/cloud/src/recycler/recycler.cpp index ca7dd8a1a277bc..85f6de82dfe397 100644 --- a/cloud/src/recycler/recycler.cpp +++ b/cloud/src/recycler/recycler.cpp @@ -1523,7 +1523,7 @@ int InstanceRecycler::delete_rowset_data(const std::vectorget(rs.index_id(), rs.schema_version(), index_info); if (get_ret == 0) { index_format = index_info.first; - index_ids = std::move(index_info.second); + index_ids = index_info.second; } else if (get_ret == 1) { // Schema kv not found means tablet has been recycled // Maybe some tablet recycle failed by some bugs @@ -1534,9 +1534,11 @@ int InstanceRecycler::delete_rowset_data(const std::vector