@Override public boolean rotationNeeded() { /* * Whereas channel.size() should be fine, we're safer calling position() due to possibility * of this file being memory mapped or whatever. */ return channel.position() >= rotateAtSize.get(); }
@Override public void start() throws IOException { // Recovery has taken place before this, so the log file has been truncated to last known good tx // Just read header and move to the end long lastLogVersionUsed = logVersionRepository.getCurrentLogVersion(); channel = logFiles.createLogChannelForVersion( lastLogVersionUsed, OpenMode.READ_WRITE, context::getLastCommittedTransactionId ); // Move to the end channel.position( channel.size() ); writer = new PositionAwarePhysicalFlushableChannel( channel ); }
@Override public ReadableLogChannel getReader( LogPosition position, LogVersionBridge logVersionBridge ) throws IOException { PhysicalLogVersionedStoreChannel logChannel = logFiles.openForVersion( position.getLogVersion() ); logChannel.position( position.getByteOffset() ); return new ReadAheadLogChannel( logChannel, logVersionBridge ); }
@Override public boolean rotationNeeded() { /* * Whereas channel.size() should be fine, we're safer calling position() due to possibility * of this file being memory mapped or whatever. */ return channel.position() >= rotateAtSize.get(); }
@Override public ReadableLogChannel getReader( LogPosition position, LogVersionBridge logVersionBridge ) throws IOException { PhysicalLogVersionedStoreChannel logChannel = logFiles.openForVersion( position.getLogVersion() ); logChannel.position( position.getByteOffset() ); return new ReadAheadLogChannel( logChannel, logVersionBridge ); }
@Override public void start() throws IOException { // Recovery has taken place before this, so the log file has been truncated to last known good tx // Just read header and move to the end long lastLogVersionUsed = logVersionRepository.getCurrentLogVersion(); channel = logFiles.createLogChannelForVersion( lastLogVersionUsed, OpenMode.READ_WRITE, context::getLastCommittedTransactionId ); // Move to the end channel.position( channel.size() ); writer = new PositionAwarePhysicalFlushableChannel( channel ); }