Search in sources :

Example 1 with TransactionQueue

use of org.neo4j.kernel.impl.api.TransactionQueue in project neo4j by neo4j.

the class ReplicatedTransactionStateMachine method installCommitProcess.

public synchronized void installCommitProcess(TransactionCommitProcess commitProcess, long lastCommittedIndex) {
    this.lastCommittedIndex = lastCommittedIndex;
    log.info(format("Updated lastCommittedIndex to %d", lastCommittedIndex));
    this.queue = new TransactionQueue(maxBatchSize, (first, last) -> commitProcess.commit(first, CommitEvent.NULL, TransactionApplicationMode.EXTERNAL));
}
Also used : Log(org.neo4j.logging.Log) TransactionRepresentation(org.neo4j.kernel.impl.transaction.TransactionRepresentation) LogProvider(org.neo4j.logging.LogProvider) IOException(java.io.IOException) Result(org.neo4j.causalclustering.core.state.Result) TransactionToApply(org.neo4j.kernel.impl.api.TransactionToApply) String.format(java.lang.String.format) Consumer(java.util.function.Consumer) LogIndexTxHeaderEncoding.encodeLogIndexAsTxHeader(org.neo4j.causalclustering.core.state.machines.tx.LogIndexTxHeaderEncoding.encodeLogIndexAsTxHeader) TransactionCommitProcess(org.neo4j.kernel.impl.api.TransactionCommitProcess) Locks(org.neo4j.kernel.impl.locking.Locks) ReplicatedLockTokenStateMachine(org.neo4j.causalclustering.core.state.machines.locks.ReplicatedLockTokenStateMachine) TransactionFailureException(org.neo4j.kernel.api.exceptions.TransactionFailureException) CommitEvent(org.neo4j.kernel.impl.transaction.tracing.CommitEvent) TransactionApplicationMode(org.neo4j.storageengine.api.TransactionApplicationMode) LockSessionExpired(org.neo4j.kernel.api.exceptions.Status.Transaction.LockSessionExpired) StateMachine(org.neo4j.causalclustering.core.state.machines.StateMachine) TransactionQueue(org.neo4j.kernel.impl.api.TransactionQueue) TransactionQueue(org.neo4j.kernel.impl.api.TransactionQueue)

Example 2 with TransactionQueue

use of org.neo4j.kernel.impl.api.TransactionQueue in project neo4j by neo4j.

the class DefaultRecoverySPI method startRecovery.

@Override
public Visitor<CommittedTransactionRepresentation, Exception> startRecovery() {
    // Calling this method means that recovery is required, tell storage engine about it
    // This method will be called before recovery actually starts and so will ensure that
    // each store is aware that recovery will be performed. At this point all the stores have
    // already started btw.
    // Go and read more at {@link CommonAbstractStore#deleteIdGenerator()}
    storageEngine.prepareForRecoveryRequired();
    transactionsToApply = new TransactionQueue(10_000, (first, last) -> storageEngine.apply(first, RECOVERY));
    recoveryVisitor = new RecoveryVisitor(transactionsToApply);
    return recoveryVisitor;
}
Also used : TransactionIdStore(org.neo4j.kernel.impl.transaction.log.TransactionIdStore) TransactionRepresentation(org.neo4j.kernel.impl.transaction.TransactionRepresentation) LogicalTransactionStore(org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore) StorageEngine(org.neo4j.storageengine.api.StorageEngine) LogVersionRepository(org.neo4j.kernel.impl.transaction.log.LogVersionRepository) IOException(java.io.IOException) LogEntryStart(org.neo4j.kernel.impl.transaction.log.entry.LogEntryStart) IOLimiter(org.neo4j.io.pagecache.IOLimiter) TransactionToApply(org.neo4j.kernel.impl.api.TransactionToApply) CommittedTransactionRepresentation(org.neo4j.kernel.impl.transaction.CommittedTransactionRepresentation) LogPosition(org.neo4j.kernel.impl.transaction.log.LogPosition) TransactionCursor(org.neo4j.kernel.impl.transaction.log.TransactionCursor) RECOVERY(org.neo4j.storageengine.api.TransactionApplicationMode.RECOVERY) Visitor(org.neo4j.helpers.collection.Visitor) NO_COMMITMENT(org.neo4j.kernel.impl.transaction.log.Commitment.NO_COMMITMENT) TransactionQueue(org.neo4j.kernel.impl.api.TransactionQueue) PhysicalLogFiles(org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) TransactionQueue(org.neo4j.kernel.impl.api.TransactionQueue)

Example 3 with TransactionQueue

use of org.neo4j.kernel.impl.api.TransactionQueue in project neo4j by neo4j.

the class BatchingTxApplier method start.

@Override
public void start() {
    stopped = false;
    refreshFromNewStore();
    txQueue = new TransactionQueue(maxBatchSize, (first, last) -> commitProcess.commit(first, NULL, EXTERNAL));
}
Also used : CommittedTransactionRepresentation(org.neo4j.kernel.impl.transaction.CommittedTransactionRepresentation) LifecycleAdapter(org.neo4j.kernel.lifecycle.LifecycleAdapter) TransactionCommitProcess(org.neo4j.kernel.impl.api.TransactionCommitProcess) TransactionIdStore(org.neo4j.kernel.impl.transaction.log.TransactionIdStore) Log(org.neo4j.logging.Log) EXTERNAL(org.neo4j.storageengine.api.TransactionApplicationMode.EXTERNAL) Monitors(org.neo4j.kernel.monitoring.Monitors) LogProvider(org.neo4j.logging.LogProvider) NULL(org.neo4j.kernel.impl.transaction.tracing.CommitEvent.NULL) Supplier(java.util.function.Supplier) TransactionQueue(org.neo4j.kernel.impl.api.TransactionQueue) TransactionToApply(org.neo4j.kernel.impl.api.TransactionToApply) TransactionQueue(org.neo4j.kernel.impl.api.TransactionQueue)

Aggregations

TransactionQueue (org.neo4j.kernel.impl.api.TransactionQueue)3 TransactionToApply (org.neo4j.kernel.impl.api.TransactionToApply)3 IOException (java.io.IOException)2 TransactionCommitProcess (org.neo4j.kernel.impl.api.TransactionCommitProcess)2 CommittedTransactionRepresentation (org.neo4j.kernel.impl.transaction.CommittedTransactionRepresentation)2 TransactionRepresentation (org.neo4j.kernel.impl.transaction.TransactionRepresentation)2 TransactionIdStore (org.neo4j.kernel.impl.transaction.log.TransactionIdStore)2 Log (org.neo4j.logging.Log)2 LogProvider (org.neo4j.logging.LogProvider)2 String.format (java.lang.String.format)1 Consumer (java.util.function.Consumer)1 Supplier (java.util.function.Supplier)1 Result (org.neo4j.causalclustering.core.state.Result)1 StateMachine (org.neo4j.causalclustering.core.state.machines.StateMachine)1 ReplicatedLockTokenStateMachine (org.neo4j.causalclustering.core.state.machines.locks.ReplicatedLockTokenStateMachine)1 LogIndexTxHeaderEncoding.encodeLogIndexAsTxHeader (org.neo4j.causalclustering.core.state.machines.tx.LogIndexTxHeaderEncoding.encodeLogIndexAsTxHeader)1 Visitor (org.neo4j.helpers.collection.Visitor)1 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)1 IOLimiter (org.neo4j.io.pagecache.IOLimiter)1 LockSessionExpired (org.neo4j.kernel.api.exceptions.Status.Transaction.LockSessionExpired)1