public override TransactionApplier StartTx(CommandsToApply transaction)
        {
            Optional <CountsAccessor_Updater> result = _countsTracker.apply(transaction.TransactionId());

            result.ifPresent(updater => this._countsUpdater = updater);
            Debug.Assert(this._countsUpdater != null || _mode == TransactionApplicationMode.RECOVERY);

            return(new CountsStoreTransactionApplier(_mode, _countsUpdater));
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public TransactionApplier startTx(org.neo4j.storageengine.api.CommandsToApply transaction) throws java.io.IOException
        public override TransactionApplier StartTx(CommandsToApply transaction)
        {
            long activeTransactionId = transaction.TransactionId();

            try
            {
                // Cache transactionApplier because it has some expensive lookups
                if (_txApplier == null)
                {
                    _txApplier = new ExplicitIndexTransactionApplier(_applierLookup, _indexConfigStore, _mode, _transactionOrdering);
                }

                if (transaction.RequiresApplicationOrdering())
                {
                    // Index operations must preserve order so wait for previous tx to finish
                    _transactionOrdering.waitFor(activeTransactionId);
                    // And set current tx so we can notify the next transaction when we are finished
                    if (transaction.Next() != null)
                    {
                        // Let each transaction notify the next
                        _txApplier.TransactionId = activeTransactionId;
                    }
                    else
                    {
                        // except the last transaction, which notifies that it is done after appliers have been closed
                        _lastTransactionId = activeTransactionId;
                    }
                }

                return(_txApplier);
            }
            catch (InterruptedException e)
            {
                Thread.CurrentThread.Interrupt();
                throw new IOException("Interrupted while waiting for applying tx:" + activeTransactionId + " explicit index updates", e);
            }
        }
Exemplo n.º 3
0
 public override TransactionApplier StartTx(CommandsToApply transaction, LockGroup lockGroup)
 {
     return(new NeoStoreTransactionApplier(_version, _neoStores, _cacheAccess, _lockService, transaction.TransactionId(), lockGroup));
 }
Exemplo n.º 4
0
 public override TransactionApplier StartTx(CommandsToApply transaction)
 {
     _txId = transaction.TransactionId();
     return(_transactionApplier);
 }