summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2018-10-31 17:05:37 -0400
committerJack Mulrow <jack.mulrow@mongodb.com>2018-11-01 14:25:48 -0400
commitb31e8fd295abde81246d153d4c141f83b0a33db6 (patch)
tree9869233a364ebd0120394f87fa7010bcf3d5204e
parentf68d6091bad5a2747cc09c743b8c2c7b4e42a65a (diff)
downloadmongo-b31e8fd295abde81246d153d4c141f83b0a33db6.tar.gz
SERVER-37693 Uassert shards never return CannotImplicitlyCreateCollection in a transaction
-rw-r--r--src/mongo/s/commands/strategy.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp
index 0426f19d2bd..ee2581ab975 100644
--- a/src/mongo/s/commands/strategy.cpp
+++ b/src/mongo/s/commands/strategy.cpp
@@ -427,6 +427,14 @@ void runCommand(OperationContext* opCtx,
return staleInfo->getNss();
} else if (auto implicitCreateInfo =
ex.extraInfo<CannotImplicitlyCreateCollectionInfo>()) {
+ // Requests that attempt to implicitly create a collection in a transaction
+ // should always fail with OperationNotSupportedInTransaction - this
+ // assertion is only meant to safeguard that assumption.
+ uassert(50983,
+ str::stream() << "Cannot handle exception in a transaction: "
+ << ex.toStatus(),
+ !TransactionRouter::get(opCtx));
+
return implicitCreateInfo->getNss();
} else {
throw;