diff --git a/src/event/store_state_machine_event.cc b/src/event/store_state_machine_event.cc index 1bec8edfc..e11786b1f 100644 --- a/src/event/store_state_machine_event.cc +++ b/src/event/store_state_machine_event.cc @@ -94,10 +94,10 @@ int SmLeaderStartEventListener::OnEvent(std::shared_ptr event) { } } - // Set apply max ts + // Set raw apply max ts auto ts_provider = Server::GetInstance().GetTsProvider(); if (ts_provider != nullptr) { - ts_provider->SetMinValidTs(region->AppliedMaxTs()); + ts_provider->SetMinValidTs(region->RawAppliedMaxTs()); } auto store_region_meta = GET_STORE_REGION_META; diff --git a/src/handler/raft_apply_handler.cc b/src/handler/raft_apply_handler.cc index 3754238ee..bc95ba043 100644 --- a/src/handler/raft_apply_handler.cc +++ b/src/handler/raft_apply_handler.cc @@ -289,7 +289,7 @@ bool HandlePreCreateRegionSplit(const pb::raft::SplitRequest &request, store::Re to_region->SetParentId(from_region->Id()); // Set apply max ts - to_region->SetAppliedMaxTs(from_region->AppliedMaxTs()); + to_region->SetRawAppliedMaxTs(from_region->RawAppliedMaxTs()); // Set txn apply max ts to_region->SetTxnAppliedMaxTs(from_region->TxnAppliedMaxTs()); @@ -530,7 +530,7 @@ bool HandlePostCreateRegionSplit(const pb::raft::SplitRequest &request, store::R child_region->SetParentId(parent_region->Id()); // Set apply max ts - child_region->SetAppliedMaxTs(parent_region->AppliedMaxTs()); + child_region->SetRawAppliedMaxTs(parent_region->RawAppliedMaxTs()); // Set txn apply max ts child_region->SetTxnAppliedMaxTs(parent_region->TxnAppliedMaxTs()); @@ -917,8 +917,8 @@ int CommitMergeHandler::Handle(std::shared_ptr, store::RegionPtr target } // Set apply max ts - int64_t max_ts = std::max(target_region->AppliedMaxTs(), source_region->AppliedMaxTs()); - target_region->SetAppliedMaxTs(max_ts); + int64_t raw_max_ts = std::max(target_region->RawAppliedMaxTs(), source_region->RawAppliedMaxTs()); + target_region->SetRawAppliedMaxTs(raw_max_ts); // Set apply max ts int64_t txn_max_ts = std::max(target_region->TxnAppliedMaxTs(), source_region->TxnAppliedMaxTs()); diff --git a/src/meta/store_meta_manager.h b/src/meta/store_meta_manager.h index 28090b821..6fcb564eb 100644 --- a/src/meta/store_meta_manager.h +++ b/src/meta/store_meta_manager.h @@ -169,12 +169,12 @@ class Region { statistics_.last_serving_time_s.store(Helper::Timestamp(), std::memory_order_relaxed); } - void SetAppliedMaxTs(int64_t ts) { - if (ts > applied_max_ts_.load(std::memory_order_acquire)) { - applied_max_ts_.store(ts, std::memory_order_release); + void SetRawAppliedMaxTs(int64_t ts) { + if (ts > raw_applied_max_ts_.load(std::memory_order_acquire)) { + raw_applied_max_ts_.store(ts, std::memory_order_release); } } - int64_t AppliedMaxTs() { return applied_max_ts_.load(std::memory_order_acquire); } + int64_t RawAppliedMaxTs() { return raw_applied_max_ts_.load(std::memory_order_acquire); } void SetTxnAppliedMaxTs(int64_t ts) { if (ts > txn_applied_max_ts_.load(std::memory_order_acquire)) { @@ -188,7 +188,7 @@ class Region { pb::store_internal::Region inner_region_; std::atomic state_; - std::atomic applied_max_ts_{0}; + std::atomic raw_applied_max_ts_{0}; std::atomic txn_applied_max_ts_{0}; diff --git a/src/raft/store_state_machine.cc b/src/raft/store_state_machine.cc index 7c0268f12..efc329462 100644 --- a/src/raft/store_state_machine.cc +++ b/src/raft/store_state_machine.cc @@ -128,7 +128,7 @@ void StoreStateMachine::on_apply(braft::Iterator& iter) { // update apply max ts for (const auto& request : raft_cmd->requests()) { if (BAIDU_LIKELY(request.ts() > 0)) { - region_->SetAppliedMaxTs(request.ts()); + region_->SetRawAppliedMaxTs(request.ts()); } }