@Test void terminateExpiredTransactions() { HashSet<KernelTransactionHandle> transactions = new HashSet<>(); KernelTransactionImplementation tx1 = prepareTxMock( 3, 1, 3 ); KernelTransactionImplementation tx2 = prepareTxMock( 4, 1, 8 ); KernelTransactionImplementationHandle handle1 = new KernelTransactionImplementationHandle( tx1, fakeClock ); KernelTransactionImplementationHandle handle2 = new KernelTransactionImplementationHandle( tx2, fakeClock ); transactions.add( handle1 ); transactions.add( handle2 ); when( kernelTransactions.activeTransactions()).thenReturn( transactions ); KernelTransactionMonitor transactionMonitor = buildTransactionMonitor(); fakeClock.forward( 3, TimeUnit.MILLISECONDS ); transactionMonitor.run(); verify( tx1, never() ).markForTermination( Status.Transaction.TransactionTimedOut ); verify( tx2, never() ).markForTermination( Status.Transaction.TransactionTimedOut ); logProvider.assertNoMessagesContaining( "timeout" ); fakeClock.forward( 2, TimeUnit.MILLISECONDS ); transactionMonitor.run(); verify( tx1 ).markForTermination( EXPECTED_REUSE_COUNT, Status.Transaction.TransactionTimedOut ); verify( tx2, never() ).markForTermination( Status.Transaction.TransactionTimedOut ); logProvider.assertContainsLogCallContaining( "timeout" ); logProvider.clear(); fakeClock.forward( 10, TimeUnit.MILLISECONDS ); transactionMonitor.run(); verify( tx2 ).markForTermination( EXPECTED_REUSE_COUNT, Status.Transaction.TransactionTimedOut ); logProvider.assertContainsLogCallContaining( "timeout" ); }
when( storeView.indexSample( anyLong(), any( DoubleLongRegister.class ) ) ).thenReturn( newDoubleLongRegister( 32L, 32L ) ); internalLogProvider.clear();
internalLogProvider.clear(); indexingService.start();
userLogProvider.clear(); indexingService.start();
internalLogProvider.clear(); indexingService.start();
@Test public void shouldStopConnectionsWhenRelatedJobIsRejectedOnShutdown() throws Throwable { // Connect and get two connections into idle state connection1 = enterStreaming(); exitStreaming( connection1 ); connection2 = enterStreaming(); exitStreaming( connection2 ); // Connect and get other set of connections to keep threads busy connection3 = enterStreaming(); connection4 = enterStreaming(); // Clear any log output till now internalLogProvider.clear(); // Shutdown the server server.shutdownDatabase(); // Expect no scheduling error logs userLogProvider.assertNoLogCallContaining( "since there are no available threads to serve it at the moment. You can retry at a later time" ); internalLogProvider.assertNoLogCallContaining( "since there are no available threads to serve it at the moment. You can retry at a later time" ); }