private boolean loadNewFile(final SegmentFileOptions opts) {
        assert (opts.pos == 0);
        assert (!opts.recover);

        final File file = new File(this.path);

        if (file.exists()) {
            LOG.error("File {} already exists.", this.path);
            return false;
        }
        long startMs = Utils.monotonicMs();
        this.writeLock.lock();
        try (FileChannel fc = openFileChannel(true)) {
            this.buffer = fc.map(MapMode.READ_WRITE, 0, this.size);
            // Warmup mmap file
            BufferUtils.position(this.buffer, 0);
            BufferUtils.limit(this.buffer, this.size);
            saveHeader(true);

            this.committedPos = this.wrotePos = HEADER_SIZE;
            BufferUtils.position(this.buffer, this.wrotePos);

            assert (this.wrotePos == this.buffer.position());

            LOG.info("Created a new segment file {} cost {} ms, wrotePosition={}, bufferPosition={}, mappedSize={}.",
                this.path, Utils.monotonicMs() - startMs, this.wrotePos, this.buffer.position(), this.size);
            return true;
        } catch (final IOException e) {
            LOG.error("Fail to init segment file {}.", this.path, e);
            return false;
        } finally {
            this.writeLock.unlock();
        }
    }
Clear data in [startPos, startPos+64).

@param startPos the start position(inclusive)
jraft-core/src/main/java/com/alipay/sofa/jraft/storage/log/SegmentFile.java