38
38
} ;
39
39
40
40
const INTERVAL_MS : u64 = 100 ;
41
- const CLEAN_INTERVAL_BLOCKS : u64 = 100 ;
41
+ const CLEAN_INTERVAL_SLOTS : Slot = 100 ;
42
42
const SHRINK_INTERVAL : Duration = Duration :: from_secs ( 1 ) ;
43
43
44
44
pub type SnapshotRequestSender = Sender < SnapshotRequest > ;
@@ -148,7 +148,7 @@ impl SnapshotRequestHandler {
148
148
test_hash_calculation : bool ,
149
149
non_snapshot_time_us : u128 ,
150
150
exit : & AtomicBool ,
151
- ) -> Option < Result < u64 , SnapshotError > > {
151
+ ) -> Option < Result < Slot , SnapshotError > > {
152
152
let ( snapshot_request, num_outstanding_requests, num_re_enqueued_requests) =
153
153
self . get_next_snapshot_request ( ) ?;
154
154
@@ -273,7 +273,7 @@ impl SnapshotRequestHandler {
273
273
snapshot_request : SnapshotRequest ,
274
274
accounts_package_kind : AccountsPackageKind ,
275
275
exit : & AtomicBool ,
276
- ) -> Result < u64 , SnapshotError > {
276
+ ) -> Result < Slot , SnapshotError > {
277
277
info ! ( "handling snapshot request: {snapshot_request:?}, {accounts_package_kind:?}" ) ;
278
278
let mut total_time = Measure :: start ( "snapshot_request_receiver_total_time" ) ;
279
279
let SnapshotRequest {
@@ -414,7 +414,7 @@ impl SnapshotRequestHandler {
414
414
( "non_snapshot_time_us" , non_snapshot_time_us, i64 ) ,
415
415
( "shrink_ancient_time_us" , shrink_ancient_time_us, i64 ) ,
416
416
) ;
417
- Ok ( snapshot_root_bank. block_height ( ) )
417
+ Ok ( snapshot_root_bank. slot ( ) )
418
418
}
419
419
}
420
420
@@ -497,7 +497,7 @@ impl AbsRequestHandlers {
497
497
test_hash_calculation : bool ,
498
498
non_snapshot_time_us : u128 ,
499
499
exit : & AtomicBool ,
500
- ) -> Option < Result < u64 , SnapshotError > > {
500
+ ) -> Option < Result < Slot , SnapshotError > > {
501
501
self . snapshot_request_handler . handle_snapshot_requests (
502
502
test_hash_calculation,
503
503
non_snapshot_time_us,
@@ -520,7 +520,7 @@ impl AccountsBackgroundService {
520
520
) -> Self {
521
521
let is_running = Arc :: new ( AtomicBool :: new ( true ) ) ;
522
522
let stop = Arc :: new ( AtomicBool :: new ( false ) ) ;
523
- let mut last_cleaned_block_height = 0 ;
523
+ let mut last_cleaned_slot = 0 ;
524
524
let mut removed_slots_count = 0 ;
525
525
let mut total_remove_slots_time = 0 ;
526
526
let t_background = Builder :: new ( )
@@ -599,11 +599,11 @@ impl AccountsBackgroundService {
599
599
600
600
last_snapshot_end_time = Some ( Instant :: now ( ) ) ;
601
601
match snapshot_handle_result {
602
- Ok ( snapshot_block_height ) => {
602
+ Ok ( snapshot_slot ) => {
603
603
assert ! (
604
- last_cleaned_block_height <= snapshot_block_height ,
605
- "last cleaned block height : {last_cleaned_block_height }, \
606
- snapshot request block height : {snapshot_block_height }, \
604
+ last_cleaned_slot <= snapshot_slot ,
605
+ "last cleaned slot : {last_cleaned_slot }, \
606
+ snapshot request slot : {snapshot_slot }, \
607
607
is startup verification complete: {}, \
608
608
enqueued snapshot requests: {:?}",
609
609
bank. is_startup_verification_complete( ) ,
@@ -613,7 +613,7 @@ impl AccountsBackgroundService {
613
613
. try_iter( )
614
614
. collect:: <Vec <_>>( ) ,
615
615
) ;
616
- last_cleaned_block_height = snapshot_block_height ;
616
+ last_cleaned_slot = snapshot_slot ;
617
617
previous_shrink_time = Instant :: now ( ) ;
618
618
}
619
619
Err ( err) => {
@@ -625,16 +625,16 @@ impl AccountsBackgroundService {
625
625
break ;
626
626
}
627
627
}
628
- } else if bank. block_height ( ) - last_cleaned_block_height
629
- > ( CLEAN_INTERVAL_BLOCKS + thread_rng ( ) . gen_range ( 0 ..10 ) )
628
+ } else if bank. slot ( ) - last_cleaned_slot
629
+ > ( CLEAN_INTERVAL_SLOTS + thread_rng ( ) . gen_range ( 0 ..10 ) )
630
630
{
631
631
// Note that the flush will do an internal clean of the
632
632
// cache up to bank.slot(), so should be safe as long
633
633
// as any later snapshots that are taken are of
634
634
// slots >= bank.slot()
635
635
bank. force_flush_accounts_cache ( ) ;
636
636
bank. clean_accounts ( ) ;
637
- last_cleaned_block_height = bank. block_height ( ) ;
637
+ last_cleaned_slot = bank. slot ( ) ;
638
638
// Do not 'shrink' until *after* the startup verification is complete.
639
639
// This is because startup verification needs to get the snapshot
640
640
// storages *as they existed at startup* (to calculate the accounts
0 commit comments