SnapshotPackagerService pushes incremental snapshot hashes to CRDS (#20442)
Now that CRDS supports incremental snapshot hashes, SnapshotPackagerService needs to push 'em! This commit does two main things: 1. SnapshotPackagerService now knows about incremental snapshot hashes, and will push SnapshotPackage::IncrementalSnapshot hashes to CRDS. 2. At startup, when loading from a full + incremental snapshot, the hashes need to be passed all the way to SnapshotPackagerService so it can push these starting hashes to CRDS. Those values have been piped through. Fixes #20441 and #20423
This commit is contained in:
@ -42,6 +42,7 @@ pub mod serde_snapshot;
|
||||
mod shared_buffer_reader;
|
||||
pub mod snapshot_archive_info;
|
||||
pub mod snapshot_config;
|
||||
pub mod snapshot_hash;
|
||||
pub mod snapshot_package;
|
||||
pub mod snapshot_utils;
|
||||
pub mod sorted_storages;
|
||||
|
44
runtime/src/snapshot_hash.rs
Normal file
44
runtime/src/snapshot_hash.rs
Normal file
@ -0,0 +1,44 @@
|
||||
//! Helper types and functions for handling and dealing with snapshot hashes.
|
||||
use solana_sdk::{clock::Slot, hash::Hash};
|
||||
|
||||
/// At startup, when loading from snapshots, the starting snapshot hashes need to be passed to
|
||||
/// SnapshotPackagerService, which is in charge of pushing the hashes to CRDS. This struct wraps
|
||||
/// up those values make it easier to pass from bank_forks_utils, through validator, to
|
||||
/// SnapshotPackagerService.
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct StartingSnapshotHashes {
|
||||
pub full: FullSnapshotHash,
|
||||
pub incremental: Option<IncrementalSnapshotHash>,
|
||||
}
|
||||
|
||||
/// Used by SnapshotPackagerService and SnapshotGossipManager, this struct adds type safety to
|
||||
/// ensure a full snapshot hash is pushed to the right CRDS.
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct FullSnapshotHash {
|
||||
pub hash: (Slot, Hash),
|
||||
}
|
||||
|
||||
/// Used by SnapshotPackagerService and SnapshotGossipManager, this struct adds type safety to
|
||||
/// ensure an incremental snapshot hash is pushed to the right CRDS. `base` is the (full) snapshot
|
||||
/// this incremental snapshot (`hash`) is based on.
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct IncrementalSnapshotHash {
|
||||
pub base: (Slot, Hash),
|
||||
pub hash: (Slot, Hash),
|
||||
}
|
||||
|
||||
/// FullSnapshotHashes is used by SnapshotPackagerService to collect the snapshot hashes from full
|
||||
/// snapshots and then push those hashes to CRDS.
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||
pub struct FullSnapshotHashes {
|
||||
pub hashes: Vec<(Slot, Hash)>,
|
||||
}
|
||||
|
||||
/// IncrementalSnapshotHashes is used by SnapshotPackagerService to collect the snapshot hashes
|
||||
/// from incremental snapshots and then push those hashes to CRDS. `base` is the (full) snapshot
|
||||
/// all the incremental snapshots (`hashes`) are based on.
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||
pub struct IncrementalSnapshotHashes {
|
||||
pub base: (Slot, Hash),
|
||||
pub hashes: Vec<(Slot, Hash)>,
|
||||
}
|
Reference in New Issue
Block a user