diff options
author | Dianna Hohensee <dianna.hohensee@mongodb.com> | 2022-03-09 22:18:59 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-03-09 23:41:25 +0000 |
commit | 0c242cb6ac5d61100cdcaee7f4533de7c2307d25 (patch) | |
tree | eb7e9c89fcc9d4f9880be04d67b8783f99ac869f /src/mongo/db/catalog_raii.cpp | |
parent | f65e8bc4c54cdb9de2358287d4824011729fde98 (diff) | |
download | mongo-0c242cb6ac5d61100cdcaee7f4533de7c2307d25.tar.gz |
SERVER-62457 Fix AutoGetCollectionForReadCommandLock bug wherein a request can come in with an UNSHARDED shard version, AutoGet*LockFree can find sharded state and then pass the SV check as unsharded, due to concurrent activities with the lock-free read state setup
Diffstat (limited to 'src/mongo/db/catalog_raii.cpp')
-rw-r--r-- | src/mongo/db/catalog_raii.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/catalog_raii.cpp b/src/mongo/db/catalog_raii.cpp index 459dd25afc8..f5d79109486 100644 --- a/src/mongo/db/catalog_raii.cpp +++ b/src/mongo/db/catalog_raii.cpp @@ -40,6 +40,8 @@ #include "mongo/logv2/log.h" #include "mongo/util/fail_point.h" +MONGO_FAIL_POINT_DEFINE(hangBeforeAutoGetCollectionLockFreeShardedStateAccess); + namespace mongo { namespace { @@ -367,6 +369,13 @@ AutoGetCollectionLockFree::AutoGetCollectionLockFree(OperationContext* opCtx, dss->checkDbVersion(opCtx, dssLock); } + hangBeforeAutoGetCollectionLockFreeShardedStateAccess.executeIf( + [&](auto&) { hangBeforeAutoGetCollectionLockFreeShardedStateAccess.pauseWhileSet(opCtx); }, + [&](const BSONObj& data) { + return opCtx->getLogicalSessionId() && + opCtx->getLogicalSessionId()->getId() == UUID::fromCDR(data["lsid"].uuid()); + }); + if (_collection) { // Fetch and store the sharding collection description data needed for use during the // operation. The shardVersion will be checked later if the shard filtering metadata is |