protected int doAppend(final long logIndex, final byte[] data) {
        this.writeLock.lock();
        try {
            int wrotePos = getWrotePosition();
            // First time append , set firstLogIndex to header
            if (this.header.isBlank()) {
                this.header.setFirstLogIndex(logIndex);
                saveHeader();
                wrotePos = this.header.getHeaderSize();
            }
            // Write data and update header
            final ByteBuffer buffer = sliceByteBuffer();
            put(buffer, wrotePos, data);
            setWrotePosition(wrotePos + data.length);
            this.header.setLastLogIndex(logIndex);
            return wrotePos;
        } finally {
            this.writeLock.unlock();
        }
    }
Append data to file end
@param logIndex logEntry index
@param data data array
@return wrote position
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/file/AbstractFile.java