summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2017-11-13 16:55:43 -0500
committerDaniel Gottlieb <daniel.gottlieb@mongodb.com>2017-11-13 20:01:26 -0500
commit9dfa7ab336623d435c9aa5d7192973706a047294 (patch)
treed7163cac056dd4546f4290efc6445b7a5ebc48bf
parent002a4c7ad4b9b7f53adadc3ebae487ea369a67b6 (diff)
downloadmongo-9dfa7ab336623d435c9aa5d7192973706a047294.tar.gz
SERVER-31948: Do not lock the `_indexObserverMutex` on the `informIndexObserver` code path.r3.6.0-rc4
IndexObservers were part of the background collection/index consistency validation, but the feature did not make it in for 3.6. IndexObservers currently cannot be installed, so we'll gain some perf by not locking the mutex for what is otherwise a no-op.
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index 689b340923a..5d5922c690f 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -1005,6 +1005,15 @@ void CollectionImpl::informIndexObserver(OperationContext* opCtx,
const IndexDescriptor* descriptor,
const IndexKeyEntry& indexEntry,
const ValidationOperation operation) const {
+ // The index observer was used for a project that would allow concurrent validation of
+ // collection/index consistency while updates were happening to the collection. That project did
+ // not make it in for 3.6. This mutex is in a hot code path, so we're going to avoid locking it
+ // for the time being. See SERVER-31948.
+ const bool unusedReturnEarlyForPerf = true;
+ if (unusedReturnEarlyForPerf) {
+ return;
+ }
+
stdx::lock_guard<stdx::mutex> lock(_indexObserverMutex);
if (_indexObserver) {
_indexObserver->inform(opCtx, descriptor, std::move(indexEntry), operation);