use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class SlaveTransactionCommitProcessTest method mustTranslateIOExceptionsToKernelTransactionFailures.
@Test
public void mustTranslateIOExceptionsToKernelTransactionFailures() throws Exception {
when(master.commit(requestContext, tx)).thenThrow(new IOException());
try {
commitProcess.commit(new TransactionToApply(tx), CommitEvent.NULL, TransactionApplicationMode.INTERNAL);
fail("commit should have thrown");
} catch (TransactionFailureException e) {
assertThat(e.status(), is((Status) Status.Transaction.TransactionCommitFailed));
}
}
use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class RecordStorageEngineTest method newTransactionThatFailsWith.
private static TransactionToApply newTransactionThatFailsWith(Exception error) throws IOException {
TransactionRepresentation transaction = mock(TransactionRepresentation.class);
when(transaction.additionalHeader()).thenReturn(new byte[0]);
// allow to build validated index updates but fail on actual tx application
doThrow(error).when(transaction).accept(any());
long txId = ThreadLocalRandom.current().nextLong(0, 1000);
TransactionToApply txToApply = new TransactionToApply(transaction);
FakeCommitment commitment = new FakeCommitment(txId, mock(TransactionIdStore.class));
commitment.setHasLegacyIndexChanges(false);
txToApply.commitment(commitment, txId);
return txToApply;
}
use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class BatchingTransactionAppenderConcurrencyTest method tx.
protected TransactionToApply tx() {
NodeRecord before = new NodeRecord(0);
NodeRecord after = new NodeRecord(0);
after.setInUse(true);
Command.NodeCommand nodeCommand = new Command.NodeCommand(before, after);
PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation(asList((Command) nodeCommand));
tx.setHeader(new byte[0], 0, 0, 0, 0, 0, 0);
return new TransactionToApply(tx);
}
use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class IndexWorkSyncTransactionApplicationStressIT method tx.
private static TransactionToApply tx(Collection<StorageCommand> commands) {
TransactionToApply tx = new TransactionToApply(transactionRepresentation(commands));
tx.commitment(NO_COMMITMENT, 0);
return tx;
}
use of org.neo4j.kernel.impl.api.TransactionToApply in project neo4j by neo4j.
the class PhysicalLogicalTransactionStoreTest method addATransactionAndRewind.
private void addATransactionAndRewind(LifeSupport life, LogFile logFile, TransactionMetadataCache positionCache, TransactionIdStore transactionIdStore, byte[] additionalHeader, int masterId, int authorId, long timeStarted, long latestCommittedTxWhenStarted, long timeCommitted) throws IOException {
TransactionAppender appender = life.add(new BatchingTransactionAppender(logFile, NO_ROTATION, positionCache, transactionIdStore, BYPASS, DATABASE_HEALTH));
PhysicalTransactionRepresentation transaction = new PhysicalTransactionRepresentation(singleCreateNodeCommand());
transaction.setHeader(additionalHeader, masterId, authorId, timeStarted, latestCommittedTxWhenStarted, timeCommitted, -1);
appender.append(new TransactionToApply(transaction), LogAppendEvent.NULL);
}
Aggregations