summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2020-04-09 20:27:15 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-20 22:53:33 +0000
commitb957b68205fbf672867cf68e30c0744ac5abfb9f (patch)
tree3cfc9b7cb90f2082b905f87701ab92d87d5297cc /src/mongo/client
parent41bec612516c3258984deaa022453d6721bcd542 (diff)
downloadmongo-b957b68205fbf672867cf68e30c0744ac5abfb9f.tar.gz
SERVER-46659 Initial sync will startup two phase index builds during the collection cloning phase to prevent a scenario where the commit quorum cannot be satisfied due to the primary node needing the initial syncing nodes vote
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/dbclient_base.cpp20
-rw-r--r--src/mongo/client/dbclient_base.h19
2 files changed, 16 insertions, 23 deletions
diff --git a/src/mongo/client/dbclient_base.cpp b/src/mongo/client/dbclient_base.cpp
index 4e2d1b36a19..8405348b843 100644
--- a/src/mongo/client/dbclient_base.cpp
+++ b/src/mongo/client/dbclient_base.cpp
@@ -932,22 +932,10 @@ BSONObj makeListIndexesCommand(const NamespaceStringOrUUID& nsOrUuid, bool inclu
} // namespace
-list<BSONObj> DBClientBase::getIndexSpecs(const NamespaceStringOrUUID& nsOrUuid, int options) {
- return _getIndexSpecs(nsOrUuid, makeListIndexesCommand(nsOrUuid, false), options);
-}
-
-std::list<BSONObj> DBClientBase::getReadyIndexSpecs(const NamespaceStringOrUUID& nsOrUuid,
- int options) {
- auto specsWithBuildUUIDs =
- _getIndexSpecs(nsOrUuid, makeListIndexesCommand(nsOrUuid, true), options);
- list<BSONObj> specs;
- for (const auto& spec : specsWithBuildUUIDs) {
- if (spec["buildUUID"]) {
- continue;
- }
- specs.push_back(spec);
- }
- return specs;
+std::list<BSONObj> DBClientBase::getIndexSpecs(const NamespaceStringOrUUID& nsOrUuid,
+ bool includeBuildUUIDs,
+ int options) {
+ return _getIndexSpecs(nsOrUuid, makeListIndexesCommand(nsOrUuid, includeBuildUUIDs), options);
}
std::list<BSONObj> DBClientBase::_getIndexSpecs(const NamespaceStringOrUUID& nsOrUuid,
diff --git a/src/mongo/client/dbclient_base.h b/src/mongo/client/dbclient_base.h
index 5db09d9412e..06b8f20a8d1 100644
--- a/src/mongo/client/dbclient_base.h
+++ b/src/mongo/client/dbclient_base.h
@@ -531,15 +531,20 @@ public:
/**
* Lists indexes on the collection 'nsOrUuid'.
* Includes in-progress indexes.
+ *
+ * If 'includeBuildUUIDs' is true, in-progress index specs will have the following format:
+ * {
+ * spec: <BSONObj>
+ * buildUUID: <UUID>
+ * }
+ * and ready index specs will only list the spec.
+ *
+ * If 'includeBuildUUIDs' is false, only the index spec will be returned without a way to
+ * distinguish between ready and in-progress index specs.
*/
virtual std::list<BSONObj> getIndexSpecs(const NamespaceStringOrUUID& nsOrUuid,
- int options = 0);
-
- /**
- * Lists completed indexes on the collection 'nsOrUuid'.
- */
- virtual std::list<BSONObj> getReadyIndexSpecs(const NamespaceStringOrUUID& nsOrUuid,
- int options = 0);
+ bool includeBuildUUIDs,
+ int options);
virtual void dropIndex(const std::string& ns,
BSONObj keys,