[BugFix] Add lock when get max version from tablet in replication txn manager (backport #62238) (#62277)

Signed-off-by: xiangguangyxg <xiangguangyxg@gmail.com>
Co-authored-by: xiangguangyxg <110401425+xiangguangyxg@users.noreply.github.com>
This commit is contained in:
mergify[bot] 2025-08-25 09:09:35 +00:00 committed by GitHub
parent e3faf9c570
commit cc4228fb6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -673,8 +673,11 @@ Status ReplicationTxnManager::convert_snapshot_for_primary(const std::string& ta
Status ReplicationTxnManager::publish_snapshot(Tablet* tablet, const string& snapshot_dir, int64_t snapshot_version,
bool incremental_snapshot) {
if (tablet->max_version().second >= snapshot_version) {
return Status::OK();
{
std::shared_lock lock(tablet->get_header_lock());
if (tablet->max_version().second >= snapshot_version) {
return Status::OK();
}
}
if (tablet->updates() != nullptr) {