@Override void write(int startMarker, int nextMarker) { // if there's room in the discard section to write an empty header, // zero out the next sync marker so replayer can cleanly exit if (nextMarker <= buffer.capacity() - SYNC_MARKER_SIZE) { buffer.putInt(nextMarker, 0); buffer.putInt(nextMarker + 4, 0); } // write previous sync marker to point to next sync marker // we don't chain the crcs here to ensure this method is idempotent if it fails writeSyncMarker(id, buffer, startMarker, startMarker, nextMarker); }
static CommitLogSegment createSegment(CommitLog commitLog, AbstractCommitLogSegmentManager manager) { Configuration config = commitLog.configuration; CommitLogSegment segment = config.useEncryption() ? new EncryptedSegment(commitLog, manager) : config.useCompression() ? new CompressedSegment(commitLog, manager) : new MemoryMappedSegment(commitLog, manager); segment.writeLogHeader(); return segment; }
@Override protected void flush(int startMarker, int nextMarker) { try { SyncUtil.force((MappedByteBuffer) buffer); } catch (Exception e) // MappedByteBuffer.force() does not declare IOException but can actually throw it { throw new FSWriteError(e, getPath()); } NativeLibrary.trySkipCache(fd, startMarker, nextMarker, logFile.getAbsolutePath()); }
static CommitLogSegment createSegment(CommitLog commitLog, AbstractCommitLogSegmentManager manager) { Configuration config = commitLog.configuration; CommitLogSegment segment = config.useEncryption() ? new EncryptedSegment(commitLog, manager) : config.useCompression() ? new CompressedSegment(commitLog, manager) : new MemoryMappedSegment(commitLog, manager); segment.writeLogHeader(); return segment; }
@Override protected void flush(int startMarker, int nextMarker) { try { SyncUtil.force((MappedByteBuffer) buffer); } catch (Exception e) // MappedByteBuffer.force() does not declare IOException but can actually throw it { throw new FSWriteError(e, getPath()); } NativeLibrary.trySkipCache(fd, startMarker, nextMarker, logFile.getAbsolutePath()); }
static CommitLogSegment createSegment(CommitLog commitLog, AbstractCommitLogSegmentManager manager) { Configuration config = commitLog.configuration; CommitLogSegment segment = config.useEncryption() ? new EncryptedSegment(commitLog, manager) : config.useCompression() ? new CompressedSegment(commitLog, manager) : new MemoryMappedSegment(commitLog, manager); segment.writeLogHeader(); return segment; }
@Override protected void flush(int startMarker, int nextMarker) { try { SyncUtil.force((MappedByteBuffer) buffer); } catch (Exception e) // MappedByteBuffer.force() does not declare IOException but can actually throw it { throw new FSWriteError(e, getPath()); } NativeLibrary.trySkipCache(fd, startMarker, nextMarker, logFile.getAbsolutePath()); }
@Override void write(int startMarker, int nextMarker) { // if there's room in the discard section to write an empty header, // zero out the next sync marker so replayer can cleanly exit if (nextMarker <= buffer.capacity() - SYNC_MARKER_SIZE) { buffer.putInt(nextMarker, 0); buffer.putInt(nextMarker + 4, 0); } // write previous sync marker to point to next sync marker // we don't chain the crcs here to ensure this method is idempotent if it fails writeSyncMarker(id, buffer, startMarker, startMarker, nextMarker); }
@Override void write(int startMarker, int nextMarker) { // if there's room in the discard section to write an empty header, // zero out the next sync marker so replayer can cleanly exit if (nextMarker <= buffer.capacity() - SYNC_MARKER_SIZE) { buffer.putInt(nextMarker, 0); buffer.putInt(nextMarker + 4, 0); } // write previous sync marker to point to next sync marker // we don't chain the crcs here to ensure this method is idempotent if it fails writeSyncMarker(id, buffer, startMarker, startMarker, nextMarker); }