// Map the segment, extending or truncating it to the standard segment size
logFileAccessor.setLength(DatabaseDescriptor.getCommitLogSegmentSize());
buffer = logFileAccessor.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, DatabaseDescriptor.getCommitLogSegmentSize());
checksum = new PureJavaCrc32();
bufferStream = new DataOutputStream(new ChecksummedOutputStream(new ByteBufferOutputStream(buffer), checksum));
buffer.putInt(CommitLog.END_OF_SEGMENT_MARKER);
buffer.position(0);
needsSync = true;
sync();
}