public static List<Path> split(Path walRootDir, Path walsDir, Path archiveDir, FileSystem walFS,
    Configuration conf, final WALFactory factory) throws IOException {
    Path rootDir = CommonFSUtils.getRootDir(conf);
    FileSystem rootFS = rootDir.getFileSystem(conf);
    WALSplitter splitter = new WALSplitter(factory, conf, walRootDir, walFS, rootDir, rootFS);
    final List<FileStatus> wals =
      SplitLogManager.getFileList(conf, Collections.singletonList(walsDir), null);
    List<Path> splits = new ArrayList<>();
    if (!wals.isEmpty()) {
      for (FileStatus wal : wals) {
        SplitWALResult splitWALResult = splitter.splitWAL(wal, null);
        if (splitWALResult.isFinished()) {
          WALSplitUtil.archive(wal.getPath(), splitWALResult.isCorrupt(), archiveDir, walFS, conf);
          // splitter.outputSink.splits is mark as final, do not need null check
          splits.addAll(splitter.outputSink.splits);
        }
      }
    }
    if (!walFS.delete(walsDir, true)) {
      throw new IOException("Unable to delete src dir " + walsDir);
    }
    return splits;
  }
Split a folder of WAL files. Delete the directory when done. Used by tools and unit tests. It
should be package private. It is public only because TestWALObserver is in a different package,
which uses this method to do log splitting.
@return List of output files created by the split.
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALSplitter.java