diff options
author | Cheahuychou Mao <cheahuychou.mao@mongodb.com> | 2018-07-27 17:16:39 -0400 |
---|---|---|
committer | Cheahuychou Mao <cheahuychou.mao@mongodb.com> | 2018-07-30 10:37:27 -0400 |
commit | 1325d6ae2d71456073adc89744dd712940227ef8 (patch) | |
tree | d2e371cb9897b659e18d4b8e2dba4bb31c30e644 /src/mongo/db/s/scoped_operation_completion_sharding_actions.cpp | |
parent | 9ca6c110827ffb212613d4e6c5f9645a41c0432d (diff) | |
download | mongo-1325d6ae2d71456073adc89744dd712940227ef8.tar.gz |
SERVER-36326 Check if sharding is enabled inside ~ScopedOperationCompletionShardingActions
Diffstat (limited to 'src/mongo/db/s/scoped_operation_completion_sharding_actions.cpp')
-rw-r--r-- | src/mongo/db/s/scoped_operation_completion_sharding_actions.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mongo/db/s/scoped_operation_completion_sharding_actions.cpp b/src/mongo/db/s/scoped_operation_completion_sharding_actions.cpp index dfc82d46894..80e1efd2c3d 100644 --- a/src/mongo/db/s/scoped_operation_completion_sharding_actions.cpp +++ b/src/mongo/db/s/scoped_operation_completion_sharding_actions.cpp @@ -36,6 +36,7 @@ #include "mongo/db/s/implicit_create_collection.h" #include "mongo/db/s/operation_sharding_state.h" #include "mongo/db/s/shard_filtering_metadata_refresh.h" +#include "mongo/db/s/sharding_state.h" #include "mongo/s/cannot_implicitly_create_collection_info.h" #include "mongo/s/stale_exception.h" #include "mongo/util/log.h" @@ -78,11 +79,13 @@ ScopedOperationCompletionShardingActions::~ScopedOperationCompletionShardingActi << causedBy(redact(handleMismatchStatus)); } else if (auto cannotImplicitCreateCollInfo = status->extraInfo<CannotImplicitlyCreateCollectionInfo>()) { - auto handleCannotImplicitCreateStatus = - onCannotImplicitlyCreateCollection(_opCtx, cannotImplicitCreateCollInfo->getNss()); - if (!handleCannotImplicitCreateStatus.isOK()) - log() << "Failed to handle CannotImplicitlyCreateCollection exception" - << causedBy(redact(handleCannotImplicitCreateStatus)); + if (ShardingState::get(_opCtx)->enabled()) { + auto handleCannotImplicitCreateStatus = + onCannotImplicitlyCreateCollection(_opCtx, cannotImplicitCreateCollInfo->getNss()); + if (!handleCannotImplicitCreateStatus.isOK()) + log() << "Failed to handle CannotImplicitlyCreateCollection exception" + << causedBy(redact(handleCannotImplicitCreateStatus)); + } } } |