Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions be/src/olap/rowset/rowset_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,19 @@ class RowsetMeta {
return has_version() && _rowset_meta_pb.start_version() == _rowset_meta_pb.end_version();
}

// Some time, we may check if this rowset is in rowset meta manager's meta by using RowsetMetaManager::check_rowset_meta.
// But, this check behavior may cost a lot of time when it is frequent.
// If we explicitly remove this rowset from rowset meta manager's meta, we can set _is_removed_from_rowset_meta to true,
// And next time when we want to check if this rowset is in rowset mata manager's meta, we can
// check is_remove_from_rowset_meta() first.
void set_remove_from_rowset_meta() {
_is_removed_from_rowset_meta = true;
}

bool is_remove_from_rowset_meta() const {
return _is_removed_from_rowset_meta;
}

private:
friend class AlphaRowsetMeta;
bool _deserialize_from_pb(const std::string& value) {
Expand Down Expand Up @@ -332,6 +345,7 @@ class RowsetMeta {
private:
RowsetMetaPB _rowset_meta_pb;
RowsetId _rowset_id;
bool _is_removed_from_rowset_meta = false;
};

} // namespace doris
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ void* StorageEngine::_tablet_checkpoint_callback(void* arg) {
#endif
LOG(INFO) << "try to start tablet meta checkpoint thread!";
while (true) {
LOG(INFO) << "begin to do tablet meta checkpoint";
LOG(INFO) << "begin to do tablet meta checkpoint:" << ((DataDir*)arg)->path();
int64_t start_time = UnixMillis();
_tablet_manager->do_tablet_meta_checkpoint((DataDir*)arg);
int64_t used_time = (UnixMillis() - start_time) / 1000;
Expand Down
7 changes: 6 additions & 1 deletion be/src/olap/tablet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,12 +1065,17 @@ OLAPStatus Tablet::do_tablet_meta_checkpoint() {
RETURN_NOT_OK(save_meta());
// if save meta successfully, then should remove the rowset meta existing in tablet
// meta from rowset meta store
for (auto& rs_meta : _tablet_meta->all_rs_metas()) {
for (auto& rs_meta : _tablet_meta->all_rs_metas()) {
// If we delete it from rowset manager's meta explicitly in previous checkpoint, just skip.
if(rs_meta->is_remove_from_rowset_meta()) {
continue;
}
if (RowsetMetaManager::check_rowset_meta(_data_dir->get_meta(), tablet_uid(), rs_meta->rowset_id())) {
RowsetMetaManager::remove(_data_dir->get_meta(), tablet_uid(), rs_meta->rowset_id());
LOG(INFO) << "remove rowset id from meta store because it is already persistent with tablet meta"
<< ", rowset_id=" << rs_meta->rowset_id();
}
rs_meta->set_remove_from_rowset_meta();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this line of code should be executed in above if clause.

}
_newly_created_rowset_num = 0;
_last_checkpoint_time = UnixMillis();
Expand Down