From 87739d45b9c974da88ca37d740c71b441249d45b Mon Sep 17 00:00:00 2001 From: Craig Harris Date: Fri, 20 Jun 2014 11:20:12 -0400 Subject: SERVER-14006 Experimental document-level locking for in-place updates This commit enables experimental (and untested) document-level locking for in-place updates, which do not modify indexed values. It should absolutely not be used on production systems and is for demonstration purposes only. It runs under server parameter called useExperimentalDocLocking. In order to enable it, run: ./mongod --setParameter useExperimentalDocLocking=true --- src/mongo/db/ops/update.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/mongo/db/ops/update.cpp') diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp index f3d21129fb3..963109b2537 100644 --- a/src/mongo/db/ops/update.cpp +++ b/src/mongo/db/ops/update.cpp @@ -56,6 +56,7 @@ namespace mongo { namespace mb = mutablebson; + namespace { const char idFieldName[] = "_id"; @@ -624,7 +625,6 @@ namespace mongo { runner->saveState(); if (inPlace && !driver->modsAffectIndices()) { - // If a set of modifiers were all no-ops, we are still 'in place', but there is // no work to do, in which case we want to consider the object unchanged. if (!damages.empty() ) { @@ -636,8 +636,12 @@ namespace mongo { newObj = oldObj; } else { - // The updates were not in place. Apply them through the file manager. + + // XXX: With experimental document-level locking, we do not hold the sufficient + // locks, so this would cause corruption. + fassert(18516, !useExperimentalDocLocking); + newObj = doc.getObject(); uassert(17419, str::stream() << "Resulting document after update is larger than " -- cgit v1.2.1