@Override
    public void open(CapacityReader reader) throws IOException {
        File file = new File(filePath);
        if (file.exists()) {
            if (!file.isFile()) {
                throw new IOException(filePath + " is not a file");
            }
            randomAccessFile = new RandomAccessFile(file, "rw");
            fileCapacityFact = randomAccessFile.length();
            if (!recoveryMode && fileCapacityFact != fileCapacityWant) {
                // the file exists but not the same size as requested
                throw new WALCapacityMismatchException(filePath, fileCapacityWant, fileCapacityFact);
            }
        } else {
            // the file does not exist
            if (recoveryMode) {
                throw new WALNotInitializedException("try to open an uninitialized WAL in recovery mode: file not exists: " + filePath);
            }
            WALUtil.createFile(filePath, fileCapacityWant);
            randomAccessFile = new RandomAccessFile(filePath, "rw");
            fileCapacityFact = fileCapacityWant;
        }

        fileChannel = randomAccessFile.getChannel();

        checkCapacity(reader);
    }
When set to true, the file should exist and the file size does not need to be verified.
s3stream/src/main/java/com/automq/stream/s3/wal/util/WALFileChannel.java