code: @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());
      }
docs: Determines which Ledger Ids are safe to delete from BookKeeper.
  
  @param oldMetadata     A pointer to the previous version of the metadata, that contains all Ledgers eligible for
  deletion. Only those Ledgers that do not exist in currentMetadata will be selected.
  @param currentMetadata A pointer to the current version of the metadata. No Ledger that is referenced here will
  be selected.
  @return A List that contains Ledger Ids to remove. May be empty.