use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class IndexBatchTransactionApplierTest method shouldProvideLabelScanStoreUpdatesSortedByNodeId.
@Test
public void shouldProvideLabelScanStoreUpdatesSortedByNodeId() throws Exception {
// GIVEN
IndexingService indexing = mock(IndexingService.class);
LabelScanWriter writer = new OrderVerifyingLabelScanWriter(10, 15, 20);
WorkSync<Supplier<LabelScanWriter>, LabelUpdateWork> labelScanSync = spy(new WorkSync<>(singletonProvider(writer)));
WorkSync<IndexingService, IndexUpdatesWork> indexUpdatesSync = new WorkSync<>(indexing);
TransactionToApply tx = mock(TransactionToApply.class);
PropertyStore propertyStore = mock(PropertyStore.class);
try (IndexBatchTransactionApplier applier = new IndexBatchTransactionApplier(indexing, labelScanSync, indexUpdatesSync, mock(NodeStore.class), mock(PropertyLoader.class), new PropertyPhysicalToLogicalConverter(propertyStore), TransactionApplicationMode.INTERNAL)) {
try (TransactionApplier txApplier = applier.startTx(tx)) {
// WHEN
txApplier.visitNodeCommand(node(15));
txApplier.visitNodeCommand(node(20));
txApplier.visitNodeCommand(node(10));
}
}
// THEN all assertions happen inside the LabelScanWriter#write and #close
verify(labelScanSync).apply(any());
}
use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class SchemaRuleCommandTest method visitSchemaRuleCommand.
private void visitSchemaRuleCommand(BatchTransactionApplier applier, SchemaRuleCommand command) throws Exception {
TransactionToApply tx = new TransactionToApply(new PhysicalTransactionRepresentation(singletonList(command)), txId);
CommandHandlerContract.apply(applier, tx);
}
use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class RecordStorageEngineTest method executeFailingTransaction.
private Exception executeFailingTransaction(RecordStorageEngine engine) throws IOException {
Exception applicationError = new UnderlyingStorageException("No space left on device");
TransactionToApply txToApply = newTransactionThatFailsWith(applicationError);
try {
engine.apply(txToApply, TransactionApplicationMode.INTERNAL);
fail("Exception expected");
} catch (Exception e) {
assertSame(applicationError, Exceptions.rootCause(e));
}
return applicationError;
}
use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class IndexWorkSyncTransactionApplicationStressIT method tx.
private static TransactionToApply tx(List<StorageCommand> commands) {
PhysicalTransactionRepresentation txRepresentation = new PhysicalTransactionRepresentation(commands, new byte[0], -1, -1, -1, -1, ANONYMOUS);
TransactionToApply tx = new TransactionToApply(txRepresentation, NULL);
tx.commitment(NO_COMMITMENT, 0);
return tx;
}
use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class ParallelRecoveryVisitor method apply.
private void apply(CommittedTransactionRepresentation transaction) throws Exception {
try (CursorContext cursorContext = new CursorContext(cacheTracer.createPageCursorTracer(tracerTag))) {
TransactionRepresentation txRepresentation = transaction.getTransactionRepresentation();
long txId = transaction.getCommitEntry().getTxId();
TransactionToApply tx = new TransactionToApply(txRepresentation, txId, cursorContext);
tx.commitment(NO_COMMITMENT, txId);
tx.logPosition(transaction.getStartEntry().getStartPosition());
storageEngine.apply(tx, mode);
}
}
Aggregations