Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions cloud/src/recycler/recycler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1680,13 +1680,38 @@ 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())
.tag("instance_id", instance_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]] {
Expand Down
Loading