Skip to content

Commit

Permalink
Multiply by 2 to make it more readable
Browse files Browse the repository at this point in the history
(cherry picked from commit 916f28d)
  • Loading branch information
MishaDemianenko committed Oct 3, 2017
1 parent 97275fa commit 07ebc3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -143,7 +143,9 @@ private void initProgressReporter( RecoveryStartInformation recoveryStartInforma
{ {
long numberOfTransactionToRecover = long numberOfTransactionToRecover =
getNumberOfTransactionToRecover( recoveryStartInformation, lastReversedTransaction ); getNumberOfTransactionToRecover( recoveryStartInformation, lastReversedTransaction );
progressReporter.start( numberOfTransactionToRecover << 1 ); // since we will process each transaction twice (doing reverse and direct detour) we need to
// multiply number of transactions that we want to recover by 2 to be able to report correct progress
progressReporter.start( numberOfTransactionToRecover * 2 );
} }


private void reportProgress() private void reportProgress()
Expand Down
Expand Up @@ -42,9 +42,9 @@ public class RecoveryProgressIndicatorTest
@Test @Test
public void reportProgressOnRecovery() throws Throwable public void reportProgressOnRecovery() throws Throwable
{ {
RecoveryService recoveryService = mock( RecoveryService.class, Answers.RETURNS_MOCKS.get() ); RecoveryService recoveryService = mock( RecoveryService.class, Answers.RETURNS_MOCKS );
StartupStatisticsProvider statisticsProvider = mock( StartupStatisticsProvider.class ); StartupStatisticsProvider statisticsProvider = mock( StartupStatisticsProvider.class );
TransactionLogPruner logPruner = mock( TransactionLogPruner.class ); CorruptedLogsTruncator logsTruncator = mock( CorruptedLogsTruncator.class );
RecoveryMonitor recoveryMonitor = mock( RecoveryMonitor.class ); RecoveryMonitor recoveryMonitor = mock( RecoveryMonitor.class );
TransactionCursor reverseTransactionCursor = mock( TransactionCursor.class ); TransactionCursor reverseTransactionCursor = mock( TransactionCursor.class );
TransactionCursor transactionCursor = mock( TransactionCursor.class ); TransactionCursor transactionCursor = mock( TransactionCursor.class );
Expand All @@ -68,7 +68,7 @@ public void reportProgressOnRecovery() throws Throwable
when( recoveryService.getTransactions( recoveryStartPosition ) ).thenReturn( transactionCursor ); when( recoveryService.getTransactions( recoveryStartPosition ) ).thenReturn( transactionCursor );


AssertableProgressReporter progressReporter = new AssertableProgressReporter( expectedMax ); AssertableProgressReporter progressReporter = new AssertableProgressReporter( expectedMax );
Recovery recovery = new Recovery( recoveryService, statisticsProvider, logPruner, recoveryMonitor, Recovery recovery = new Recovery( recoveryService, statisticsProvider, logsTruncator, recoveryMonitor,
progressReporter, true ); progressReporter, true );
recovery.init(); recovery.init();


Expand Down

0 comments on commit 07ebc3b

Please sign in to comment.