private void apply( NeoStores neoStores, TransactionRepresentation transaction ) throws Exception { BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); apply( applier, transaction ); }
private void apply( NeoStores neoStores, TransactionRecordState state ) throws Exception { BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); apply( applier, transactionRepresentationOf( state ) ); }
appliers.add( new NeoStoreBatchTransactionApplier( mode.version(), neoStores, cacheAccess, lockService( mode ) ) ); if ( mode.needsHighIdTracking() )
private void applyExternalTransaction( long transactionId, Command...commands ) throws Exception { LockService lockService = mock( LockService.class ); when( lockService.acquireNodeLock( anyLong(), any(LockService.LockType.class) )).thenReturn( LockService.NO_LOCK ); when( lockService.acquireRelationshipLock( anyLong(), any(LockService.LockType.class) )).thenReturn( LockService.NO_LOCK ); NeoStoreBatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), lockService ); TransactionRepresentation tx = new PhysicalTransactionRepresentation( Arrays.asList( commands ) ); CommandHandlerContract.apply( applier, txApplier -> { tx.accept( txApplier ); return false; }, new TransactionToApply( tx, transactionId ) ); }
private BatchTransactionApplier newApplier( boolean recovery ) { BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, cacheAccess, lockService ); if ( recovery ) { applier = newApplierFacade( new HighIdBatchTransactionApplier( neoStores ), applier, new CacheInvalidationBatchTransactionApplier( neoStores, cacheAccess ) ); } return applier; }
@Test public void shouldDeleteDynamicLabelsForDeletedNode() throws Throwable { // GIVEN a store that has got a node with a dynamic label record NeoStores store = neoStoresRule.builder().build(); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( store, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); AtomicLong nodeId = new AtomicLong(); AtomicLong dynamicLabelRecordId = new AtomicLong(); apply( applier, transaction( nodeWithDynamicLabelRecord( store, nodeId, dynamicLabelRecordId ) ) ); assertDynamicLabelRecordInUse( store, dynamicLabelRecordId.get(), true ); // WHEN applying a transaction where the node is deleted apply( applier, transaction( deleteNode( store, nodeId.get() ) ) ); // THEN the dynamic label record should also be deleted assertDynamicLabelRecordInUse( store, dynamicLabelRecordId.get(), false ); }
@Test public void shouldDeleteDynamicLabelsForDeletedNodeForRecoveredTransaction() throws Throwable { // GIVEN a store that has got a node with a dynamic label record NeoStores store = neoStoresRule.builder().build(); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( store, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); AtomicLong nodeId = new AtomicLong(); AtomicLong dynamicLabelRecordId = new AtomicLong(); apply( applier, transaction( nodeWithDynamicLabelRecord( store, nodeId, dynamicLabelRecordId ) ) ); assertDynamicLabelRecordInUse( store, dynamicLabelRecordId.get(), true ); // WHEN applying a transaction, which has first round-tripped through a log (written then read) TransactionRepresentation transaction = transaction( deleteNode( store, nodeId.get() ) ); InMemoryVersionableReadableClosablePositionAwareChannel channel = new InMemoryVersionableReadableClosablePositionAwareChannel(); writeToChannel( transaction, channel ); CommittedTransactionRepresentation recoveredTransaction = readFromChannel( channel ); // and applying that recovered transaction apply( applier, recoveredTransaction.getTransactionRepresentation() ); // THEN should have the dynamic label record should be deleted as well assertDynamicLabelRecordInUse( store, dynamicLabelRecordId.get(), false ); }
BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), locks ); apply( applier, transaction( tx ) ); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), locks ); apply( applier, transaction( tx ) );
recordState.relCreate( relId2, 0, nodeId, nodeId ); recordState.nodeAddProperty( nodeId, 0, Values.of( 101 ) ); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); apply( applier, transaction( recordState ) );
recordState.relCreate( relId4, 1, nodeId1, nodeId1 ); recordState.nodeAddProperty( nodeId1, 0, value1 ); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); apply( applier, transaction( recordState ) );
recordState.createRelationshipTypeToken( "10", type10 ); recordState.createRelationshipTypeToken( "15", type15 ); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); apply( applier, transaction( recordState ) ); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); apply( applier, transaction( recordState ) ); recordState.nodeCreate( otherNodeId ); recordState.relCreate( neoStores.getRelationshipStore().nextId(), type5, nodeId, otherNodeId ); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); apply( applier, transaction( recordState ) ); recordState.nodeCreate( otherNodeId ); recordState.relCreate( neoStores.getRelationshipStore().nextId(), type15, nodeId, otherNodeId ); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); apply( applier, transaction( recordState ) );
createRelationships( neoStores, tx, nodeId, typeA, INCOMING, 20 ); BatchTransactionApplier applier = new NeoStoreBatchTransactionApplier( neoStores, mock( CacheAccessBackDoor.class ), LockService.NO_LOCK_SERVICE ); apply( applier, transaction( tx ) );
appliers.add( new NeoStoreBatchTransactionApplier( mode.version(), neoStores, cacheAccess, lockService( mode ) ) ); if ( mode.needsHighIdTracking() )