diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2023-02-17 17:14:31 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-02-21 16:11:21 +0000 |
commit | 5a85ba8e15a9f0968c2307e35aefc8c259bc7151 (patch) | |
tree | 856fdd9b49bc5ea768f751de02ecde61d7e57843 | |
parent | ae9b6c827547eb1abf77c92bac4a141b041375a6 (diff) | |
download | mongo-5a85ba8e15a9f0968c2307e35aefc8c259bc7151.tar.gz |
SERVER-74097 Populate `CollectionUUIDMismatch` via `listCollections` for sharded find
-rw-r--r-- | src/mongo/s/query/cluster_find.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp index 131a911e7b6..279fa01a921 100644 --- a/src/mongo/s/query/cluster_find.cpp +++ b/src/mongo/s/query/cluster_find.cpp @@ -61,6 +61,7 @@ #include "mongo/s/client/num_hosts_targeted_metrics.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/cluster_commands_helpers.h" +#include "mongo/s/collection_uuid_mismatch.h" #include "mongo/s/grid.h" #include "mongo/s/query/async_results_merger.h" #include "mongo/s/query/cluster_client_cursor_impl.h" @@ -303,12 +304,9 @@ CursorId runQueryWithoutRetrying(OperationContext* opCtx, if (ex.code() == ErrorCodes::CollectionUUIDMismatch && !ex.extraInfo<CollectionUUIDMismatchInfo>()->actualCollection() && !shardIds.count(cm.dbPrimary())) { - // We received CollectionUUIDMismatchInfo but it does not contain the actual - // namespace, and we did not attempt to establish a cursor on the primary shard. - // Attempt to do so now in case the collection corresponding to the provided UUID is - // unsharded. This should throw CollectionUUIDMismatchInfo, StaleShardVersion, or - // StaleDbVersion. - establishCursorsOnShards({cm.dbPrimary()}); + // We received CollectionUUIDMismatch but it does not contain the actual namespace, and + // we did not attempt to establish a cursor on the primary shard. + uassertStatusOK(populateCollectionUUIDMismatch(opCtx, ex.toStatus())); MONGO_UNREACHABLE; } |