summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2019-05-15 16:54:35 -0400
committerRandolph Tan <randolph@10gen.com>2019-05-17 16:49:22 -0400
commit32ade4aa6b6a73c3620486117388908ad9ad438c (patch)
tree757054f3a8c8bb898aeef89a9af8feabe7c9d215 /src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
parent57c127b9040a1203a86214cf0bf896aa069afbbe (diff)
downloadmongo-32ade4aa6b6a73c3620486117388908ad9ad438c.tar.gz
SERVER-41074 Make decision to send pre/post image oplog the same as the decision made for the originating oplog write.
Diffstat (limited to 'src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp')
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
index 9e6e44388fd..bcb5cd266e6 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
@@ -87,20 +87,6 @@ BSONObj createRequestWithSessionId(StringData commandName,
return builder.obj();
}
-bool shouldApplyOplogToSession(const repl::OplogEntry& oplog,
- const ChunkRange& range,
- const ShardKeyPattern& keyPattern) {
- // Skip appending CRUD operations that don't pertain to the ChunkRange being migrated.
- if (oplog.isCrudOpType()) {
- auto shardKey = keyPattern.extractShardKeyFromDoc(oplog.getObjectContainingDocumentKey());
- if (!range.containsKey(shardKey)) {
- return false;
- }
- }
-
- return true;
-}
-
} // namespace
/**
@@ -187,8 +173,11 @@ Status MigrationChunkClonerSourceLegacy::startClone(OperationContext* opCtx) {
auto const replCoord = repl::ReplicationCoordinator::get(opCtx);
if (replCoord->getReplicationMode() == repl::ReplicationCoordinator::modeReplSet) {
- _sessionCatalogSource =
- stdx::make_unique<SessionCatalogMigrationSource>(opCtx, _args.getNss());
+ _sessionCatalogSource = stdx::make_unique<SessionCatalogMigrationSource>(
+ opCtx,
+ _args.getNss(),
+ ChunkRange(_args.getMinKey(), _args.getMaxKey()),
+ _shardKeyPattern.getKeyPattern());
// Prime up the session migration source if there are oplog entries to migrate.
_sessionCatalogSource->fetchNextOplog(opCtx);
@@ -859,8 +848,7 @@ boost::optional<repl::OpTime> MigrationChunkClonerSourceLegacy::nextSessionMigra
while (_sessionCatalogSource->hasMoreOplog()) {
auto result = _sessionCatalogSource->getLastFetchedOplog();
- if (!result.oplog ||
- !shouldApplyOplogToSession(result.oplog.get(), range, _shardKeyPattern)) {
+ if (!result.oplog) {
_sessionCatalogSource->fetchNextOplog(opCtx);
continue;
}