Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerOnTransactionCountWhenCountIsBellowThreshold()
        public virtual void MustNotTriggerOnTransactionCountWhenCountIsBellowThreshold()
        {
            WithIntervalTx(2);
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            assertFalse(threshold.IsCheckPointingNeeded(3, NotTriggered));
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerBeforeTimeWithTooFewCommittedTransactions()
        public virtual void MustNotTriggerBeforeTimeWithTooFewCommittedTransactions()
        {
            WithIntervalTime("100ms");
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            Clock.forward(50, MILLISECONDS);
            assertFalse(threshold.IsCheckPointingNeeded(42, NotTriggered));
        }
Exemple #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerWhenTransactionCountIsWithinThresholdSinceLastTrigger()
        public virtual void MustNotTriggerWhenTransactionCountIsWithinThresholdSinceLastTrigger()
        {
            WithIntervalTx(2);
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            threshold.CheckPointHappened(4);
            assertFalse(threshold.IsCheckPointingNeeded(5, NotTriggered));
        }
Exemple #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerOnTransactionCountAtThresholdIfCheckPointAlreadyHappened()
        public virtual void MustNotTriggerOnTransactionCountAtThresholdIfCheckPointAlreadyHappened()
        {
            WithIntervalTx(2);
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            threshold.CheckPointHappened(4);
            assertFalse(threshold.IsCheckPointingNeeded(4, NotTriggered));
        }
Exemple #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustTriggerOnTransactionCountWhenCountIsAtThreshold()
        public virtual void MustTriggerOnTransactionCountWhenCountIsAtThreshold()
        {
            WithIntervalTx(2);
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            assertTrue(threshold.IsCheckPointingNeeded(4, Triggered));
            VerifyTriggered("count");
            VerifyNoMoreTriggers();
        }
Exemple #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerWhenTimeThresholdIsReachedAndThereAreNoCommittedTransactions()
        public virtual void MustNotTriggerWhenTimeThresholdIsReachedAndThereAreNoCommittedTransactions()
        {
            WithIntervalTime("100ms");
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(42);

            Clock.forward(199, MILLISECONDS);

            assertFalse(threshold.IsCheckPointingNeeded(42, NotTriggered));
            VerifyNoMoreTriggers();
        }
Exemple #7
0
 public CheckPointerImpl(TransactionIdStore transactionIdStore, CheckPointThreshold threshold, StorageEngine storageEngine, LogPruning logPruning, TransactionAppender appender, DatabaseHealth databaseHealth, LogProvider logProvider, CheckPointTracer tracer, IOLimiter ioLimiter, StoreCopyCheckPointMutex mutex)
 {
     this._appender           = appender;
     this._transactionIdStore = transactionIdStore;
     this._threshold          = threshold;
     this._storageEngine      = storageEngine;
     this._logPruning         = logPruning;
     this._databaseHealth     = databaseHealth;
     this._ioLimiter          = ioLimiter;
     this._msgLog             = logProvider.GetLog(typeof(CheckPointerImpl));
     this._tracer             = tracer;
     this._mutex = mutex;
 }
Exemple #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustNotTriggerPastTimeThresholdSinceLastCheckpointWithNoNewTransactions()
        public virtual void MustNotTriggerPastTimeThresholdSinceLastCheckpointWithNoNewTransactions()
        {
            WithIntervalTime("100ms");
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(2);

            Clock.forward(199, MILLISECONDS);
            threshold.CheckPointHappened(42);
            Clock.forward(100, MILLISECONDS);

            assertFalse(threshold.IsCheckPointingNeeded(42, NotTriggered));
            VerifyNoMoreTriggers();
        }
Exemple #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustCreateThresholdThatTriggersAfterTransactionCount()
        public virtual void MustCreateThresholdThatTriggersAfterTransactionCount()
        {
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(1);                 // Initialise at transaction id offset by 1.

            // False because we're not yet at threshold.
            assertFalse(threshold.IsCheckPointingNeeded(IntervalTx - 1, NotTriggered));
            // Still false because the counter is offset by one, since we initialised with 1.
            assertFalse(threshold.IsCheckPointingNeeded(IntervalTx, NotTriggered));
            // True because new we're at intervalTx + initial offset.
            assertTrue(threshold.IsCheckPointingNeeded(IntervalTx + 1, Triggered));
            VerifyTriggered("count");
            VerifyNoMoreTriggers();
        }
Exemple #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustCreateThresholdThatTriggersAfterTime()
        public virtual void MustCreateThresholdThatTriggersAfterTime()
        {
            CheckPointThreshold threshold = CreateThreshold();

            threshold.Initialize(1);
            // Skip the initial wait period.
            Clock.forward(IntervalTime.toMillis(), MILLISECONDS);
            // The clock will trigger at a random point within the interval in the future.

            // False because we haven't moved the clock, or the transaction count.
            assertFalse(threshold.IsCheckPointingNeeded(2, NotTriggered));
            // True because we now moved forward by an interval.
            Clock.forward(IntervalTime.toMillis(), MILLISECONDS);
            assertTrue(threshold.IsCheckPointingNeeded(4, Triggered));
            VerifyTriggered("time");
            VerifyNoMoreTriggers();
        }
 protected internal virtual CheckPointThreshold CreateThreshold()
 {
     return(CheckPointThreshold.createThreshold(Config, Clock, LogPruning, LogProvider));
 }