summaryrefslogtreecommitdiff
path: root/src/mongo/db/ops/write_ops_exec.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/ops/write_ops_exec.h')
-rw-r--r--src/mongo/db/ops/write_ops_exec.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/db/ops/write_ops_exec.h b/src/mongo/db/ops/write_ops_exec.h
index 246c4226880..c6f03535198 100644
--- a/src/mongo/db/ops/write_ops_exec.h
+++ b/src/mongo/db/ops/write_ops_exec.h
@@ -35,11 +35,17 @@
#include "mongo/base/status_with.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/ops/single_write_result_gen.h"
+#include "mongo/db/ops/update_result.h"
#include "mongo/db/ops/write_ops.h"
#include "mongo/s/stale_exception.h"
namespace mongo {
+class OpDebug;
+class ParsedUpdate;
+
+namespace write_ops_exec {
+
/**
* The result of performing a single write, possibly within a batch.
*/
@@ -70,4 +76,18 @@ WriteResult performInserts(OperationContext* opCtx,
WriteResult performUpdates(OperationContext* opCtx, const write_ops::Update& op);
WriteResult performDeletes(OperationContext* opCtx, const write_ops::Delete& op);
+/**
+ * Populate 'opDebug' with stats describing the execution of an update operation. Illegal to call
+ * with a null OpDebug pointer.
+ */
+void recordUpdateResultInOpDebug(const UpdateResult& updateResult, OpDebug* opDebug);
+
+/**
+ * Returns true if an update failure due to a given DuplicateKey error is eligible for retry.
+ * Requires that parsedUpdate.hasParsedQuery() is true.
+ */
+bool shouldRetryDuplicateKeyException(const ParsedUpdate& parsedUpdate,
+ const DuplicateKeyErrorInfo& errorInfo);
+
+} // namespace write_ops_exec
} // namespace mongo