@Override
  public Iterable<FileStatus> getDeletableFiles(Iterable<FileStatus> files) {
    // all members of this class are null if replication is disabled,
    // so we cannot filter the files
    if (this.getConf() == null) {
      return files;
    }
    try {
      if (!rpm.getQueueStorage().hasData()) {
        return files;
      }
    } catch (ReplicationException e) {
      LOG.error("Error occurred while executing queueStorage.hasData()", e);
      return Collections.emptyList();
    }
    if (!canFilter) {
      // We can not delete anything if there are AddPeerProcedure running at the same time
      // See HBASE-27214 for more details.
      return Collections.emptyList();
    }

    return Iterables.filter(files, new Predicate<FileStatus>() {
      @Override
      public boolean apply(FileStatus file) {
        // just for overriding the findbugs NP warnings, as the parameter is marked as Nullable in
        // the guava Predicate.
        if (file == null) {
          return false;
        }
        if (peerIds.isEmpty()) {
          // no peer, can always delete
          return true;
        }
        // not a valid wal file name, delete
        if (!AbstractFSWALProvider.validateWALFilename(file.getPath().getName())) {
          return true;
        }
        // meta wal is always deletable as we will never replicate it
        if (AbstractFSWALProvider.isMetaFile(file.getPath())) {
          return true;
        }
        ServerName serverName =
          AbstractFSWALProvider.parseServerNameFromWALName(file.getPath().getName());
        if (notFullyDeadServers.contains(serverName)) {
          return filterForLiveRegionServer(serverName, file);
        } else {
          return filterForDeadRegionServer(serverName, file);
        }
      }
    });
  }
Implementation of a log cleaner that checks if a log is still scheduled for replication before
deleting it when its TTL is over.
<p/>
The logic is a bit complicated after we switch to use table based replication queue storage, see
the design doc in HBASE-27109 and the comments in HBASE-27214 for more details.
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java