Skip to content

Commit 1f6d752

Browse files
authored
[fix](storage-engine) _clean_unused_rowset_metas should skip rowsets in _unused_rowsets map (#59390)
### What problem does this PR solve? `_clean_unused_rowset_metas` could incorrectly remove rowset metas (and its delete_bitmap) that are still tracked in the `_unused_rowsets` map, which holds rowsets pending deletion. The fix adds a check to skip these rowsets during cleanup, preventing premature removal of `_unused_rowsets`. Otherwise, if query a mow table with rowsets in `_unused_rowsets` map, and `_clean_unused_rowset_metas` delete delete_bitmap of these rowset, will get duplicated keys. ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
1 parent e3e0590 commit 1f6d752

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

be/src/olap/storage_engine.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,8 @@ void StorageEngine::_clean_unused_rowset_metas() {
957957
return true;
958958
}
959959
if (rowset_meta->rowset_state() == RowsetStatePB::VISIBLE &&
960-
(!tablet->rowset_meta_is_useful(rowset_meta))) {
960+
(!tablet->rowset_meta_is_useful(rowset_meta)) &&
961+
!check_rowset_id_in_unused_rowsets(rowset_id)) {
961962
LOG(INFO) << "rowset meta is not used any more, remove it. rowset_id="
962963
<< rowset_meta->rowset_id();
963964
invalid_rowset_metas.push_back(rowset_meta);

be/src/olap/tablet.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,10 @@ void Tablet::delete_expired_stale_rowset() {
920920
if (config::enable_mow_verbose_log) {
921921
LOG_INFO("finish delete_expired_stale_rowset for tablet={}", tablet_id());
922922
}
923-
DBUG_EXECUTE_IF("Tablet.delete_expired_stale_rowset.start_delete_unused_rowset",
924-
{ _engine.start_delete_unused_rowset(); });
923+
DBUG_EXECUTE_IF("Tablet.delete_expired_stale_rowset.start_delete_unused_rowset", {
924+
_engine.start_delete_unused_rowset();
925+
[[maybe_unused]] auto st = _engine.start_trash_sweep(nullptr);
926+
});
925927
}
926928

927929
Status Tablet::check_version_integrity(const Version& version, bool quiet) {

0 commit comments

Comments
 (0)