Skip to content

Commit

Permalink
[fix][store] Rename applied_max_ts to raw_applied_max_ts
Browse files Browse the repository at this point in the history
  • Loading branch information
visualYJD authored and ketor committed Sep 12, 2024
1 parent dcd0cfe commit 533a943
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/event/store_state_machine_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ int SmLeaderStartEventListener::OnEvent(std::shared_ptr<Event> 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;
Expand Down
8 changes: 4 additions & 4 deletions src/handler/raft_apply_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -917,8 +917,8 @@ int CommitMergeHandler::Handle(std::shared_ptr<Context>, 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());
Expand Down
10 changes: 5 additions & 5 deletions src/meta/store_meta_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -188,7 +188,7 @@ class Region {
pb::store_internal::Region inner_region_;
std::atomic<pb::common::StoreRegionState> state_;

std::atomic<int64_t> applied_max_ts_{0};
std::atomic<int64_t> raw_applied_max_ts_{0};

std::atomic<int64_t> txn_applied_max_ts_{0};

Expand Down
2 changes: 1 addition & 1 deletion src/raft/store_state_machine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down

0 comments on commit 533a943

Please sign in to comment.