summaryrefslogtreecommitdiff
path: root/src/mongo/db/transaction_validation.h
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2018-11-06 17:14:52 -0500
committerJack Mulrow <jack.mulrow@mongodb.com>2018-11-07 12:36:34 -0500
commit86e89d210ad038a283541131eb5d072f92ea19f2 (patch)
tree5b5ba9be428abd118625179d7be85cdb2f7ff65e /src/mongo/db/transaction_validation.h
parent1f628d2069bda8ccc444c3331648618937f97bd8 (diff)
downloadmongo-86e89d210ad038a283541131eb5d072f92ea19f2.tar.gz
SERVER-36260 Share sessionOptions validations between MongoS and MongoD
Diffstat (limited to 'src/mongo/db/transaction_validation.h')
-rw-r--r--src/mongo/db/transaction_validation.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/transaction_validation.h b/src/mongo/db/transaction_validation.h
index 7f5c676c1cd..4aa4a6563dd 100644
--- a/src/mongo/db/transaction_validation.h
+++ b/src/mongo/db/transaction_validation.h
@@ -30,6 +30,7 @@
#pragma once
+#include "mongo/db/logical_session_id.h"
#include "mongo/db/write_concern_options.h"
namespace mongo {
@@ -39,4 +40,17 @@ namespace mongo {
*/
void validateWriteConcernForTransaction(const WriteConcernOptions& wcResult, StringData cmdName);
+/**
+ * Returns true if the given command is one of the commands that does not check out a session
+ * regardless of its session options, e.g. two-phase commit commands.
+ */
+bool cmdSkipsSessionCheckout(StringData cmdName);
+
+/**
+ * Throws if the given session options are invalid for the given command and target database.
+ */
+void validateSessionOptions(const OperationSessionInfoFromClient& sessionOptions,
+ StringData cmdName,
+ StringData dbname);
+
} // namespace mongo