protected Path closeRecoveredEditsWriterAndFinalizeEdits(RecoveredEditsWriter editsWriter,
    List<IOException> thrown) throws IOException {
    if (!closeRecoveredEditsWriter(editsWriter, thrown)) {
      return null;
    }
    if (editsWriter.editsWritten == 0) {
      // just remove the empty recovered.edits file
      removeRecoveredEditsFile(editsWriter);
      return null;
    }

    Path dst = getCompletedRecoveredEditsFilePath(editsWriter.path,
      regionMaximumEditLogSeqNum.get(Bytes.toString(editsWriter.encodedRegionName)));
    try {
      if (!dst.equals(editsWriter.path) && walSplitter.walFS.exists(dst)) {
        deleteOneWithFewerEntries(editsWriter, dst);
      }
      // Skip the unit tests which create a splitter that reads and
      // writes the data without touching disk.
      // TestHLogSplit#testThreading is an example.
      if (walSplitter.walFS.exists(editsWriter.path)) {
        if (!walSplitter.walFS.rename(editsWriter.path, dst)) {
          final String errorMsg =
            "Failed renaming recovered edits " + editsWriter.path + " to " + dst;
          updateStatusWithMsg(errorMsg);
          throw new IOException(errorMsg);
        }
        final String renameEditMsg = "Rename recovered edits " + editsWriter.path + " to " + dst;
        LOG.info(renameEditMsg);
        updateStatusWithMsg(renameEditMsg);
      }
    } catch (IOException ioe) {
      final String errorMsg = "Could not rename recovered edits " + editsWriter.path + " to " + dst;
      LOG.error(errorMsg, ioe);
      updateStatusWithMsg(errorMsg);
      thrown.add(ioe);
      return null;
    }
    return dst;
  }
abortRecoveredEditsWriter closes the editsWriter, but does not rename and finalize the
recovered edits WAL files. Please see HBASE-28569.
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractRecoveredEditsOutputSink.java