public override long Append(TransactionToApply batch, LogAppendEvent logAppendEvent)
        {
            long txId = TransactionIdStore_Fields.BASE_TX_ID;

            while (batch != null)
            {
                txId = _transactionIdStore.nextCommittingTransactionId();
                batch.Commitment(new FakeCommitment(txId, _transactionIdStore), txId);
                batch.Commitment().publishAsCommitted();
                batch = batch.Next();
            }
            return(txId);
        }
        private void TriggerEvent(DefaultTransactionTracer tracer, int eventDuration)
        {
            using (TransactionEvent txEvent = tracer.BeginTransaction())
            {
                using (CommitEvent commitEvent = txEvent.BeginCommitEvent())
                {
                    using (LogAppendEvent logAppendEvent = commitEvent.BeginLogAppend())
                    {
                        _clock.forward(ThreadLocalRandom.current().nextLong(200), TimeUnit.MILLISECONDS);
                        using (LogRotateEvent @event = logAppendEvent.BeginLogRotate())
                        {
                            _clock.forward(eventDuration, TimeUnit.MILLISECONDS);
                        }
                    }
                }
            }

            _jobScheduler.runJob();
        }
예제 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean rotateLogIfNeeded(org.neo4j.kernel.impl.transaction.tracing.LogAppendEvent logAppendEvent) throws java.io.IOException
        public override bool RotateLogIfNeeded(LogAppendEvent logAppendEvent)
        {
            /* We synchronize on the writer because we want to have a monitor that another thread
             * doing force (think batching of writes), such that it can't see a bad state of the writer
             * even when rotating underlying channels.
             */
            if (_logFile.rotationNeeded())
            {
                lock ( _logFile )
                {
                    if (_logFile.rotationNeeded())
                    {
                        using (LogRotateEvent rotateEvent = logAppendEvent.BeginLogRotate())
                        {
                            DoRotate();
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }