private boolean filterForLiveRegionServer(ServerName serverName, FileStatus file) {
    Map<String, Map<String, ReplicationGroupOffset>> peerId2Offsets =
      replicationOffsets.get(serverName);
    if (peerId2Offsets == null) {
      // if there are replication queues missing, we can not delete the wal
      return false;
    }
    for (String peerId : peerIds) {
      Map<String, ReplicationGroupOffset> offsets = peerId2Offsets.get(peerId);
      // if no replication queue for a peer, we can not delete the wal
      if (offsets == null) {
        return false;
      }
      String walGroupId = AbstractFSWALProvider.getWALPrefixFromWALName(file.getPath().getName());
      ReplicationGroupOffset offset = offsets.get(walGroupId);
      // if a replication queue still need to replicate this wal, we can not delete it
      if (!shouldDelete(offset, file)) {
        return false;
      }
    }
    // if all replication queues have already finished replicating this wal, we can delete it.
    return true;
  }
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