summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/op_observer_sharding_impl.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@mongodb.com>2019-08-21 15:43:43 +0000
committerevergreen <evergreen@mongodb.com>2019-08-21 15:43:43 +0000
commit08f836390d61726235e583f46012f43995695c85 (patch)
tree746d2bc59f126fad6cada56962b55323784857b5 /src/mongo/db/s/op_observer_sharding_impl.cpp
parentf643ad5e9d5c6c3283271c492a78831a5f6ec180 (diff)
downloadmongo-08f836390d61726235e583f46012f43995695c85.tar.gz
SERVER-42856 Make the check for chunk moved in the op observer take hashed shard keys into account
Diffstat (limited to 'src/mongo/db/s/op_observer_sharding_impl.cpp')
-rw-r--r--src/mongo/db/s/op_observer_sharding_impl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/s/op_observer_sharding_impl.cpp b/src/mongo/db/s/op_observer_sharding_impl.cpp
index a76bbd1bcb2..4ede2a0f03d 100644
--- a/src/mongo/db/s/op_observer_sharding_impl.cpp
+++ b/src/mongo/db/s/op_observer_sharding_impl.cpp
@@ -59,9 +59,11 @@ void assertIntersectingChunkHasNotMoved(OperationContext* opCtx,
if (!metadata->isSharded())
return;
+ auto chunkManager = metadata->getChunkManager();
+ auto shardKey = chunkManager->getShardKeyPattern().extractShardKeyFromDoc(doc);
+
// We can assume the simple collation because shard keys do not support non-simple collations.
- auto chunk = metadata->getChunkManager()->findIntersectingChunkWithSimpleCollation(
- metadata->extractDocumentKey(doc));
+ auto chunk = chunkManager->findIntersectingChunkWithSimpleCollation(shardKey);
// Throws if the chunk has moved since the timestamp of the running transaction's atClusterTime
// read concern parameter.