summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@10gen.com>2019-03-12 18:18:13 -0400
committerVesselina Ratcheva <vesselina.ratcheva@10gen.com>2019-03-28 13:19:50 -0400
commit62599f7cc9c1e7478eac80c5beedfc61e6f68408 (patch)
tree8d470f27603042ad47eff846cf0b4ca4fb4599ad /src/mongo
parent7eeda289a244e60154b9e969398bf5140ade1b78 (diff)
downloadmongo-62599f7cc9c1e7478eac80c5beedfc61e6f68408.tar.gz
SERVER-39989 Use a config.transactions find command for the begin fetching optime in initial sync
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/repl/SConscript1
-rw-r--r--src/mongo/db/repl/initial_syncer.cpp88
-rw-r--r--src/mongo/db/repl/initial_syncer.h27
-rw-r--r--src/mongo/db/repl/initial_syncer_test.cpp556
4 files changed, 395 insertions, 277 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 15a21c4fe4a..9faed308ad6 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -1529,6 +1529,7 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/client/fetcher',
+ '$BUILD_DIR/mongo/db/transaction',
'$BUILD_DIR/mongo/db/commands/server_status_core',
'collection_cloner',
'database_cloner',
diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp
index b074341d4a3..b41a20510c6 100644
--- a/src/mongo/db/repl/initial_syncer.cpp
+++ b/src/mongo/db/repl/initial_syncer.cpp
@@ -58,6 +58,7 @@
#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/repl/sync_source_selector.h"
+#include "mongo/db/session_txn_record_gen.h"
#include "mongo/executor/task_executor.h"
#include "mongo/executor/thread_pool_task_executor.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
@@ -306,6 +307,7 @@ void InitialSyncer::_cancelRemainingWork_inlock() {
_shutdownComponent_inlock(_applier);
_shutdownComponent_inlock(_fCVFetcher);
_shutdownComponent_inlock(_lastOplogEntryFetcher);
+ _shutdownComponent_inlock(_beginFetchingOpTimeFetcher);
}
void InitialSyncer::join() {
@@ -644,21 +646,44 @@ Status InitialSyncer::_truncateOplogAndDropReplicatedDatabases() {
Status InitialSyncer::_scheduleGetBeginFetchingOpTime_inlock(
std::shared_ptr<OnCompletionGuard> onCompletionGuard) {
- // We will ultimately be getting oldestActiveOplogEntryOpTime from the transactions field in
- // serverStatus to use as the beginFetchingTimestamp. Also, we project out the metrics and
- // wiredTiger fields because we don't need them and they're very large.
- executor::RemoteCommandRequest request(
- _syncSource,
- "admin",
- BSON("serverStatus" << 1 << "transactions" << 1 << "metrics" << 0 << "wiredTiger" << 0),
- nullptr);
-
- auto scheduleResultSW = _exec->scheduleRemoteCommand(
- request, [=](const executor::TaskExecutor::RemoteCommandCallbackArgs& callbackData) {
- _getBeginFetchingOpTimeCallback(callbackData.response, onCompletionGuard);
- });
- return scheduleResultSW.getStatus();
+ const auto preparedState = DurableTxnState_serializer(DurableTxnStateEnum::kPrepared);
+ const auto inProgressState = DurableTxnState_serializer(DurableTxnStateEnum::kInProgress);
+
+ // Obtain the oldest active transaction timestamp from the remote by querying their
+ // transactions table.
+ BSONObjBuilder cmd;
+ cmd.append("find", NamespaceString::kSessionTransactionsTableNamespace.coll().toString());
+ cmd.append("filter",
+ BSON("state" << BSON("$in" << BSON_ARRAY(preparedState << inProgressState))));
+ cmd.append("sort", BSON(SessionTxnRecord::kStartOpTimeFieldName << 1));
+ cmd.append("readConcern",
+ BSON("level"
+ << "local"));
+ cmd.append("limit", 1);
+
+ _beginFetchingOpTimeFetcher = stdx::make_unique<Fetcher>(
+ _exec,
+ _syncSource,
+ NamespaceString::kSessionTransactionsTableNamespace.db().toString(),
+ cmd.obj(),
+ [=](const StatusWith<mongo::Fetcher::QueryResponse>& response,
+ mongo::Fetcher::NextAction*,
+ mongo::BSONObjBuilder*) mutable {
+ _getBeginFetchingOpTimeCallback(response, onCompletionGuard);
+ },
+ ReadPreferenceSetting::secondaryPreferredMetadata(),
+ RemoteCommandRequest::kNoTimeout /* find network timeout */,
+ RemoteCommandRequest::kNoTimeout /* getMore network timeout */,
+ RemoteCommandRetryScheduler::makeRetryPolicy(
+ numInitialSyncOplogFindAttempts.load(),
+ executor::RemoteCommandRequest::kNoTimeout,
+ RemoteCommandRetryScheduler::kAllRetriableErrors));
+ Status scheduleStatus = _beginFetchingOpTimeFetcher->schedule();
+ if (!scheduleStatus.isOK()) {
+ _beginFetchingOpTimeFetcher.reset();
+ }
+ return scheduleStatus;
}
void InitialSyncer::_rollbackCheckerResetCallback(
@@ -679,24 +704,42 @@ void InitialSyncer::_rollbackCheckerResetCallback(
}
void InitialSyncer::_getBeginFetchingOpTimeCallback(
- const executor::TaskExecutor::ResponseStatus& response,
+ const StatusWith<Fetcher::QueryResponse>& result,
std::shared_ptr<OnCompletionGuard> onCompletionGuard) {
stdx::unique_lock<stdx::mutex> lock(_mutex);
auto status = _checkForShutdownAndConvertStatus_inlock(
- response.status,
+ result.getStatus(),
"error while getting oldest active transaction timestamp for begin fetching timestamp");
if (!status.isOK()) {
onCompletionGuard->setResultAndCancelRemainingWork_inlock(lock, status);
return;
}
- invariant(response.data.hasField("transactions"));
+ const auto docs = result.getValue().documents;
+ if (docs.size() > 1) {
+ onCompletionGuard->setResultAndCancelRemainingWork_inlock(
+ lock,
+ Status(ErrorCodes::TooManyMatchingDocuments,
+ str::stream() << "Expected to receive one document for the oldest active "
+ "transaction entry, but received: "
+ << docs.size()
+ << ". First: "
+ << redact(docs.front())
+ << ". Last: "
+ << redact(docs.back())));
+ return;
+ }
- // Only set beginFetchingOpTime if the oldestActiveOplogEntryTimestamp actually exists.
+ // Only set beginFetchingOpTime if the oldestActiveOplogEntryOpTime actually exists.
OpTime beginFetchingOpTime = OpTime();
- if (response.data["transactions"].embeddedObject().hasField("oldestActiveOplogEntryOpTime")) {
- beginFetchingOpTime = repl::OpTime::parse(
- response.data["transactions"]["oldestActiveOplogEntryOpTime"].Obj());
+ if (docs.size() != 0) {
+ auto entry = SessionTxnRecord::parse(
+ IDLParserErrorContext("oldest active transaction optime for initial sync"),
+ docs.front());
+ auto optime = entry.getStartOpTime();
+ if (optime) {
+ beginFetchingOpTime = optime.get();
+ }
}
status = _scheduleLastOplogEntryFetcher_inlock(
@@ -788,7 +831,8 @@ void InitialSyncer::_fcvFetcherCallback(const StatusWith<Fetcher::QueryResponse>
onCompletionGuard->setResultAndCancelRemainingWork_inlock(
lock,
Status(ErrorCodes::TooManyMatchingDocuments,
- str::stream() << "Expected to receive one document, but received: "
+ str::stream() << "Expected to receive one feature compatibility version "
+ "document, but received: "
<< docs.size()
<< ". First: "
<< redact(docs.front())
diff --git a/src/mongo/db/repl/initial_syncer.h b/src/mongo/db/repl/initial_syncer.h
index 31c4790feb7..75c417789dd 100644
--- a/src/mongo/db/repl/initial_syncer.h
+++ b/src/mongo/db/repl/initial_syncer.h
@@ -302,7 +302,7 @@ private:
* |
* |
* V
- * _getBeginFetchingTimestampCallback()
+ * _getBeginFetchingOpTimeCallback()
* |
* |
* V
@@ -420,7 +420,7 @@ private:
* serverStatus response, which refers to the optime of the oldest active transaction with an
* oplog entry. It will be used as the beginFetchingTimestamp.
*/
- void _getBeginFetchingOpTimeCallback(const executor::TaskExecutor::ResponseStatus& response,
+ void _getBeginFetchingOpTimeCallback(const StatusWith<Fetcher::QueryResponse>& result,
std::shared_ptr<OnCompletionGuard> onCompletionGuard);
/**
@@ -643,17 +643,18 @@ private:
// Handle to currently scheduled _getNextApplierBatchCallback() task.
executor::TaskExecutor::CallbackHandle _getNextApplierBatchHandle; // (M)
- std::unique_ptr<InitialSyncState> _initialSyncState; // (M)
- std::unique_ptr<OplogFetcher> _oplogFetcher; // (S)
- std::unique_ptr<Fetcher> _lastOplogEntryFetcher; // (S)
- std::unique_ptr<Fetcher> _fCVFetcher; // (S)
- std::unique_ptr<MultiApplier> _applier; // (M)
- HostAndPort _syncSource; // (M)
- OpTime _lastFetched; // (MX)
- OpTimeAndWallTime _lastApplied; // (MX)
- std::unique_ptr<OplogBuffer> _oplogBuffer; // (M)
- std::unique_ptr<OplogApplier::Observer> _observer; // (S)
- std::unique_ptr<OplogApplier> _oplogApplier; // (M)
+ std::unique_ptr<InitialSyncState> _initialSyncState; // (M)
+ std::unique_ptr<OplogFetcher> _oplogFetcher; // (S)
+ std::unique_ptr<Fetcher> _beginFetchingOpTimeFetcher; // (S)
+ std::unique_ptr<Fetcher> _lastOplogEntryFetcher; // (S)
+ std::unique_ptr<Fetcher> _fCVFetcher; // (S)
+ std::unique_ptr<MultiApplier> _applier; // (M)
+ HostAndPort _syncSource; // (M)
+ OpTime _lastFetched; // (MX)
+ OpTimeAndWallTime _lastApplied; // (MX)
+ std::unique_ptr<OplogBuffer> _oplogBuffer; // (M)
+ std::unique_ptr<OplogApplier::Observer> _observer; // (S)
+ std::unique_ptr<OplogApplier> _oplogApplier; // (M)
// Used to signal changes in _state.
mutable stdx::condition_variable _stateCondition;
diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp
index 48b134eda45..ca111c8c9a1 100644
--- a/src/mongo/db/repl/initial_syncer_test.cpp
+++ b/src/mongo/db/repl/initial_syncer_test.cpp
@@ -510,14 +510,6 @@ BSONObj makeRollbackCheckerResponse(int rollbackId) {
}
/**
- * Generates a serverStatus response with an 'oldestActiveOplogEntryOpTime' field.
- */
-BSONObj makeServerStatusResponse(OpTime oldestActiveTxnOpTime) {
- return BSON("ok" << 1 << "transactions"
- << BSON("oldestActiveOplogEntryOpTime" << oldestActiveTxnOpTime));
-}
-
-/**
* Generates a cursor response for a Fetcher to consume.
*/
RemoteCommandResponse makeCursorResponse(CursorId cursorId,
@@ -1170,19 +1162,21 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughRollbackCheckerCallbackError
ASSERT_EQUALS(ErrorCodes::OperationFailed, _lastApplied);
}
-TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetBeginFetchingTimestampScheduleError) {
+TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetBeginFetchingOpTimeScheduleError) {
auto initialSyncer = &getInitialSyncer();
auto opCtx = makeOpCtx();
- // Getting the begin fetching timestamp is the only time a serverStatus command is sent, so we
- // reject the serverStatus command and save the request for inspection at the end of this test
- // case.
+ // We reject the 'find' command for the begin fetching optime and save the request for
+ // inspection at the end of this test case.
executor::RemoteCommandRequest request;
- _executorProxy->shouldFailScheduleRemoteCommandRequest =
- [&request](const executor::RemoteCommandRequest& requestToSend) {
- request = requestToSend;
- return "serverStatus" == requestToSend.cmdObj.firstElement().fieldNameStringData();
- };
+ _executorProxy->shouldFailScheduleRemoteCommandRequest = [&request](
+ const executor::RemoteCommandRequest& requestToSend) {
+ request = requestToSend;
+ auto elem = requestToSend.cmdObj.firstElement();
+ return (
+ ("find" == elem.fieldNameStringData()) &&
+ (NamespaceString::kSessionTransactionsTableNamespace.coll() == elem.valueStringData()));
+ };
HostAndPort syncSource("localhost", 12345);
_syncSourceSelector->setChooseNewSyncSourceResult_forTest(syncSource);
@@ -1201,11 +1195,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetBeginFetchingTimestampSch
ASSERT_EQUALS(ErrorCodes::OperationFailed, _lastApplied);
ASSERT_EQUALS(syncSource, request.target);
- ASSERT_EQUALS(NamespaceString::kAdminDb, request.dbname);
- assertRemoteCommandNameEquals("serverStatus", request);
+ ASSERT_EQUALS(NamespaceString::kConfigDb, request.dbname);
+ assertRemoteCommandNameEquals("find", request);
}
-TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetBeginFetchingTimestampCallbackError) {
+TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetBeginFetchingOpTimeCallbackError) {
auto initialSyncer = &getInitialSyncer();
auto opCtx = makeOpCtx();
@@ -1221,9 +1215,9 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetBeginFetchingTimestampCal
net->runReadyNetworkOperations();
assertRemoteCommandNameEquals(
- "serverStatus",
+ "find",
net->scheduleErrorResponse(
- Status(ErrorCodes::OperationFailed, "serverStatus command failed at sync source")));
+ Status(ErrorCodes::OperationFailed, "find command failed at sync source")));
net->runReadyNetworkOperations();
}
@@ -1231,18 +1225,46 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetBeginFetchingTimestampCal
ASSERT_EQUALS(ErrorCodes::OperationFailed, _lastApplied);
}
+TEST_F(InitialSyncerTest, InitialSyncerCancelsBeginFetchingOpTimeFetcherOnShutdown) {
+ auto initialSyncer = &getInitialSyncer();
+ auto opCtx = makeOpCtx();
+
+ _syncSourceSelector->setChooseNewSyncSourceResult_forTest(HostAndPort("localhost", 12345));
+ ASSERT_OK(initialSyncer->startup(opCtx.get(), maxAttempts));
+
+ auto net = getNet();
+ {
+ executor::NetworkInterfaceMock::InNetworkGuard guard(net);
+
+ // Base rollback ID.
+ net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
+
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ }
+
+ ASSERT_OK(initialSyncer->shutdown());
+ executor::NetworkInterfaceMock::InNetworkGuard(net)->runReadyNetworkOperations();
+
+ initialSyncer->join();
+ ASSERT_EQUALS(ErrorCodes::CallbackCanceled, _lastApplied.getStatus());
+}
+
TEST_F(InitialSyncerTest, InitialSyncerPassesThroughLastOplogEntryFetcherScheduleError) {
auto initialSyncer = &getInitialSyncer();
auto opCtx = makeOpCtx();
- // The last oplog entry fetcher is the first component that sends a find command so we reject
- // any find commands and save the request for inspection at the end of this test case.
+ // We reject the 'find' command on the oplog and save the request for inspection at the end of
+ // this test case.
executor::RemoteCommandRequest request;
- _executorProxy->shouldFailScheduleRemoteCommandRequest =
- [&request](const executor::RemoteCommandRequest& requestToSend) {
- request = requestToSend;
- return "find" == requestToSend.cmdObj.firstElement().fieldNameStringData();
- };
+ _executorProxy->shouldFailScheduleRemoteCommandRequest = [&request](
+ const executor::RemoteCommandRequest& requestToSend) {
+ request = requestToSend;
+ auto elem = requestToSend.cmdObj.firstElement();
+ return (("find" == elem.fieldNameStringData()) && ("oplog.rs" == elem.valueStringData()));
+ };
HostAndPort syncSource("localhost", 12345);
_syncSourceSelector->setChooseNewSyncSourceResult_forTest(syncSource);
@@ -1255,10 +1277,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughLastOplogEntryFetcherSchedul
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
}
@@ -1286,10 +1309,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughLastOplogEntryFetcherCallbac
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
assertRemoteCommandNameEquals(
@@ -1317,10 +1341,11 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsLastOplogEntryFetcherOnShutdown) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
ASSERT_TRUE(net->hasReadyRequests());
@@ -1348,10 +1373,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1376,10 +1402,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry first attempt - retriable error.
@@ -1409,10 +1436,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1440,10 +1468,10 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1482,10 +1510,10 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughFCVFetcherScheduleError) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1513,10 +1541,10 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughFCVFetcherCallbackError) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1548,10 +1576,10 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsFCVFetcherOnShutdown) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1580,10 +1608,11 @@ TEST_F(InitialSyncerTest, InitialSyncerResendsFindCommandIfFCVFetcherReturnsRetr
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1616,10 +1645,11 @@ void InitialSyncerTest::runInitialSyncWithBadFCVResponse(std::vector<BSONObj> do
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1684,10 +1714,11 @@ TEST_F(InitialSyncerTest, InitialSyncerSucceedsWhenFCVFetcherReturnsOldVersion)
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1735,10 +1766,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughOplogFetcherScheduleError) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1777,10 +1809,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughOplogFetcherCallbackError) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1827,10 +1860,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1889,10 +1923,11 @@ TEST_F(
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -1949,10 +1984,11 @@ TEST_F(
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2014,10 +2050,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2059,10 +2096,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2101,10 +2139,11 @@ TEST_F(InitialSyncerTest, InitialSyncerIgnoresLocalDatabasesWhenCloningDatabases
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2169,10 +2208,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2243,10 +2283,11 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsBothOplogFetcherAndDatabasesCloner
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2274,9 +2315,10 @@ TEST_F(InitialSyncerTest,
bool first = true;
_executorProxy->shouldFailScheduleRemoteCommandRequest =
[&first, &request](const executor::RemoteCommandRequest& requestToSend) {
- if ("find" == requestToSend.cmdObj.firstElement().fieldNameStringData() &&
- requestToSend.cmdObj.hasField("sort") &&
- 1 == requestToSend.cmdObj.getIntField("limit")) {
+ auto elem = requestToSend.cmdObj.firstElement();
+ if (("find" == elem.fieldNameStringData()) && (requestToSend.cmdObj.hasField("sort")) &&
+ (1 == requestToSend.cmdObj.getIntField("limit")) &&
+ (NamespaceString::kRsOplogNamespace.coll().toString() == elem.valueStringData())) {
if (first) {
first = false;
return false;
@@ -2297,10 +2339,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2341,10 +2384,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2401,10 +2445,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2456,10 +2501,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2522,10 +2568,11 @@ TEST_F(
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2580,10 +2627,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2651,10 +2699,11 @@ TEST_F(
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2725,10 +2774,11 @@ TEST_F(
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2799,10 +2849,11 @@ TEST_F(
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2855,10 +2906,11 @@ TEST_F(
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2916,10 +2968,11 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsLastRollbackCheckerOnShutdown) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -2978,10 +3031,11 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsLastRollbackCheckerOnOplogFetcherC
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(1));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3045,10 +3099,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3103,10 +3158,11 @@ TEST_F(InitialSyncerTest, LastOpTimeShouldBeSetEvenIfNoOperationsAreAppliedAfter
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3196,10 +3252,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetNextApplierBatchScheduleE
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3258,10 +3315,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughSecondGetNextApplierBatchSch
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3320,10 +3378,11 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsGetNextApplierBatchOnShutdown) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3384,10 +3443,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetNextApplierBatchInLockErr
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3456,10 +3516,11 @@ TEST_F(
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3519,10 +3580,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughMultiApplierScheduleError) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3598,10 +3660,11 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughMultiApplierCallbackError) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3652,10 +3715,11 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsGetNextApplierBatchCallbackOnOplog
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3712,10 +3776,11 @@ OplogEntry InitialSyncerTest::doInitialSyncWithOneBatch(bool shouldSetFCV) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3811,10 +3876,11 @@ TEST_F(InitialSyncerTest,
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -3931,10 +3997,11 @@ TEST_F(
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -4029,10 +4096,11 @@ TEST_F(InitialSyncerTest, OplogOutOfOrderOnOplogFetchFinish) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -4092,10 +4160,11 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) {
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -4143,13 +4212,15 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) {
ASSERT_EQUALS(when, net->runUntil(when));
// Base rollback ID.
- auto request = net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- assertRemoteCommandNameEquals("replSetGetRBID", request);
+ auto rbidRequest =
+ net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
+ assertRemoteCommandNameEquals("replSetGetRBID", rbidRequest);
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto findRequest = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", findRequest);
net->runReadyNetworkOperations();
// Last oplog entry.
@@ -4364,10 +4435,11 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressOmitsClonerStatsIfClonerStatsExc
// Base rollback ID.
net->scheduleSuccessfulResponse(makeRollbackCheckerResponse(baseRollbackId));
- // Send an empty optime as the response to the serverStatus request, which will cause the
- // beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
- auto request = net->scheduleSuccessfulResponse(makeServerStatusResponse(OpTime()));
- assertRemoteCommandNameEquals("serverStatus", request);
+ // Send an empty optime as the response to the beginFetchingOptime find request, which will
+ // cause the beginFetchingTimestamp to be the same as the beginApplyingTimestamp.
+ auto request = net->scheduleSuccessfulResponse(
+ makeCursorResponse(0LL, NamespaceString::kSessionTransactionsTableNamespace, {}, true));
+ assertRemoteCommandNameEquals("find", request);
net->runReadyNetworkOperations();
// Last oplog entry.