Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[authority] Remove unused cached checkpoint number #4690

Merged
merged 1 commit into from
Sep 19, 2022
Merged
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
10 changes: 1 addition & 9 deletions crates/sui-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use std::{
collections::{HashMap, VecDeque},
pin::Pin,
sync::{
atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering},
atomic::{AtomicBool, AtomicUsize, Ordering},
Arc,
},
};
Expand Down Expand Up @@ -410,9 +410,6 @@ pub struct AuthorityState {

pub metrics: Arc<AuthorityMetrics>,

// Cache the latest checkpoint number to avoid expensive locking to access checkpoint store
latest_checkpoint_num: AtomicU64,

/// A channel to tell consensus to reconfigure.
tx_reconfigure_consensus: Sender<ReconfigConsensusMessage>,
}
Expand Down Expand Up @@ -1251,7 +1248,6 @@ impl AuthorityState {
),
consensus_guardrail: AtomicUsize::new(0),
metrics: Arc::new(AuthorityMetrics::new(prometheus_registry)),
latest_checkpoint_num: AtomicU64::new(0),
tx_reconfigure_consensus,
};

Expand Down Expand Up @@ -2010,10 +2006,6 @@ impl ExecutionState for AuthorityState {
// to persist the consensus index. If the validator crashes, this transaction
// may be resent to the checkpoint logic that will simply ignore it.

// Cache the next checkpoint number if it changes.
self.latest_checkpoint_num
.store(checkpoint.next_checkpoint(), Ordering::Relaxed);

// TODO: At this point we should know whether we want to change epoch. If we do,
// we should have (i) the new committee and (ii) the new keypair of this authority.
// We then call:
Expand Down