use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class TransactionMetadataCacheTest method shouldClearTheCache.
@Test
public void shouldClearTheCache() {
// given
final TransactionMetadataCache cache = new TransactionMetadataCache(2);
final LogPosition position = new LogPosition(3, 4);
final int txId = 42;
final int masterId = 0;
final int authorId = 1;
final int checksum = 2;
final long timestamp = System.currentTimeMillis();
// when
cache.cacheTransactionMetadata(txId, position, masterId, authorId, checksum, timestamp);
cache.clear();
final TransactionMetadataCache.TransactionMetadata metadata = cache.getTransactionMetadata(txId);
// then
assertNull(metadata);
}
use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class MigrationTestUtils method removeCheckPointFromTxLog.
public static void removeCheckPointFromTxLog(FileSystemAbstraction fileSystem, File workingDirectory) throws IOException {
PhysicalLogFiles logFiles = new PhysicalLogFiles(workingDirectory, fileSystem);
LogEntryReader<ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader<>();
LatestCheckPointFinder finder = new LatestCheckPointFinder(logFiles, fileSystem, logEntryReader);
LatestCheckPointFinder.LatestCheckPoint latestCheckPoint = finder.find(logFiles.getHighestLogVersion());
if (latestCheckPoint.commitsAfterCheckPoint) {
// done already
return;
}
// let's assume there is at least a checkpoint
assertNotNull(latestCheckPoint.checkPoint);
LogPosition logPosition = latestCheckPoint.checkPoint.getLogPosition();
File logFile = logFiles.getLogFileForVersion(logPosition.getLogVersion());
fileSystem.truncate(logFile, logPosition.getByteOffset());
}
Aggregations