@Override public TransactionCursor getTransactions( long transactionIdToStartFrom ) throws IOException { return physicalStore.getTransactions( transactionIdToStartFrom ); }
@Override public TransactionMetadata getMetadataFor( long transactionId ) throws IOException { return physicalStore.getMetadataFor( transactionId ); }
@Override public TransactionCursor getTransactionsInReverseOrder( LogPosition backToPosition ) throws IOException { return physicalStore.getTransactionsInReverseOrder( backToPosition ); }
private void verifyTransaction( TransactionIdStore transactionIdStore, TransactionMetadataCache positionCache, byte[] additionalHeader, int masterId, int authorId, long timeStarted, long latestCommittedTxWhenStarted, long timeCommitted, LogicalTransactionStore store ) throws IOException { TransactionMetadata expectedMetadata; try ( TransactionCursor cursor = store.getTransactions( TransactionIdStore.BASE_TX_ID + 1 ) ) { boolean hasNext = cursor.next(); assertTrue( hasNext ); CommittedTransactionRepresentation tx = cursor.get(); TransactionRepresentation transaction = tx.getTransactionRepresentation(); assertArrayEquals( additionalHeader, transaction.additionalHeader() ); assertEquals( masterId, transaction.getMasterId() ); assertEquals( authorId, transaction.getAuthorId() ); assertEquals( timeStarted, transaction.getTimeStarted() ); assertEquals( timeCommitted, transaction.getTimeCommitted() ); assertEquals( latestCommittedTxWhenStarted, transaction.getLatestCommittedTxWhenStarted() ); expectedMetadata = new TransactionMetadata( masterId, authorId, tx.getStartEntry().getStartPosition(), tx.getStartEntry().checksum(), timeCommitted ); } positionCache.clear(); TransactionMetadata actualMetadata = store.getMetadataFor( transactionIdStore.getLastCommittedTransactionId() ); assertEquals( expectedMetadata, actualMetadata ); }
@Override public TransactionCursor getTransactions( LogPosition position ) throws IOException { return physicalStore.getTransactions( position ); }
@Override public TransactionCursor getTransactionsInReverseOrder( LogPosition position ) throws IOException { return logicalTransactionStore.getTransactionsInReverseOrder( position ); }
@Test public void shouldThrowNoSuchTransactionExceptionIfMetadataNotFound() throws Exception { // GIVEN LogFiles logFiles = mock( LogFiles.class ); TransactionMetadataCache cache = new TransactionMetadataCache(); LifeSupport life = new LifeSupport(); final LogicalTransactionStore txStore = new PhysicalLogicalTransactionStore( logFiles, cache, new VersionAwareLogEntryReader<>(), monitors, true ); try { life.start(); // WHEN try { txStore.getMetadataFor( 10 ); fail( "Should have thrown" ); } catch ( NoSuchTransactionException e ) { // THEN Good } } finally { life.shutdown(); } }
@Override public TransactionCursor getTransactions( LogPosition position ) throws IOException { return logicalTransactionStore.getTransactions( position ); }
@Override public TransactionCursor getTransactionsInReverseOrder( LogPosition position ) throws IOException { return txStore.getTransactionsInReverseOrder( position ); }
@Override public TransactionMetadata getMetadataFor( long transactionId ) throws IOException { return physicalStore.getMetadataFor( transactionId ); }
@Override public TransactionCursor getTransactions( LogPosition position ) throws IOException { return txStore.getTransactions( position ); }
@Override public TransactionCursor getTransactionsInReverseOrder( LogPosition position ) throws IOException { return logicalTransactionStore.getTransactionsInReverseOrder( position ); }
private static List<TransactionRepresentation> extractTransactions( GraphDatabaseAPI db ) throws IOException { LogicalTransactionStore txStore = db.getDependencyResolver().resolveDependency( LogicalTransactionStore.class ); List<TransactionRepresentation> transactions = new ArrayList<>(); try ( TransactionCursor cursor = txStore.getTransactions( TransactionIdStore.BASE_TX_ID + 1 ) ) { cursor.forAll( tx -> transactions.add( tx.getTransactionRepresentation() ) ); } return transactions; } }
@Override public TransactionCursor getTransactionsInReverseOrder( LogPosition backToPosition ) throws IOException { return physicalStore.getTransactionsInReverseOrder( backToPosition ); }
private static CommittedTransactionRepresentation extractLastTransaction( GraphDatabaseAPI db ) throws IOException { LogicalTransactionStore txStore = db.getDependencyResolver().resolveDependency( LogicalTransactionStore.class ); CommittedTransactionRepresentation transaction = null; try ( TransactionCursor cursor = txStore.getTransactions( TransactionIdStore.BASE_TX_ID + 1 ) ) { while ( cursor.next() ) { transaction = cursor.get(); } } return transaction; }
txStore.getTransactions( 10 ); fail();
private static List<TransactionRepresentation> createConstraintCreatingTransactions() throws Exception { GraphDatabaseAPI db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabase(); try { try ( Transaction tx = db.beginTx() ) { db.schema().constraintFor( LABEL ).assertPropertyIsUnique( KEY ).create(); tx.success(); } LogicalTransactionStore txStore = db.getDependencyResolver().resolveDependency( LogicalTransactionStore.class ); List<TransactionRepresentation> result = new ArrayList<>(); try ( TransactionCursor cursor = txStore.getTransactions( TransactionIdStore.BASE_TX_ID + 1 ) ) { while ( cursor.next() ) { result.add( cursor.get().getTransactionRepresentation() ); } } return result; } finally { db.shutdown(); } } }
@Override public TransactionCursor getTransactions( LogPosition position ) throws IOException { return physicalStore.getTransactions( position ); }
@Override public TransactionCursor getTransactions( long transactionIdToStartFrom ) throws IOException { return physicalStore.getTransactions( transactionIdToStartFrom ); }
@Override public TransactionCursor getTransactions( LogPosition position ) throws IOException { return logicalTransactionStore.getTransactions( position ); }