Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit c588f25

Browse files
authored
Stops pushing legacy snapshot hashes to crds (#33576)
1 parent 95810d8 commit c588f25

File tree

2 files changed

+4
-50
lines changed

2 files changed

+4
-50
lines changed

core/src/snapshot_packager_service.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod snapshot_gossip_manager;
22
use {
33
crossbeam_channel::{Receiver, Sender},
44
snapshot_gossip_manager::SnapshotGossipManager,
5-
solana_gossip::cluster_info::{ClusterInfo, MAX_LEGACY_SNAPSHOT_HASHES},
5+
solana_gossip::cluster_info::ClusterInfo,
66
solana_measure::measure_us,
77
solana_perf::thread::renice_this_thread,
88
solana_runtime::{
@@ -39,25 +39,13 @@ impl SnapshotPackagerService {
3939
snapshot_config: SnapshotConfig,
4040
enable_gossip_push: bool,
4141
) -> Self {
42-
let max_full_snapshot_hashes = std::cmp::min(
43-
MAX_LEGACY_SNAPSHOT_HASHES,
44-
snapshot_config
45-
.maximum_full_snapshot_archives_to_retain
46-
.get(),
47-
);
48-
4942
let t_snapshot_packager = Builder::new()
5043
.name("solSnapshotPkgr".to_string())
5144
.spawn(move || {
5245
info!("SnapshotPackagerService has started");
5346
renice_this_thread(snapshot_config.packager_thread_niceness_adj).unwrap();
54-
let mut snapshot_gossip_manager = enable_gossip_push.then(|| {
55-
SnapshotGossipManager::new(
56-
cluster_info,
57-
max_full_snapshot_hashes,
58-
starting_snapshot_hashes,
59-
)
60-
});
47+
let mut snapshot_gossip_manager = enable_gossip_push
48+
.then(|| SnapshotGossipManager::new(cluster_info, starting_snapshot_hashes));
6149

6250
loop {
6351
if exit.load(Ordering::Relaxed) {

core/src/snapshot_packager_service/snapshot_gossip_manager.rs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use {
44
snapshot_hash::{
55
FullSnapshotHash, IncrementalSnapshotHash, SnapshotHash, StartingSnapshotHashes,
66
},
7-
snapshot_package::{retain_max_n_elements, SnapshotKind},
7+
snapshot_package::SnapshotKind,
88
},
99
solana_sdk::{clock::Slot, hash::Hash},
1010
std::sync::Arc,
@@ -14,8 +14,6 @@ use {
1414
pub struct SnapshotGossipManager {
1515
cluster_info: Arc<ClusterInfo>,
1616
latest_snapshot_hashes: Option<LatestSnapshotHashes>,
17-
max_legacy_full_snapshot_hashes: usize,
18-
legacy_full_snapshot_hashes: Vec<FullSnapshotHash>,
1917
}
2018

2119
impl SnapshotGossipManager {
@@ -24,14 +22,11 @@ impl SnapshotGossipManager {
2422
#[must_use]
2523
pub fn new(
2624
cluster_info: Arc<ClusterInfo>,
27-
max_legacy_full_snapshot_hashes: usize,
2825
starting_snapshot_hashes: Option<StartingSnapshotHashes>,
2926
) -> Self {
3027
let mut this = SnapshotGossipManager {
3128
cluster_info,
3229
latest_snapshot_hashes: None,
33-
max_legacy_full_snapshot_hashes,
34-
legacy_full_snapshot_hashes: Vec::default(),
3530
};
3631
if let Some(starting_snapshot_hashes) = starting_snapshot_hashes {
3732
this.push_starting_snapshot_hashes(starting_snapshot_hashes);
@@ -49,10 +44,6 @@ impl SnapshotGossipManager {
4944
);
5045
}
5146
self.push_latest_snapshot_hashes_to_cluster();
52-
53-
// Handle legacy snapshot hashes here too
54-
// Once LegacySnapshotHashes are removed from CRDS, also remove them here
55-
self.push_legacy_full_snapshot_hash(starting_snapshot_hashes.full);
5647
}
5748

5849
/// Push new snapshot hash to the cluster via CRDS
@@ -78,10 +69,6 @@ impl SnapshotGossipManager {
7869
fn push_full_snapshot_hash(&mut self, full_snapshot_hash: FullSnapshotHash) {
7970
self.update_latest_full_snapshot_hash(full_snapshot_hash);
8071
self.push_latest_snapshot_hashes_to_cluster();
81-
82-
// Handle legacy snapshot hashes here too
83-
// Once LegacySnapshotHashes are removed from CRDS, also remove them here
84-
self.push_legacy_full_snapshot_hash(full_snapshot_hash);
8572
}
8673

8774
/// Push new incremental snapshot hash to the cluster via CRDS
@@ -146,22 +133,6 @@ impl SnapshotGossipManager {
146133
and a new error case has been added that has not been handled here.",
147134
);
148135
}
149-
150-
/// Add `full_snapshot_hash` to the vector of full snapshot hashes, then push that vector to
151-
/// the cluster via CRDS.
152-
fn push_legacy_full_snapshot_hash(&mut self, full_snapshot_hash: FullSnapshotHash) {
153-
self.legacy_full_snapshot_hashes.push(full_snapshot_hash);
154-
155-
retain_max_n_elements(
156-
&mut self.legacy_full_snapshot_hashes,
157-
self.max_legacy_full_snapshot_hashes,
158-
);
159-
160-
self.cluster_info
161-
.push_legacy_snapshot_hashes(clone_hashes_for_crds(
162-
self.legacy_full_snapshot_hashes.as_slice(),
163-
));
164-
}
165136
}
166137

167138
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
@@ -191,8 +162,3 @@ impl AsSnapshotHash for IncrementalSnapshotHash {
191162
&self.0
192163
}
193164
}
194-
195-
/// Clones and maps snapshot hashes into what CRDS expects
196-
fn clone_hashes_for_crds(hashes: &[impl AsSnapshotHash]) -> Vec<(Slot, Hash)> {
197-
hashes.iter().map(AsSnapshotHash::clone_for_crds).collect()
198-
}

0 commit comments

Comments
 (0)