use of org.neo4j.kernel.impl.store.TransactionId in project neo4j by neo4j.
the class StoreMigratorTest method writeAndReadLastTxInformation.
@Test
public void writeAndReadLastTxInformation() throws IOException {
StoreMigrator migrator = newStoreMigrator();
TransactionId writtenTxId = new TransactionId(random.nextLong(), random.nextLong(), random.nextLong());
migrator.writeLastTxInformation(directory.graphDbDir(), writtenTxId);
TransactionId readTxId = migrator.readLastTxInformation(directory.graphDbDir());
assertEquals(writtenTxId, readTxId);
}
use of org.neo4j.kernel.impl.store.TransactionId in project neo4j by neo4j.
the class StoreMigratorTest method shouldExtractTransactionInformationFromLegacyLogsWhenCantFindInStore.
@Test
public void shouldExtractTransactionInformationFromLegacyLogsWhenCantFindInStore() throws Exception {
// given
// ... variables
long txId = 42;
long checksum = 123456789123456789L;
long timestamp = 919191919191919191L;
TransactionId expected = new TransactionId(txId, checksum, timestamp);
// ... and files
PageCache pageCache = pageCacheRule.getPageCache(fileSystemRule.get());
File storeDir = directory.graphDbDir();
File neoStore = new File(storeDir, DEFAULT_NAME);
neoStore.createNewFile();
// ... and mocks
Config config = mock(Config.class);
LogService logService = mock(LogService.class);
LegacyLogs legacyLogs = mock(LegacyLogs.class);
when(legacyLogs.getTransactionInformation(storeDir, txId)).thenReturn(Optional.of(expected));
// when
// ... neoStore is empty and with migrator
StoreMigrator migrator = new StoreMigrator(fileSystemRule.get(), pageCache, config, logService, schemaIndexProvider, legacyLogs);
TransactionId actual = migrator.extractTransactionIdInformation(neoStore, storeDir, txId);
// then
assertEquals(expected, actual);
}
use of org.neo4j.kernel.impl.store.TransactionId in project neo4j by neo4j.
the class DeadSimpleTransactionIdStore method setLastCommittedAndClosedTransactionId.
@Override
public void setLastCommittedAndClosedTransactionId(long transactionId, long checksum, long commitTimestamp, long byteOffset, long logVersion) {
committingTransactionId.set(transactionId);
committedTransactionId.set(new TransactionId(transactionId, checksum, commitTimestamp));
closedTransactionId.set(transactionId, new long[] { logVersion, byteOffset });
}
Aggregations