use of org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore in project neo4j by neo4j.
the class HighlyAvailableEditionModule method assureLastCommitTimestampInitialized.
private static void assureLastCommitTimestampInitialized(DependencyResolver resolver) {
MetaDataStore metaDataStore = resolver.resolveDependency(MetaDataStore.class);
LogicalTransactionStore txStore = resolver.resolveDependency(LogicalTransactionStore.class);
TransactionId txInfo = metaDataStore.getLastCommittedTransaction();
long lastCommitTimestampFromStore = txInfo.commitTimestamp();
if (txInfo.transactionId() == TransactionIdStore.BASE_TX_ID) {
metaDataStore.setLastTransactionCommitTimestamp(TransactionIdStore.BASE_TX_COMMIT_TIMESTAMP);
return;
}
if (lastCommitTimestampFromStore == TransactionIdStore.UNKNOWN_TX_COMMIT_TIMESTAMP || lastCommitTimestampFromStore == TransactionIdStore.BASE_TX_COMMIT_TIMESTAMP) {
long lastCommitTimestampFromLogs;
try {
TransactionMetadata metadata = txStore.getMetadataFor(txInfo.transactionId());
lastCommitTimestampFromLogs = metadata.getTimeWritten();
} catch (NoSuchTransactionException e) {
lastCommitTimestampFromLogs = TransactionIdStore.UNKNOWN_TX_COMMIT_TIMESTAMP;
} catch (IOException e) {
throw new IllegalStateException("Unable to read transaction logs", e);
}
metaDataStore.setLastTransactionCommitTimestamp(lastCommitTimestampFromLogs);
}
}
use of org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore in project neo4j by neo4j.
the class LabelAndIndexUpdateBatchingIT method extractTransactions.
private static List<TransactionRepresentation> extractTransactions(GraphDatabaseAPI db) throws NoSuchTransactionException, 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;
}
Aggregations