Skip to content

Commit

Permalink
[fix](tablet) protect max_version by meta lock
Browse files Browse the repository at this point in the history
refer to 21948
  • Loading branch information
dataroaring committed Aug 30, 2023
1 parent 3e33f09 commit c4d06d8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion be/src/olap/snapshot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ Status SnapshotManager::_create_snapshot_files(const TabletSharedPtr& ref_tablet
}
*allow_incremental_clone = false;
} else {
version = ref_tablet->max_version().second;
version = ref_tablet->max_version_unlocked().second;
*allow_incremental_clone = true;
}

Expand Down
1 change: 1 addition & 0 deletions be/src/olap/tablet.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ inline int Tablet::version_count() const {
}

inline Version Tablet::max_version() const {
std::shared_lock rdlock(_meta_lock);
return _tablet_meta->max_version();
}

Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/task/engine_publish_version_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Status EnginePublishVersionTask::finish() {
TabletState tablet_state;
{
std::shared_lock rdlock(tablet->get_header_lock());
max_version = tablet->max_version();
max_version = tablet->max_version_unlocked();
tablet_state = tablet->tablet_state();
}
if (tablet_state == TabletState::TABLET_RUNNING &&
Expand Down

0 comments on commit c4d06d8

Please sign in to comment.