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
18 changes: 12 additions & 6 deletions cloud/src/recycler/recycler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3365,6 +3365,18 @@ int InstanceRecycler::delete_rowset_data(
}
}

int64_t num_segments = rs.num_segments();
// Check num_segments before accessor lookup, because empty rowsets
// (e.g. base compaction output of empty rowsets) may have no resource_id
// set. Skipping them early avoids a spurious "no such resource id" error
// that marks the entire batch as failed and prevents txn_remove from
// cleaning up recycle KV keys.
if (num_segments <= 0) {
metrics_context.total_recycled_num++;
metrics_context.total_recycled_data_size += rs.total_disk_size();
continue;
}
Comment thread
liaoxin01 marked this conversation as resolved.

auto it = accessor_map_.find(rs.resource_id());
// possible if the accessor is not initilized correctly
Comment thread
liaoxin01 marked this conversation as resolved.
if (it == accessor_map_.end()) [[unlikely]] {
Expand All @@ -3387,12 +3399,6 @@ int InstanceRecycler::delete_rowset_data(
ret = -1;
continue;
}
int64_t num_segments = rs.num_segments();
if (num_segments <= 0) {
metrics_context.total_recycled_num++;
metrics_context.total_recycled_data_size += rs.total_disk_size();
continue;
}

// Process delete bitmap
file_paths.push_back(delete_bitmap_path(tablet_id, rowset_id));
Expand Down
Loading