@ GuardedBy ( "lock" ) private List < Long > getLedgerIdsToDelete ( LogMetadata oldMetadata , LogMetadata currentMetadata ) { if ( oldMetadata == null ) { return Collections . emptyList ( ) ; } val existingIds = currentMetadata . getLedgers ( ) . stream ( ) . map ( LedgerMetadata :: getLedgerId ) . collect ( Collectors . toSet ( ) ) ; return oldMetadata . getLedgers ( ) . stream ( ) . map ( LedgerMetadata :: getLedgerId ) . filter ( id -> ! existingIds . contains ( id ) ) . collect ( Collectors . toList ( ) ) ; }
Determines which Ledger Ids are safe to delete from BookKeeper .