diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-07-30 23:00:21 -0400 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-07-31 09:35:04 -0400 |
commit | cd8b5e9cbff821f8af00bccc587750f206a06bc3 (patch) | |
tree | 21ae619c30edd62147bac789566b2795aa60bf2d | |
parent | 898818d2ccc87d3485f330241a97b15474098ed1 (diff) | |
download | mongo-cd8b5e9cbff821f8af00bccc587750f206a06bc3.tar.gz |
SERVER-42521 Add logging to waitUntilNoIndexBuildsRemain() to display the UUIDs of all remaining index builds
-rw-r--r-- | src/mongo/db/collection_index_builds_tracker.cpp | 16 | ||||
-rw-r--r-- | src/mongo/db/database_index_builds_tracker.cpp | 16 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/mongo/db/collection_index_builds_tracker.cpp b/src/mongo/db/collection_index_builds_tracker.cpp index 141bcf0bcbc..17f62d1a644 100644 --- a/src/mongo/db/collection_index_builds_tracker.cpp +++ b/src/mongo/db/collection_index_builds_tracker.cpp @@ -27,11 +27,14 @@ * it in the license file. */ +#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kIndex + #include "mongo/platform/basic.h" #include "mongo/db/collection_index_builds_tracker.h" #include "mongo/db/catalog/index_builds_manager.h" +#include "mongo/util/log.h" namespace mongo { @@ -103,7 +106,18 @@ int CollectionIndexBuildsTracker::getNumberOfIndexBuilds(WithLock) const { void CollectionIndexBuildsTracker::waitUntilNoIndexBuildsRemain( stdx::unique_lock<stdx::mutex>& lk) { - _noIndexBuildsRemainCondVar.wait(lk, [&] { return _buildStateByBuildUUID.empty(); }); + _noIndexBuildsRemainCondVar.wait(lk, [&] { + if (_buildStateByBuildUUID.empty()) { + return true; + } + + log() << "Waiting until the following index builds are finished:"; + for (const auto& indexBuild : _buildStateByBuildUUID) { + log() << " Index build with UUID: " << indexBuild.first; + } + + return false; + }); } } // namespace mongo diff --git a/src/mongo/db/database_index_builds_tracker.cpp b/src/mongo/db/database_index_builds_tracker.cpp index 6e31c8ffeff..03097a4844a 100644 --- a/src/mongo/db/database_index_builds_tracker.cpp +++ b/src/mongo/db/database_index_builds_tracker.cpp @@ -27,11 +27,14 @@ * it in the license file. */ +#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kIndex + #include "mongo/platform/basic.h" #include "mongo/db/database_index_builds_tracker.h" #include "mongo/db/catalog/index_builds_manager.h" +#include "mongo/util/log.h" namespace mongo { @@ -72,7 +75,18 @@ int DatabaseIndexBuildsTracker::getNumberOfIndexBuilds(WithLock) const { } void DatabaseIndexBuildsTracker::waitUntilNoIndexBuildsRemain(stdx::unique_lock<stdx::mutex>& lk) { - _noIndexBuildsRemainCondVar.wait(lk, [&] { return _allIndexBuilds.empty(); }); + _noIndexBuildsRemainCondVar.wait(lk, [&] { + if (_allIndexBuilds.empty()) { + return true; + } + + log() << "Waiting until the following index builds are finished:"; + for (const auto& indexBuild : _allIndexBuilds) { + log() << " Index build with UUID: " << indexBuild.first; + } + + return false; + }); } } // namespace mongo |