diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2020-06-15 13:37:05 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-16 00:32:48 +0000 |
commit | ab67e0ffef124954d5244d94c8ee5b8b1380571e (patch) | |
tree | de4af4aacb62bf1226b390ef59ecfa8f34896895 | |
parent | 6869bdc727c77beb63821b67383cc095bd7c83fc (diff) | |
download | mongo-ab67e0ffef124954d5244d94c8ee5b8b1380571e.tar.gz |
SERVER-48596 IndexBuildsCoordinator::abortCollectionIndexBuilds() should return early if there are no active index builds
-rw-r--r-- | src/mongo/db/index_builds_coordinator.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index 9c6eb5c324a..826ec658618 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -569,12 +569,6 @@ std::vector<UUID> IndexBuildsCoordinator::abortCollectionIndexBuilds( const NamespaceString collectionNss, const UUID collectionUUID, const std::string& reason) { - LOGV2(23879, - "About to abort all index builders", - "namespace"_attr = collectionNss, - "uuid"_attr = collectionUUID, - "reason"_attr = reason); - auto collIndexBuilds = [&]() -> std::vector<std::shared_ptr<ReplIndexBuildState>> { stdx::unique_lock<Latch> lk(_mutex); auto indexBuildFilter = [=](const auto& replState) { @@ -583,6 +577,16 @@ std::vector<UUID> IndexBuildsCoordinator::abortCollectionIndexBuilds( return _filterIndexBuilds_inlock(lk, indexBuildFilter); }(); + if (collIndexBuilds.empty()) { + return {}; + } + + LOGV2(23879, + "About to abort all index builders", + "namespace"_attr = collectionNss, + "uuid"_attr = collectionUUID, + "reason"_attr = reason); + std::vector<UUID> buildUUIDs; for (auto replState : collIndexBuilds) { if (abortIndexBuildByBuildUUID( |