diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2019-01-22 19:40:16 -0500 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2019-02-01 09:26:38 -0500 |
commit | 79f9081489e39bd80a4b3453afa4f30592710ed5 (patch) | |
tree | 5719983524f09b152e7a7b4e2f6101a61ada8c9a | |
parent | facc18ea539124b9ea1d13cdb674ee51102d3158 (diff) | |
download | mongo-79f9081489e39bd80a4b3453afa4f30592710ed5.tar.gz |
SERVER-39142 ServerWriteConcernMetrics must lock _mutex before modifying members
(cherry picked from commit f0c439824a621d9318fb8f32ac3e314542683e34)
-rw-r--r-- | src/mongo/db/stats/server_write_concern_metrics.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/stats/server_write_concern_metrics.h b/src/mongo/db/stats/server_write_concern_metrics.h index 1d352165db9..0fd633054a4 100644 --- a/src/mongo/db/stats/server_write_concern_metrics.h +++ b/src/mongo/db/stats/server_write_concern_metrics.h @@ -55,6 +55,7 @@ public: */ void recordWriteConcernForInserts(const WriteConcernOptions& writeConcernOptions, size_t numInserts) { + stdx::lock_guard<stdx::mutex> lg(_mutex); _insertMetrics.recordWriteConcern(writeConcernOptions, numInserts); } @@ -69,6 +70,7 @@ public: * Updates the update metrics according to the 'w' value of 'writeConcernOptions'. */ void recordWriteConcernForUpdate(const WriteConcernOptions& writeConcernOptions) { + stdx::lock_guard<stdx::mutex> lg(_mutex); _updateMetrics.recordWriteConcern(writeConcernOptions); } @@ -76,6 +78,7 @@ public: * Updates the delete metrics according to the 'w' value of 'writeConcernOptions'. */ void recordWriteConcernForDelete(const WriteConcernOptions& writeConcernOptions) { + stdx::lock_guard<stdx::mutex> lg(_mutex); _deleteMetrics.recordWriteConcern(writeConcernOptions); } |