use of org.neo4j.kernel.impl.api.BatchTransactionApplierFacade in project neo4j by neo4j.
the class RecordStorageEngine method applier.
/**
* Creates a {@link BatchTransactionApplierFacade} that is to be used for all transactions
* in a batch. Each transaction is handled by a {@link TransactionApplierFacade} which wraps the
* individual {@link TransactionApplier}s returned by the wrapped {@link BatchTransactionApplier}s.
*
* After all transactions have been applied the appliers are closed.
*/
protected BatchTransactionApplierFacade applier(TransactionApplicationMode mode) {
ArrayList<BatchTransactionApplier> appliers = new ArrayList<>();
// Graph store application. The order of the decorated store appliers is irrelevant
appliers.add(new NeoStoreBatchTransactionApplier(neoStores, cacheAccess, lockService));
if (mode.needsHighIdTracking()) {
appliers.add(new HighIdBatchTransactionApplier(neoStores));
}
if (mode.needsCacheInvalidationOnUpdates()) {
appliers.add(new CacheInvalidationBatchTransactionApplier(neoStores, cacheAccess));
}
// Schema index application
appliers.add(new IndexBatchTransactionApplier(indexingService, labelScanStoreSync, indexUpdatesSync, neoStores.getNodeStore(), new PropertyLoader(neoStores), indexUpdatesConverter, mode));
// Legacy index application
appliers.add(new LegacyBatchIndexApplier(indexConfigStore, legacyIndexApplierLookup, legacyIndexTransactionOrdering, mode));
// Counts store application
appliers.add(new CountsStoreBatchTransactionApplier(neoStores.getCounts(), mode));
// Perform the application
return new BatchTransactionApplierFacade(appliers.toArray(new BatchTransactionApplier[appliers.size()]));
}
use of org.neo4j.kernel.impl.api.BatchTransactionApplierFacade in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyDeleteIndexRuleSchemaRuleCommandToTheStore.
@Test
public void shouldApplyDeleteIndexRuleSchemaRuleCommandToTheStore() throws Exception {
// given
final BatchTransactionApplier base = newApplier(false);
final BatchTransactionApplier indexApplier = newIndexApplier();
final BatchTransactionApplierFacade applier = new BatchTransactionApplierFacade(base, indexApplier);
final DynamicRecord record = DynamicRecord.dynamicRecord(21, true);
record.setInUse(false);
final Collection<DynamicRecord> recordsAfter = Arrays.asList(record);
final IndexRule rule = indexRule(0, 1, 2, new SchemaIndexProvider.Descriptor("K", "X.Y"));
final Command.SchemaRuleCommand command = new Command.SchemaRuleCommand(Collections.<DynamicRecord>emptyList(), recordsAfter, rule);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(schemaStore, times(1)).updateRecord(record);
verify(indexingService, times(1)).dropIndex(rule);
verify(cacheAccess, times(1)).removeSchemaRuleFromCache(command.getKey());
}
Aggregations