private void roll() {
        cleanFilesUntilSpaceEnough();
        closeCurrentFileChannel();
        if (enableCompression) {
            try {
                compress();
                try {
                    Files.deleteIfExists(currentFile.path());
                } catch (Exception e) {
                    InternalLogger.INSTANCE.error("Caught an error while deleting the log file: "
                            + currentFile.path(), e);
                }
            } catch (Exception e) {
                InternalLogger.INSTANCE.error("Caught an error while compressing the log file: "
                        + currentFile.path(), e);
            }
        }
        openNewFile(true);
        cleanExceededFiles();
    }
Note that it is fine to close file channel and open a new one not atomically because there is
always only one thread will call roll() and append()
turms-server-common/src/main/java/im/turms/server/common/infra/logging/core/appender/file/RollingFileAppender.java