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

chore(node): do not reset farthest_acceptance_distance #1627

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions sn_networking/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,12 @@ impl SwarmDriver {

match result {
Ok(_) => {
// We've stored the record fine, which means our replication
// fetcher should not be limited
self.replication_fetcher.clear_farthest_on_full();
// `replication_fetcher.farthest_acceptable_distance` shall only get
// shrinked, instead of expanding, even with more nodes joined to share
// the responsibility. Hence no need to reset it.
// Also, as `record_store` is `prune 1 on 1 success put`, which means
// once capacity reached max_records, there is only chance of rising slowly.
// Due to the async/parrellel handling in replication_fetcher & record_store.
}
Err(StoreError::MaxRecords) => {
// In case the capacity reaches full, restrict replication_fetcher to
Expand Down
7 changes: 0 additions & 7 deletions sn_networking/src/replication_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ impl ReplicationFetcher {
keys_to_fetch
}

// Node is storing and or pruning data fine, any fetch (ongoing or new) shall no longer be restricted
// by the fetcher itself (data is checked for being "close" at a higher level before keys are fed in
// to the ReplicationFetcher)
pub(crate) fn clear_farthest_on_full(&mut self) {
self.farthest_acceptable_distance = None;
}

// Node is full, any fetch (ongoing or new) shall no farther than the current farthest.
pub(crate) fn set_farthest_on_full(&mut self, farthest_in: Option<RecordKey>) {
let self_addr = NetworkAddress::from_peer(self.self_peer_id);
Expand Down
Loading