summaryrefslogtreecommitdiff
path: root/src/mongo/db/index/index_build_interceptor.h
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2019-08-22 11:19:27 -0400
committerBenety Goh <benety@mongodb.com>2019-08-22 11:20:51 -0400
commit8a285153c1729dd9dcb417f1dccfa8593d25fe7e (patch)
treebc66f4b671ee6b63067fa559b0963aea44478062 /src/mongo/db/index/index_build_interceptor.h
parent2fb73bcd2515cd8d566fecc5b23ee9f6970b1716 (diff)
downloadmongo-8a285153c1729dd9dcb417f1dccfa8593d25fe7e.tar.gz
SERVER-42869 use shared_ptr to manage side writes counter in IndexBuildInterceptor
Diffstat (limited to 'src/mongo/db/index/index_build_interceptor.h')
-rw-r--r--src/mongo/db/index/index_build_interceptor.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/index/index_build_interceptor.h b/src/mongo/db/index/index_build_interceptor.h
index a9b36131ed5..4bdaaebf6f0 100644
--- a/src/mongo/db/index/index_build_interceptor.h
+++ b/src/mongo/db/index/index_build_interceptor.h
@@ -29,6 +29,8 @@
#pragma once
+#include <memory>
+
#include "mongo/db/index/duplicate_key_tracker.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/multikey_paths.h"
@@ -155,7 +157,12 @@ private:
int64_t _numApplied{0};
- AtomicWord<long long> _sideWritesCounter{0};
+ // This allows the counter to be used in a RecoveryUnit rollback handler where the
+ // IndexBuildInterceptor is no longer available (e.g. due to index build cleanup). If there are
+ // additional fields that have to be referenced in commit/rollback handlers, this counter should
+ // be moved to a new IndexBuildsInterceptor::InternalState structure that will be managed as a
+ // shared resource.
+ std::shared_ptr<AtomicWord<long long>> _sideWritesCounter;
mutable stdx::mutex _multikeyPathMutex;
boost::optional<MultikeyPaths> _multikeyPaths;