add_snapshot now returns SlotSnapshotPaths
This commit is contained in:
parent
9e19a635bb
commit
6b5172d002
|
@ -10,6 +10,7 @@ pub type SnapshotPackageSender = Sender<SnapshotPackage>;
|
||||||
pub type SnapshotPackageReceiver = Receiver<SnapshotPackage>;
|
pub type SnapshotPackageReceiver = Receiver<SnapshotPackage>;
|
||||||
pub type SnapshotPackageSendError = SendError<SnapshotPackage>;
|
pub type SnapshotPackageSendError = SendError<SnapshotPackage>;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct SnapshotPackage {
|
pub struct SnapshotPackage {
|
||||||
pub root: u64,
|
pub root: u64,
|
||||||
pub slot_deltas: Vec<SlotDelta<TransactionResult<()>>>,
|
pub slot_deltas: Vec<SlotDelta<TransactionResult<()>>>,
|
||||||
|
|
|
@ -204,19 +204,18 @@ where
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_snapshot<P: AsRef<Path>>(snapshot_path: P, bank: &Bank) -> Result<()> {
|
pub fn add_snapshot<P: AsRef<Path>>(snapshot_path: P, bank: &Bank) -> Result<SlotSnapshotPaths> {
|
||||||
bank.purge_zero_lamport_accounts();
|
bank.purge_zero_lamport_accounts();
|
||||||
let slot = bank.slot();
|
let slot = bank.slot();
|
||||||
// snapshot_path/slot
|
// snapshot_path/slot
|
||||||
let slot_snapshot_dir = get_bank_snapshot_dir(snapshot_path, slot);
|
let slot_snapshot_dir = get_bank_snapshot_dir(snapshot_path, slot);
|
||||||
fs::create_dir_all(slot_snapshot_dir.clone())?;
|
fs::create_dir_all(slot_snapshot_dir.clone())?;
|
||||||
|
|
||||||
// the snapshot is stored as snapshot_path/slot/slot
|
// the bank snapshot is stored as snapshot_path/slot/slot
|
||||||
let snapshot_bank_file_path = slot_snapshot_dir.join(get_snapshot_file_name(slot));
|
let snapshot_bank_file_path = slot_snapshot_dir.join(get_snapshot_file_name(slot));
|
||||||
info!(
|
info!(
|
||||||
"creating snapshot {}, path: {:?}",
|
"Creating snapshot for slot {}, path: {:?}",
|
||||||
bank.slot(),
|
slot, snapshot_bank_file_path,
|
||||||
snapshot_bank_file_path,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut bank_serialize = Measure::start("bank-serialize-ms");
|
let mut bank_serialize = Measure::start("bank-serialize-ms");
|
||||||
|
@ -234,7 +233,7 @@ pub fn add_snapshot<P: AsRef<Path>>(snapshot_path: P, bank: &Bank) -> Result<()>
|
||||||
// Monitor sizes because they're capped to MAX_SNAPSHOT_DATA_FILE_SIZE
|
// Monitor sizes because they're capped to MAX_SNAPSHOT_DATA_FILE_SIZE
|
||||||
datapoint_info!(
|
datapoint_info!(
|
||||||
"snapshot-bank-file",
|
"snapshot-bank-file",
|
||||||
("slot", bank.slot(), i64),
|
("slot", slot, i64),
|
||||||
("size", consumed_size, i64)
|
("size", consumed_size, i64)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -242,12 +241,13 @@ pub fn add_snapshot<P: AsRef<Path>>(snapshot_path: P, bank: &Bank) -> Result<()>
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"{} for slot {} at {:?}",
|
"{} for slot {} at {:?}",
|
||||||
bank_serialize,
|
bank_serialize, slot, snapshot_bank_file_path,
|
||||||
bank.slot(),
|
|
||||||
snapshot_bank_file_path,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(SlotSnapshotPaths {
|
||||||
|
slot,
|
||||||
|
snapshot_file_path: snapshot_bank_file_path,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn serialize_status_cache(
|
pub fn serialize_status_cache(
|
||||||
|
|
Loading…
Reference in New Issue