This is an automated email from the ASF dual-hosted git repository. gavinchou 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 7a987d3689e [Fix](recycler) Delete again to double check when recycle tablet failed by some bugs (#47475) 7a987d3689e is described below commit 7a987d3689e299590d8846ffe9693568a112e43b Author: abmdocrt <lianyuk...@selectdb.com> AuthorDate: Tue Jan 28 10:11:53 2025 +0800 [Fix](recycler) Delete again to double check when recycle tablet failed by some bugs (#47475) ### Background: 1. In PR #46798, we modified the way to recycle tablets because if there is a vault that fails to initialize, the original way of recycling tablets would directly return -1 when encountering a failed vault due to not finding an accessor, resulting in an inability to recycle normally. PR #46798 changed this to traverse rowsets and obtain accessors based on resource IDs. Compared to the previous method of directly returning -1 and not recycling anything, this approach can recycle as man [...] 2. The aforementioned PR modified the way of recycling tablets. Due to historical reasons, [0-1] rowsetPB does not have a resource ID. Since we assumed that all rowsetPBs have a resource ID, once there is no resource ID, it would return -1, causing the recycling to fail. This [0-1] recycling failure issue was fixed in PR #47324. 3. The problem addressed by the current PR occurred in the recycler pipeline. The specific phenomenon was that a schema change failed and was aborted, and then the recycler executed the recycling, only to find that the meta was deleted but the rowset object was not. 4. This is because before this PR, if recycle tmp rowset found that the schema of a tablet was missing, it would directly skip recycling the object and only recycle the meta. This method was fine before PR #46798 because recycle tablet would directly delete the tablet folder on the object, and by the time it got to recycle tmp rowset, only recycling the meta was enough. However, after PR #46798, if a tablet only has [0-1] rowsets, and an import fails, then [2-2] will become a tmp rows [...] 5. This ultimately led to the deletion of the meta but not the rowset object. ### Solution: This PR modifies the logic of recycle tmp rowset. Regardless of whether the schema meta of the tablet of this rowset exists, it is necessary to recycle the object file of this rowset, which can ensure that all objects can be recycled. In addition, resource IDs will be added to [0-1] during table creation in the future to ensure that recycle tablet can also delete normally. Once [0-1] has a resource ID, both recycle tablet and recycle tmp rowset will delete the object data, providing t [...] --- 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