summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbhelpers.h
diff options
context:
space:
mode:
authorVishnu Kaushik <vishnu.kaushik@mongodb.com>2020-09-16 16:06:48 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-16 17:13:00 +0000
commitcc248c4286d45eee06e2d66cdd52cd7cbae5b593 (patch)
tree98b3f9e21e9444c652db7b2c79c79edd813ce045 /src/mongo/db/dbhelpers.h
parent31b68dc5a867db96e33a33fc8f4d3f2ceb22a9f9 (diff)
downloadmongo-cc248c4286d45eee06e2d66cdd52cd7cbae5b593.tar.gz
SERVER-48293 change update to upsert to mitigate race condition leading to orphaned system.indexBuilds
Diffstat (limited to 'src/mongo/db/dbhelpers.h')
-rw-r--r--src/mongo/db/dbhelpers.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/dbhelpers.h b/src/mongo/db/dbhelpers.h
index 514a4eda352..3bdf368490a 100644
--- a/src/mongo/db/dbhelpers.h
+++ b/src/mongo/db/dbhelpers.h
@@ -137,6 +137,18 @@ struct Helpers {
const BSONObj& updateMod,
bool fromMigrate = false);
+ /**
+ * Performs an update of 'updateMod' for the entry matching the given 'filter'.
+ * Callers are expected to hold the collection lock.
+ * Note: Query yielding is turned off, so both read and writes are performed
+ * on the same storage snapshot.
+ */
+ static void update(OperationContext* opCtx,
+ const std::string& ns,
+ const BSONObj& filter,
+ const BSONObj& updateMod,
+ bool fromMigrate = false);
+
// TODO: this should be somewhere else probably
/* Takes object o, and returns a new object with the
* same field elements but the names stripped out.