use of org.neo4j.kernel.impl.transaction.log.PositionAwarePhysicalFlushableChecksumChannel in project neo4j by neo4j.
the class TransactionLogsRecoveryTest method writeSomeDataWithVersion.
private void writeSomeDataWithVersion(Path file, Visitor<Pair<LogEntryWriter, Consumer<LogPositionMarker>>, IOException> visitor, KernelVersion version) throws IOException {
try (LogVersionedStoreChannel versionedStoreChannel = new PhysicalLogVersionedStoreChannel(fileSystem.write(file), logVersion, CURRENT_LOG_FORMAT_VERSION, file, EMPTY_ACCESSOR);
PositionAwarePhysicalFlushableChecksumChannel writableLogChannel = new PositionAwarePhysicalFlushableChecksumChannel(versionedStoreChannel, new HeapScopedBuffer(1, KibiByte, INSTANCE))) {
writeLogHeader(writableLogChannel, new LogHeader(logVersion, 2L, StoreId.UNKNOWN));
writableLogChannel.beginChecksum();
Consumer<LogPositionMarker> consumer = marker -> {
try {
writableLogChannel.getCurrentPosition(marker);
} catch (IOException e) {
throw new RuntimeException(e);
}
};
LogEntryWriter first = new LogEntryWriter(writableLogChannel, version);
visitor.visit(Pair.of(first, consumer));
}
}
use of org.neo4j.kernel.impl.transaction.log.PositionAwarePhysicalFlushableChecksumChannel in project neo4j by neo4j.
the class TransactionLogFile method start.
@Override
public void start() throws IOException {
long currentLogVersion = logVersionRepository.getCurrentLogVersion();
channel = createLogChannelForVersion(currentLogVersion, context::getLastCommittedTransactionId);
context.getMonitors().newMonitor(LogRotationMonitor.class).started(channel.getPath(), currentLogVersion);
// try to set position
seekChannelPosition(currentLogVersion);
writer = new PositionAwarePhysicalFlushableChecksumChannel(channel, new NativeScopedBuffer(calculateLogBufferSize(), memoryTracker));
transactionLogWriter = new TransactionLogWriter(writer, new DbmsLogEntryWriterFactory(context.getKernelVersionProvider()));
}
use of org.neo4j.kernel.impl.transaction.log.PositionAwarePhysicalFlushableChecksumChannel in project neo4j by neo4j.
the class DetachedCheckpointAppender method start.
@Override
public void start() throws IOException {
this.storeId = context.getStoreId();
logVersionRepository = requireNonNull(context.getLogVersionRepository());
long initialVersion = logVersionRepository.getCheckpointLogVersion();
channel = channelAllocator.createLogChannel(initialVersion, context::getLastCommittedTransactionId);
context.getMonitors().newMonitor(LogRotationMonitor.class).started(channel.getPath(), initialVersion);
channel.position(channel.size());
buffer = new NativeScopedBuffer(kibiBytes(1), context.getMemoryTracker());
writer = new PositionAwarePhysicalFlushableChecksumChannel(channel, buffer);
checkpointWriter = new DetachedCheckpointLogEntryWriter(writer);
}
Aggregations