Skip to content

Commit

Permalink
[Bug](cooldown) Fix problem that followers may never completely coold…
Browse files Browse the repository at this point in the history
…own (apache#28561)
  • Loading branch information
platoneko authored Dec 19, 2023
1 parent 9507305 commit c41562a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions be/src/olap/tablet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2122,16 +2122,7 @@ Status Tablet::_cooldown_data() {
LOG(INFO) << "cannot pick cooldown rowset in tablet " << tablet_id();
return Status::OK();
}
if (old_rowset->num_segments() < 1) {
// Empty rowset, just reset rowset's resource_id
std::lock_guard meta_wlock(_meta_lock);
SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
old_rowset->rowset_meta()->set_fs(dest_fs);
LOG(INFO) << "cooldown empty rowset " << old_rowset->version() << " "
<< old_rowset->rowset_id().to_string() << " to " << dest_fs->root_path().native()
<< ", tablet_id=" << tablet_id();
return Status::OK();
}

RowsetId new_rowset_id = StorageEngine::instance()->next_rowset_id();
auto pending_rs_guard = StorageEngine::instance()->pending_remote_rowsets().add(new_rowset_id);
Status st;
Expand Down Expand Up @@ -2178,7 +2169,9 @@ Status Tablet::_cooldown_data() {
SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
save_meta();
}
// upload cooldowned rowset meta to remote fs
// Upload cooldowned rowset meta to remote fs
// ATTN: Even if it is an empty rowset, in order for the followers to synchronize, the coolown meta must be
// uploaded, otherwise followers may never completely cooldown.
if (auto t = StorageEngine::instance()->tablet_manager()->get_tablet(tablet_id());
t != nullptr) { // `t` can be nullptr if it has been dropped
async_write_cooldown_meta(std::move(t));
Expand Down

0 comments on commit c41562a

Please sign in to comment.