@Override
    protected byte[] onDataAppend(final long logIndex, final byte[] value, final WriteContext ctx) throws IOException,
                                                                                                  InterruptedException {
        final int waitToWroteBytes = SegmentFile.getWriteBytes(value);
        SegmentFile lastSegmentFile = getLastSegmentFile(logIndex, waitToWroteBytes, true, ctx);
        if (lastSegmentFile.reachesFileEndBy(waitToWroteBytes)) {
            throw new IOException("Too large value size: " + value.length + ", maxSegmentFileSize="
                                  + this.maxSegmentFileSize);
        }
        if (value.length < this.valueSizeThreshold) {
            // Small value will be stored in rocksdb directly.
            lastSegmentFile.setLastLogIndex(logIndex);
            ctx.finishJob();
            return value;
        }
        // Large value is stored in segment file and returns an encoded location info that will be stored in rocksdb.
        final int pos = lastSegmentFile.write(logIndex, value, ctx);
        final long firstLogIndex = lastSegmentFile.getFirstLogIndex();
        return encodeLocationMetadata(firstLogIndex, pos);
    }
Retrieve the log wrote position from metadata.

@param data the metadata
@return the log wrote position
jraft-core/src/main/java/com/alipay/sofa/jraft/storage/log/RocksDBSegmentLogStorage.java