private void deleteOneWithFewerEntries(RecoveredEditsWriter editsWriter, Path dst)
    throws IOException {
    long dstMinLogSeqNum = -1L;
    try (WALStreamReader reader =
      walSplitter.getWalFactory().createStreamReader(walSplitter.walFS, dst)) {
      WAL.Entry entry = reader.next();
      if (entry != null) {
        dstMinLogSeqNum = entry.getKey().getSequenceId();
      }
    } catch (EOFException e) {
      LOG.debug("Got EOF when reading first WAL entry from {}, an empty or broken WAL file?", dst,
        e);
    }
    if (editsWriter.minLogSeqNum < dstMinLogSeqNum) {
      LOG.warn("Found existing old edits file. It could be the result of a previous failed"
        + " split attempt or we have duplicated wal entries. Deleting " + dst + ", length="
        + walSplitter.walFS.getFileStatus(dst).getLen());
      if (!walSplitter.walFS.delete(dst, false)) {
        LOG.warn("Failed deleting of old {}", dst);
        throw new IOException("Failed deleting of old " + dst);
      }
    } else {
      LOG
        .warn("Found existing old edits file and we have less entries. Deleting " + editsWriter.path
          + ", length=" + walSplitter.walFS.getFileStatus(editsWriter.path).getLen());
      if (!walSplitter.walFS.delete(editsWriter.path, false)) {
        LOG.warn("Failed deleting of {}", editsWriter.path);
        throw new IOException("Failed deleting of " + editsWriter.path);
      }
    }
  }
Update region's maximum edit log SeqNum.
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractRecoveredEditsOutputSink.java