summaryrefslogtreecommitdiff
path: root/src/mongo/db/index
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/index')
-rw-r--r--src/mongo/db/index/2d_access_method.cpp2
-rw-r--r--src/mongo/db/index/btree_access_method.h2
-rw-r--r--src/mongo/db/index/btree_key_generator.cpp6
-rw-r--r--src/mongo/db/index/expression_keys_private.cpp2
-rw-r--r--src/mongo/db/index/expression_keys_private.h2
-rw-r--r--src/mongo/db/index/expression_params.cpp12
-rw-r--r--src/mongo/db/index/expression_params.h2
-rw-r--r--src/mongo/db/index/external_key_generator.cpp2
-rw-r--r--src/mongo/db/index/hash_access_method.cpp2
-rw-r--r--src/mongo/db/index/hash_access_method.h2
-rw-r--r--src/mongo/db/index/index_access_method.cpp6
-rw-r--r--src/mongo/db/index/index_descriptor.h2
-rw-r--r--src/mongo/db/index/s2_access_method.cpp40
-rw-r--r--src/mongo/db/index/s2_key_generator_test.cpp12
14 files changed, 62 insertions, 32 deletions
diff --git a/src/mongo/db/index/2d_access_method.cpp b/src/mongo/db/index/2d_access_method.cpp
index c4e5e6e8843..ed63659593a 100644
--- a/src/mongo/db/index/2d_access_method.cpp
+++ b/src/mongo/db/index/2d_access_method.cpp
@@ -31,10 +31,10 @@
#include <string>
#include <vector>
-#include "mongo/db/index_names.h"
#include "mongo/db/index/2d_common.h"
#include "mongo/db/index/expression_keys_private.h"
#include "mongo/db/index/expression_params.h"
+#include "mongo/db/index_names.h"
#include "mongo/db/jsobj.h"
namespace mongo {
diff --git a/src/mongo/db/index/btree_access_method.h b/src/mongo/db/index/btree_access_method.h
index 5873514c01c..ed5389d5f79 100644
--- a/src/mongo/db/index/btree_access_method.h
+++ b/src/mongo/db/index/btree_access_method.h
@@ -30,9 +30,9 @@
#include "mongo/base/status.h"
-#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/btree_key_generator.h"
#include "mongo/db/index/index_access_method.h"
+#include "mongo/db/index/index_access_method.h"
#include "mongo/db/jsobj.h"
namespace mongo {
diff --git a/src/mongo/db/index/btree_key_generator.cpp b/src/mongo/db/index/btree_key_generator.cpp
index 1f1eb949b06..5e847e77438 100644
--- a/src/mongo/db/index/btree_key_generator.cpp
+++ b/src/mongo/db/index/btree_key_generator.cpp
@@ -243,8 +243,10 @@ BSONElement BtreeKeyGeneratorV1::extractNextElement(const BSONObj& obj,
uassert(16746,
mongoutils::str::stream()
<< "Ambiguous field name found in array (do not use numeric field names in "
- "embedded elements in an array), field: '" << arrField.fieldName()
- << "' for array: " << positionalInfo.arrayObj,
+ "embedded elements in an array), field: '"
+ << arrField.fieldName()
+ << "' for array: "
+ << positionalInfo.arrayObj,
!haveObjField || !positionalInfo.hasPositionallyIndexedElt());
*arrayNestedArray = false;
diff --git a/src/mongo/db/index/expression_keys_private.cpp b/src/mongo/db/index/expression_keys_private.cpp
index 99f2b889c01..9afc653127f 100644
--- a/src/mongo/db/index/expression_keys_private.cpp
+++ b/src/mongo/db/index/expression_keys_private.cpp
@@ -37,9 +37,9 @@
#include "mongo/db/geo/geometry_container.h"
#include "mongo/db/geo/geoparser.h"
#include "mongo/db/geo/s2.h"
-#include "mongo/db/index_names.h"
#include "mongo/db/index/2d_common.h"
#include "mongo/db/index/s2_common.h"
+#include "mongo/db/index_names.h"
#include "mongo/db/query/collation/collation_index_key.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/index/expression_keys_private.h b/src/mongo/db/index/expression_keys_private.h
index b84acbcae11..5206f4a6768 100644
--- a/src/mongo/db/index/expression_keys_private.h
+++ b/src/mongo/db/index/expression_keys_private.h
@@ -30,8 +30,8 @@
#include <vector>
-#include "mongo/bson/bsonobj.h"
#include "mongo/bson/bsonmisc.h"
+#include "mongo/bson/bsonobj.h"
#include "mongo/db/hasher.h"
namespace mongo {
diff --git a/src/mongo/db/index/expression_params.cpp b/src/mongo/db/index/expression_params.cpp
index e0ab49c303e..956a99e6f69 100644
--- a/src/mongo/db/index/expression_params.cpp
+++ b/src/mongo/db/index/expression_params.cpp
@@ -31,9 +31,9 @@
#include "mongo/bson/util/bson_extract.h"
#include "mongo/db/geo/geoconstants.h"
#include "mongo/db/hasher.h"
-#include "mongo/db/index_names.h"
#include "mongo/db/index/2d_common.h"
#include "mongo/db/index/s2_common.h"
+#include "mongo/db/index_names.h"
#include "mongo/util/mongoutils/str.h"
#include "third_party/s2/s2.h"
@@ -192,8 +192,14 @@ void ExpressionParams::initialize2dsphereParams(const BSONObj& infoObj,
massert(17395,
stream() << "unsupported geo index version { " << kIndexVersionFieldName << " : "
- << out->indexVersion << " }, only support versions: [" << S2_INDEX_VERSION_1
- << "," << S2_INDEX_VERSION_2 << "," << S2_INDEX_VERSION_3 << "]",
+ << out->indexVersion
+ << " }, only support versions: ["
+ << S2_INDEX_VERSION_1
+ << ","
+ << S2_INDEX_VERSION_2
+ << ","
+ << S2_INDEX_VERSION_3
+ << "]",
out->indexVersion == S2_INDEX_VERSION_3 || out->indexVersion == S2_INDEX_VERSION_2 ||
out->indexVersion == S2_INDEX_VERSION_1);
}
diff --git a/src/mongo/db/index/expression_params.h b/src/mongo/db/index/expression_params.h
index 21cf7c298c0..d8a12323abc 100644
--- a/src/mongo/db/index/expression_params.h
+++ b/src/mongo/db/index/expression_params.h
@@ -31,8 +31,8 @@
#include <string>
#include <vector>
-#include "mongo/db/jsobj.h"
#include "mongo/db/hasher.h"
+#include "mongo/db/jsobj.h"
namespace mongo {
diff --git a/src/mongo/db/index/external_key_generator.cpp b/src/mongo/db/index/external_key_generator.cpp
index de1aec11d64..1ab9c1ad9ae 100644
--- a/src/mongo/db/index/external_key_generator.cpp
+++ b/src/mongo/db/index/external_key_generator.cpp
@@ -32,12 +32,12 @@
#include <string>
#include "mongo/db/fts/fts_spec.h"
-#include "mongo/db/index_names.h"
#include "mongo/db/index/2d_common.h"
#include "mongo/db/index/btree_key_generator.h"
#include "mongo/db/index/expression_keys_private.h"
#include "mongo/db/index/expression_params.h"
#include "mongo/db/index/s2_common.h"
+#include "mongo/db/index_names.h"
#include "mongo/db/jsobj.h"
namespace mongo {
diff --git a/src/mongo/db/index/hash_access_method.cpp b/src/mongo/db/index/hash_access_method.cpp
index 10339f7eae9..34f4323fede 100644
--- a/src/mongo/db/index/hash_access_method.cpp
+++ b/src/mongo/db/index/hash_access_method.cpp
@@ -26,10 +26,10 @@
* it in the license file.
*/
+#include "mongo/db/index/hash_access_method.h"
#include "mongo/db/hasher.h"
#include "mongo/db/index/expression_keys_private.h"
#include "mongo/db/index/expression_params.h"
-#include "mongo/db/index/hash_access_method.h"
namespace mongo {
diff --git a/src/mongo/db/index/hash_access_method.h b/src/mongo/db/index/hash_access_method.h
index 8fc5db36636..e73fc2c623e 100644
--- a/src/mongo/db/index/hash_access_method.h
+++ b/src/mongo/db/index/hash_access_method.h
@@ -32,8 +32,8 @@
#include "mongo/base/status.h"
#include "mongo/db/hasher.h" // For HashSeed.
-#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index/index_access_method.h"
+#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h"
namespace mongo {
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp
index 2abb95870d3..d3ca3c0c808 100644
--- a/src/mongo/db/index/index_access_method.cpp
+++ b/src/mongo/db/index/index_access_method.cpp
@@ -32,8 +32,8 @@
#include "mongo/db/index/btree_access_method.h"
-#include <vector>
#include <utility>
+#include <vector>
#include "mongo/base/error_codes.h"
#include "mongo/base/status.h"
@@ -110,8 +110,8 @@ IndexAccessMethod::IndexAccessMethod(IndexCatalogEntry* btreeState, SortedDataIn
bool IndexAccessMethod::ignoreKeyTooLong(OperationContext* txn) {
// Ignore this error if we're on a secondary or if the user requested it
- const auto canAcceptWritesForNs = repl::ReplicationCoordinator::get(txn)
- ->canAcceptWritesFor(NamespaceString(_btreeState->ns()));
+ const auto canAcceptWritesForNs = repl::ReplicationCoordinator::get(txn)->canAcceptWritesFor(
+ NamespaceString(_btreeState->ns()));
return !canAcceptWritesForNs || !failIndexKeyTooLong;
}
diff --git a/src/mongo/db/index/index_descriptor.h b/src/mongo/db/index/index_descriptor.h
index 3bb46d78a57..cead1965b9e 100644
--- a/src/mongo/db/index/index_descriptor.h
+++ b/src/mongo/db/index/index_descriptor.h
@@ -32,9 +32,9 @@
#include <string>
+#include "mongo/db/catalog/collection.h"
#include "mongo/db/index/multikey_paths.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/catalog/collection.h"
#include "mongo/util/stacktrace.h"
diff --git a/src/mongo/db/index/s2_access_method.cpp b/src/mongo/db/index/s2_access_method.cpp
index a05f72855dc..eee92fa8037 100644
--- a/src/mongo/db/index/s2_access_method.cpp
+++ b/src/mongo/db/index/s2_access_method.cpp
@@ -33,11 +33,11 @@
#include <vector>
#include "mongo/base/status.h"
-#include "mongo/db/geo/geoparser.h"
#include "mongo/db/geo/geoconstants.h"
-#include "mongo/db/index_names.h"
+#include "mongo/db/geo/geoparser.h"
#include "mongo/db/index/expression_keys_private.h"
#include "mongo/db/index/expression_params.h"
+#include "mongo/db/index_names.h"
#include "mongo/db/jsobj.h"
#include "mongo/util/log.h"
@@ -95,18 +95,30 @@ StatusWith<BSONObj> S2AccessMethod::fixSpec(const BSONObj& specObj) {
if (!indexVersionElt.isNumber()) {
return {ErrorCodes::CannotCreateIndex,
str::stream() << "Invalid type for geo index version { " << kIndexVersionFieldName
- << " : " << indexVersionElt << " }, only versions: ["
- << S2_INDEX_VERSION_1 << "," << S2_INDEX_VERSION_2 << ","
- << S2_INDEX_VERSION_3 << "] are supported"};
+ << " : "
+ << indexVersionElt
+ << " }, only versions: ["
+ << S2_INDEX_VERSION_1
+ << ","
+ << S2_INDEX_VERSION_2
+ << ","
+ << S2_INDEX_VERSION_3
+ << "] are supported"};
}
if (indexVersionElt.type() == BSONType::NumberDouble &&
!std::isnormal(indexVersionElt.numberDouble())) {
return {ErrorCodes::CannotCreateIndex,
str::stream() << "Invalid value for geo index version { " << kIndexVersionFieldName
- << " : " << indexVersionElt << " }, only versions: ["
- << S2_INDEX_VERSION_1 << "," << S2_INDEX_VERSION_2 << ","
- << S2_INDEX_VERSION_3 << "] are supported"};
+ << " : "
+ << indexVersionElt
+ << " }, only versions: ["
+ << S2_INDEX_VERSION_1
+ << ","
+ << S2_INDEX_VERSION_2
+ << ","
+ << S2_INDEX_VERSION_3
+ << "] are supported"};
}
const auto indexVersion = indexVersionElt.numberLong();
@@ -114,9 +126,15 @@ StatusWith<BSONObj> S2AccessMethod::fixSpec(const BSONObj& specObj) {
indexVersion != S2_INDEX_VERSION_3) {
return {ErrorCodes::CannotCreateIndex,
str::stream() << "unsupported geo index version { " << kIndexVersionFieldName
- << " : " << indexVersionElt << " }, only versions: ["
- << S2_INDEX_VERSION_1 << "," << S2_INDEX_VERSION_2 << ","
- << S2_INDEX_VERSION_3 << "] are supported"};
+ << " : "
+ << indexVersionElt
+ << " }, only versions: ["
+ << S2_INDEX_VERSION_1
+ << ","
+ << S2_INDEX_VERSION_2
+ << ","
+ << S2_INDEX_VERSION_3
+ << "] are supported"};
}
return specObj;
diff --git a/src/mongo/db/index/s2_key_generator_test.cpp b/src/mongo/db/index/s2_key_generator_test.cpp
index a26a43337e8..1002ea1ecde 100644
--- a/src/mongo/db/index/s2_key_generator_test.cpp
+++ b/src/mongo/db/index/s2_key_generator_test.cpp
@@ -33,8 +33,8 @@
#include "mongo/db/index/expression_keys_private.h"
#include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/db/index/s2_common.h"
#include "mongo/db/index/expression_params.h"
+#include "mongo/db/index/s2_common.h"
#include "mongo/db/json.h"
#include "mongo/db/query/collation/collator_interface_mock.h"
#include "mongo/unittest/unittest.h"
@@ -67,7 +67,8 @@ bool assertKeysetsEqual(const BSONObjSet& expectedKeys, const BSONObjSet& actual
long long getCellID(int x, int y) {
BSONObj obj = BSON("a" << BSON("type"
<< "Point"
- << "coordinates" << BSON_ARRAY(x << y)));
+ << "coordinates"
+ << BSON_ARRAY(x << y)));
BSONObj keyPattern = fromjson("{a: '2dsphere'}");
BSONObj infoObj = fromjson("{key: {a: '2dsphere'}, '2dsphereIndexVersion': 3}");
S2IndexingParams params;
@@ -109,7 +110,8 @@ TEST(S2KeyGeneratorTest, CollationAppliedToNonGeoStringFieldBeforeGeoField) {
BSONObjSet expectedKeys;
expectedKeys.insert(BSON(""
<< "gnirts"
- << "" << getCellID(0, 0)));
+ << ""
+ << getCellID(0, 0)));
ASSERT(assertKeysetsEqual(expectedKeys, actualKeys));
}
@@ -127,7 +129,9 @@ TEST(S2KeyGeneratorTest, CollationAppliedToAllNonGeoStringFields) {
BSONObjSet expectedKeys;
expectedKeys.insert(BSON(""
<< "gnirts"
- << "" << getCellID(0, 0) << ""
+ << ""
+ << getCellID(0, 0)
+ << ""
<< "2gnirts"));
ASSERT(assertKeysetsEqual(expectedKeys, actualKeys));