Created
March 12, 2019 19:08
-
-
Save ajdavis/2855288b5944700e5093ebe3efbf0a8a to your computer and use it in GitHub Desktop.
Test TransactionParticipant::getOldestActiveTimestamp timeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TimeoutInGetOldestTransactionTimestamp : public MultiDocumentTransactionTest { | |
public: | |
TimeoutInGetOldestTransactionTimestamp() | |
: MultiDocumentTransactionTest("timeoutInGetOldestTransactionTimestamp") {} | |
void run() { | |
auto txnParticipant = TransactionParticipant::get(_opCtx); | |
ASSERT(txnParticipant); | |
AutoGetCollection txns( | |
_opCtx, NamespaceString::kSessionTransactionsTableNamespace, LockMode::MODE_X); | |
auto task = stdx::packaged_task<void()>([=] { | |
TransactionParticipant::getOldestActiveTimestamp(Timestamp(0, 0)); | |
}); | |
auto result = task.get_future(); | |
stdx::thread t(std::move(task)); | |
auto mockClock = | |
static_cast<ClockSourceMock*>(_opCtx->getServiceContext()->getFastClockSource()); | |
mockClock->advance(Seconds(1)); | |
t.join(); | |
result.get(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment