private void matchAgainstExpectedTransactionIdIfAny( long transactionId, TransactionToApply tx ) { long expectedTransactionId = tx.transactionId(); if ( expectedTransactionId != TRANSACTION_ID_NOT_SPECIFIED ) { if ( transactionId != expectedTransactionId ) { IllegalStateException ex = new IllegalStateException( "Received " + tx.transactionRepresentation() + " with txId:" + expectedTransactionId + " to be applied, but appending it ended up generating an unexpected txId:" + transactionId ); databaseHealth.panic( ex ); throw ex; } } }
@Before public void setup() { when( transactionToApply.transactionId() ).thenReturn( 1L ); when( indexingService.convertToIndexUpdates( any(), eq( EntityType.NODE ) ) ).thenAnswer( o -> Iterables.empty() ); }
@Before public void setup() { when( neoStores.getMetaDataStore() ).thenReturn( metaDataStore ); when( neoStores.getNodeStore() ).thenReturn( nodeStore ); when( neoStores.getRelationshipStore() ).thenReturn( relationshipStore ); when( neoStores.getPropertyStore() ).thenReturn( propertyStore ); when( neoStores.getRelationshipGroupStore() ).thenReturn( relationshipGroupStore ); when( neoStores.getRelationshipTypeTokenStore() ).thenReturn( relationshipTypeTokenStore ); when( neoStores.getLabelTokenStore() ).thenReturn( labelTokenStore ); when( neoStores.getPropertyKeyTokenStore() ).thenReturn( propertyKeyTokenStore ); when( neoStores.getSchemaStore() ).thenReturn( schemaStore ); when( nodeStore.getDynamicLabelStore() ).thenReturn( dynamicLabelStore ); when( lockService.acquireNodeLock( anyLong(), any() ) ) .thenReturn( LockService.NO_LOCK ); when( lockService.acquireRelationshipLock( anyLong(), any() ) ) .thenReturn( LockService.NO_LOCK ); when( transactionToApply.transactionId() ).thenReturn( transactionId ); }
@Test public void shouldAppendBatchOfTransactions() throws Exception { // GIVEN when( logFile.getWriter() ).thenReturn( channel ); TransactionAppender appender = life.add( createTransactionAppender() ); when( transactionIdStore.nextCommittingTransactionId() ).thenReturn( 2L, 3L, 4L ); TransactionToApply batch = batchOf( transaction( singleCreateNodeCommand( 0 ), new byte[0], 0, 0, 0, 1, 0 ), transaction( singleCreateNodeCommand( 1 ), new byte[0], 0, 0, 0, 1, 0 ), transaction( singleCreateNodeCommand( 2 ), new byte[0], 0, 0, 0, 1, 0 ) ); // WHEN appender.append( batch, logAppendEvent ); // THEN TransactionToApply tx = batch; assertEquals( 2L, tx.transactionId() ); tx = tx.next(); assertEquals( 3L, tx.transactionId() ); tx = tx.next(); assertEquals( 4L, tx.transactionId() ); assertNull( tx.next() ); }
private void matchAgainstExpectedTransactionIdIfAny( long transactionId, TransactionToApply tx ) { long expectedTransactionId = tx.transactionId(); if ( expectedTransactionId != TRANSACTION_ID_NOT_SPECIFIED ) { if ( transactionId != expectedTransactionId ) { IllegalStateException ex = new IllegalStateException( "Received " + tx.transactionRepresentation() + " with txId:" + expectedTransactionId + " to be applied, but appending it ended up generating an unexpected txId:" + transactionId ); databaseHealth.panic( ex ); throw ex; } } }
"invalidated due to an upcoming batch of changes being applied:" + "\n" + " Batch: firstCommittedTxId:" + first.transactionId() + ", firstCommittedTimestamp:" + informativeTimestamp( firstCommittedTimestamp ) + ", lastCommittedTxId:" + last.transactionId() + ", lastCommittedTimestamp:" + informativeTimestamp( lastCommittedTimestamp ) + ", batchTimeRange:" + informativeDuration( lastCommittedTimestamp - firstCommittedTimestamp ) +