summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp
diff options
context:
space:
mode:
authorAlex Taskov <alex.taskov@mongodb.com>2020-02-04 13:18:29 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-04 18:42:34 +0000
commit8d3429fed4e5307a9e79fe99494ccefc388e54f4 (patch)
tree615d6e74116fc32da0c1ac92227f22ad8f615f38 /src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp
parent0eaddad5bb19553974910d4957d18e1ad790a504 (diff)
downloadmongo-8d3429fed4e5307a9e79fe99494ccefc388e54f4.tar.gz
SERVER-45339 Make MigrationSourceManager send _recvChunkStart to recipient shard as a retryable write
Diffstat (limited to 'src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp')
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp
index 89ca8742cfc..8750348e8cc 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp
@@ -32,6 +32,7 @@
#include "mongo/client/remote_command_targeter_mock.h"
#include "mongo/db/catalog_raii.h"
#include "mongo/db/dbdirectclient.h"
+#include "mongo/db/logical_session_id_helpers.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/s/migration_chunk_cloner_source_legacy.h"
#include "mongo/s/catalog/sharding_catalog_client_mock.h"
@@ -101,6 +102,8 @@ protected:
clockSource->advance(Seconds(1));
operationContext()->getServiceContext()->setFastClockSource(std::move(clockSource));
+
+ _lsid = makeLogicalSessionId(operationContext());
}
void tearDown() override {
@@ -167,6 +170,10 @@ protected:
return BSON("_id" << value << "X" << value);
}
+protected:
+ LogicalSessionId _lsid;
+ TxnNumber _txnNumber{0};
+
private:
std::unique_ptr<ShardingCatalogClient> makeShardingCatalogClient(
std::unique_ptr<DistLockManager> distLockManager) override {
@@ -214,7 +221,7 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, CorrectDocumentsFetched) {
onCommand([&](const RemoteCommandRequest& request) { return BSON("ok" << true); });
});
- ASSERT_OK(cloner.startClone(operationContext(), UUID::gen()));
+ ASSERT_OK(cloner.startClone(operationContext(), UUID::gen(), _lsid, _txnNumber));
futureStartClone.default_timed_get();
}
@@ -312,7 +319,7 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, CollectionNotFound) {
kDonorConnStr,
kRecipientConnStr.getServers()[0]);
- ASSERT_NOT_OK(cloner.startClone(operationContext(), UUID::gen()));
+ ASSERT_NOT_OK(cloner.startClone(operationContext(), UUID::gen(), _lsid, _txnNumber));
cloner.cancelClone(operationContext());
}
@@ -325,7 +332,7 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, ShardKeyIndexNotFound) {
kDonorConnStr,
kRecipientConnStr.getServers()[0]);
- ASSERT_NOT_OK(cloner.startClone(operationContext(), UUID::gen()));
+ ASSERT_NOT_OK(cloner.startClone(operationContext(), UUID::gen(), _lsid, _txnNumber));
cloner.cancelClone(operationContext());
}
@@ -351,7 +358,8 @@ TEST_F(MigrationChunkClonerSourceLegacyTest, FailedToEngageRecipientShard) {
});
});
- auto startCloneStatus = cloner.startClone(operationContext(), UUID::gen());
+ auto startCloneStatus =
+ cloner.startClone(operationContext(), UUID::gen(), _lsid, _txnNumber);
ASSERT_EQ(ErrorCodes::NetworkTimeout, startCloneStatus.code());
futureStartClone.default_timed_get();
}