public void setLastTransactionCommitTimestamp( long timestamp ) { // Preventing race with transactionCommitted() and assure record is consistent with highestCommittedTransaction synchronized ( transactionCommittedLock ) { setRecord( Position.LAST_TRANSACTION_COMMIT_TIMESTAMP, timestamp ); TransactionId transactionId = highestCommittedTransaction.get(); highestCommittedTransaction.set( transactionId.transactionId(), transactionId.checksum(), timestamp ); } }
void writeLastTxInformation( DatabaseLayout migrationStructure, TransactionId txInfo ) throws IOException { writeTxLogCounters( fileSystem, lastTxInformationFile( migrationStructure ), txInfo.transactionId(), txInfo.checksum(), txInfo.commitTimestamp() ); }
lastTxId, lastTxInfo.checksum(), lastTxLogPosition.getLogVersion(), lastTxLogPosition.getByteOffset(), progressReporter, oldFormat, newFormat );
@Test public void shouldGenerateTransactionInformationWhenLogsAreEmpty() throws Exception { // given long txId = 1; DatabaseLayout databaseLayout = directory.databaseLayout(); File neoStore = databaseLayout.metadataStore(); neoStore.createNewFile(); Config config = mock( Config.class ); LogService logService = new SimpleLogService( NullLogProvider.getInstance(), NullLogProvider.getInstance() ); // when // ... transaction info not in neo store assertEquals( FIELD_NOT_PRESENT, getRecord( pageCache, neoStore, LAST_TRANSACTION_ID ) ); assertEquals( FIELD_NOT_PRESENT, getRecord( pageCache, neoStore, LAST_TRANSACTION_CHECKSUM ) ); assertEquals( FIELD_NOT_PRESENT, getRecord( pageCache, neoStore, LAST_TRANSACTION_COMMIT_TIMESTAMP ) ); // ... and with migrator StoreMigrator migrator = new StoreMigrator( fileSystemRule.get(), pageCache, config, logService, jobScheduler ); TransactionId actual = migrator.extractTransactionIdInformation( neoStore, txId ); // then assertEquals( txId, actual.transactionId() ); assertEquals( TransactionIdStore.BASE_TX_CHECKSUM, actual.checksum() ); assertEquals( TransactionIdStore.BASE_TX_COMMIT_TIMESTAMP, actual.commitTimestamp() ); }
@Test public void shouldGenerateTransactionInformationWhenLogsNotPresent() throws Exception { // given long txId = 42; DatabaseLayout databaseLayout = directory.databaseLayout(); File neoStore = databaseLayout.metadataStore(); neoStore.createNewFile(); Config config = mock( Config.class ); LogService logService = new SimpleLogService( NullLogProvider.getInstance(), NullLogProvider.getInstance() ); // when // ... transaction info not in neo store assertEquals( FIELD_NOT_PRESENT, getRecord( pageCache, neoStore, LAST_TRANSACTION_ID ) ); assertEquals( FIELD_NOT_PRESENT, getRecord( pageCache, neoStore, LAST_TRANSACTION_CHECKSUM ) ); assertEquals( FIELD_NOT_PRESENT, getRecord( pageCache, neoStore, LAST_TRANSACTION_COMMIT_TIMESTAMP ) ); // ... and with migrator StoreMigrator migrator = new StoreMigrator( fileSystemRule.get(), pageCache, config, logService, jobScheduler ); TransactionId actual = migrator.extractTransactionIdInformation( neoStore, txId ); // then assertEquals( txId, actual.transactionId() ); assertEquals( TransactionIdStore.UNKNOWN_TX_CHECKSUM, actual.checksum() ); assertEquals( TransactionIdStore.UNKNOWN_TX_COMMIT_TIMESTAMP, actual.commitTimestamp() ); }
assertEquals( transactionId, lastClosedTransaction[0] ); assertEquals( LogEntryStart.checksum( additionalHeaderData, masterId, authorId ), transactionIdStore.getLastCommittedTransaction().checksum() ); assertEquals( commitTimestamp, transactionIdStore.getLastCommittedTransaction().commitTimestamp() ); assertEquals( logVersion, lastClosedTransaction[1] );
public void setLastTransactionCommitTimestamp( long timestamp ) { // Preventing race with transactionCommitted() and assure record is consistent with highestCommittedTransaction synchronized ( transactionCommittedLock ) { setRecord( Position.LAST_TRANSACTION_COMMIT_TIMESTAMP, timestamp ); TransactionId transactionId = highestCommittedTransaction.get(); highestCommittedTransaction.set( transactionId.transactionId(), transactionId.checksum(), timestamp ); } }
void writeLastTxInformation( DatabaseLayout migrationStructure, TransactionId txInfo ) throws IOException { writeTxLogCounters( fileSystem, lastTxInformationFile( migrationStructure ), txInfo.transactionId(), txInfo.checksum(), txInfo.commitTimestamp() ); }
lastTxId, lastTxInfo.checksum(), lastTxLogPosition.getLogVersion(), lastTxLogPosition.getByteOffset(), progressReporter, oldFormat, newFormat );