diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2018-04-02 22:29:16 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2018-04-03 11:49:44 -0400 |
commit | 4952085fcdecaaffed00855f8271ffa984a5d4ae (patch) | |
tree | 6103616ccc8a5bd0cd7ea9a4c2579e7c7cfd21f5 | |
parent | 1a1b3de8f56e363897077d5b4c3fec9482be285a (diff) | |
download | mongo-4952085fcdecaaffed00855f8271ffa984a5d4ae.tar.gz |
SERVER-34271 Rename ErrorCodes::isStaleShardingError to ErrorCodes::isStaleShardVersionError
-rw-r--r-- | src/mongo/base/error_codes.err | 2 | ||||
-rw-r--r-- | src/mongo/db/query/cursor_response.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_aggregate.cpp | 6 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_commands_helpers.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/commands/commands_public.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/commands/pipeline_s.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_find.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/write_ops/cluster_write.cpp | 2 |
8 files changed, 12 insertions, 12 deletions
diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err index a27cf0012c1..286fba9d5a9 100644 --- a/src/mongo/base/error_codes.err +++ b/src/mongo/base/error_codes.err @@ -290,7 +290,7 @@ error_class("NotMasterError", [ "InterruptedDueToReplStateChange", "PrimarySteppedDown", ]) -error_class("StaleShardingError", +error_class("StaleShardVersionError", ["StaleConfig", "StaleShardVersion", "StaleEpoch"]) error_class("NeedRetargettingError", ["StaleConfig", "StaleShardVersion", "StaleEpoch", "CannotImplicitlyCreateCollection"]) diff --git a/src/mongo/db/query/cursor_response.cpp b/src/mongo/db/query/cursor_response.cpp index 39b452a1219..2eb10e17133 100644 --- a/src/mongo/db/query/cursor_response.cpp +++ b/src/mongo/db/query/cursor_response.cpp @@ -115,7 +115,7 @@ CursorResponse::CursorResponse(NamespaceString nss, StatusWith<CursorResponse> CursorResponse::parseFromBSON(const BSONObj& cmdResponse) { Status cmdStatus = getStatusFromCommandResult(cmdResponse); if (!cmdStatus.isOK()) { - if (ErrorCodes::isStaleShardingError(cmdStatus.code())) { + if (ErrorCodes::isStaleShardVersionError(cmdStatus.code())) { auto vWanted = ChunkVersion::fromBSON(cmdResponse, "vWanted"); auto vReceived = ChunkVersion::fromBSON(cmdResponse, "vReceived"); if (!vWanted.hasEqualEpoch(vReceived)) { diff --git a/src/mongo/s/commands/cluster_aggregate.cpp b/src/mongo/s/commands/cluster_aggregate.cpp index 2a380bab223..88c888c586a 100644 --- a/src/mongo/s/commands/cluster_aggregate.cpp +++ b/src/mongo/s/commands/cluster_aggregate.cpp @@ -333,7 +333,7 @@ std::vector<ClusterClientCursorParams::RemoteCursor> establishShardCursors( requests, false /* do not allow partial results */); - } catch (const ExceptionForCat<ErrorCategory::StaleShardingError>&) { + } catch (const ExceptionForCat<ErrorCategory::StaleShardVersionError>&) { // If any shard returned a stale shardVersion error, invalidate the routing table cache. // This will cause the cache to be refreshed the next time it is accessed. Grid::get(opCtx)->catalogCache()->onStaleShardVersion(std::move(*routingInfo)); @@ -508,7 +508,7 @@ DispatchShardPipelineResults dispatchShardPipeline( shardQuery, aggRequest.getCollation()); } - } catch (const ExceptionForCat<ErrorCategory::StaleShardingError>& ex) { + } catch (const ExceptionForCat<ErrorCategory::StaleShardVersionError>& ex) { LOG(1) << "got stale shardVersion error " << redact(ex) << " while dispatching " << redact(targetedCommand) << " after " << (numAttempts + 1) << " dispatch attempts"; @@ -975,7 +975,7 @@ Status ClusterAggregate::aggPassthrough(OperationContext* opCtx, : std::move(cmdObj), Shard::RetryPolicy::kIdempotent)); - if (ErrorCodes::isStaleShardingError(cmdResponse.commandStatus.code())) { + if (ErrorCodes::isStaleShardVersionError(cmdResponse.commandStatus.code())) { uassertStatusOK( cmdResponse.commandStatus.withContext("command failed because of stale config")); } else if (ErrorCodes::isSnapshotError(cmdResponse.commandStatus.code())) { diff --git a/src/mongo/s/commands/cluster_commands_helpers.cpp b/src/mongo/s/commands/cluster_commands_helpers.cpp index 9002ccb7fff..1ff784075ee 100644 --- a/src/mongo/s/commands/cluster_commands_helpers.cpp +++ b/src/mongo/s/commands/cluster_commands_helpers.cpp @@ -193,7 +193,7 @@ std::vector<AsyncRequestsSender::Response> gatherResponses( } // Failing to establish a consistent shardVersion means no results should be examined. - if (ErrorCodes::isStaleShardingError(status.code())) { + if (ErrorCodes::isStaleShardVersionError(status.code())) { uassertStatusOK(status.withContext(str::stream() << "got stale shardVersion response from shard " << response.shardId diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp index c12981e5e19..29379f12619 100644 --- a/src/mongo/s/commands/commands_public.cpp +++ b/src/mongo/s/commands/commands_public.cpp @@ -105,7 +105,7 @@ bool nonShardedCollectionCommandPassthrough(OperationContext* opCtx, uassert(ErrorCodes::IllegalOperation, str::stream() << "Can't do command: " << cmdName << " on a sharded collection", - !status.isA<ErrorCategory::StaleShardingError>()); + !status.isA<ErrorCategory::StaleShardVersionError>()); out->appendElementsUnique(CommandHelpers::filterCommandReplyForPassthrough(cmdResponse.data)); return status.isOK(); @@ -148,7 +148,7 @@ protected: uassert(ErrorCodes::IllegalOperation, str::stream() << "can't do command: " << getName() << " on a sharded collection", - !ErrorCodes::isStaleShardingError(commandResponse.commandStatus.code())); + !ErrorCodes::isStaleShardVersionError(commandResponse.commandStatus.code())); uassertStatusOK(commandResponse.commandStatus); diff --git a/src/mongo/s/commands/pipeline_s.cpp b/src/mongo/s/commands/pipeline_s.cpp index 19e7afa40e5..060c5533877 100644 --- a/src/mongo/s/commands/pipeline_s.cpp +++ b/src/mongo/s/commands/pipeline_s.cpp @@ -154,7 +154,7 @@ boost::optional<Document> PipelineS::MongoSInterface::lookupSingleDocument( // If it's an unsharded collection which has been deleted and re-created, we may get a // NamespaceNotFound error when looking up by UUID. return boost::none; - } catch (const ExceptionForCat<ErrorCategory::StaleShardingError>&) { + } catch (const ExceptionForCat<ErrorCategory::StaleShardVersionError>&) { // If we hit a stale shardVersion exception, invalidate the routing table cache. catalogCache->onStaleShardVersion(std::move(routingInfo)); continue; // Try again if allowed. diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp index c71da207f41..7979f127e7c 100644 --- a/src/mongo/s/query/cluster_find.cpp +++ b/src/mongo/s/query/cluster_find.cpp @@ -445,7 +445,7 @@ CursorId ClusterFind::runQuery(OperationContext* opCtx, ex.addContext(str::stream() << "Failed to run query after " << kMaxRetries << " retries"); throw; - } else if (!ErrorCodes::isStaleShardingError(ex.code()) && + } else if (!ErrorCodes::isStaleShardVersionError(ex.code()) && !ErrorCodes::isSnapshotError(ex.code()) && ex.code() != ErrorCodes::ShardNotFound) { // Errors other than stale metadata, snapshot unavailable, or from trying to reach a @@ -461,7 +461,7 @@ CursorId ClusterFind::runQuery(OperationContext* opCtx, // Note: there is no need to refresh metadata on snapshot errors since the request // failed because atClusterTime was too low, not because the wrong shards were targeted, // and subsequent attempts will choose a later atClusterTime. - if (ErrorCodes::isStaleShardingError(ex.code()) || + if (ErrorCodes::isStaleShardVersionError(ex.code()) || ex.code() == ErrorCodes::ShardNotFound) { catalogCache->onStaleShardVersion(std::move(routingInfo)); } diff --git a/src/mongo/s/write_ops/cluster_write.cpp b/src/mongo/s/write_ops/cluster_write.cpp index 9eab15b47cd..07e5ad7b5ce 100644 --- a/src/mongo/s/write_ops/cluster_write.cpp +++ b/src/mongo/s/write_ops/cluster_write.cpp @@ -402,7 +402,7 @@ void updateChunkWriteStatsAndSplitIfNeeded(OperationContext* opCtx, } catch (const DBException& ex) { chunk->clearBytesWritten(); - if (ErrorCodes::isStaleShardingError(ex.code())) { + if (ErrorCodes::isStaleShardVersionError(ex.code())) { log() << "Unable to auto-split chunk " << redact(chunkRange.toString()) << causedBy(ex) << ", going to invalidate routing table entry for " << nss; Grid::get(opCtx)->catalogCache()->invalidateShardedCollection(nss); |