summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorDan Larkin-York <dan.larkin-york@mongodb.com>2021-02-25 21:49:44 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-01 21:09:06 +0000
commit847615ba39e36d7f778fb91b1178fd3e826e5a47 (patch)
treef97be57ee409fd833d282245bf3d354f611b4ae9 /src/mongo/db
parent37d125cd1aba897ab45da36f9054c35938ee9d59 (diff)
downloadmongo-847615ba39e36d7f778fb91b1178fd3e826e5a47.tar.gz
BACKPORT-7936 Error message when creating a mixed hashed/not hashed index should state the problem
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/catalog/index_create_impl.cpp12
-rw-r--r--src/mongo/db/index/hash_access_method.cpp2
2 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/catalog/index_create_impl.cpp b/src/mongo/db/catalog/index_create_impl.cpp
index 1f21757c7fc..f6fd4d9a994 100644
--- a/src/mongo/db/catalog/index_create_impl.cpp
+++ b/src/mongo/db/catalog/index_create_impl.cpp
@@ -336,14 +336,22 @@ StatusWith<std::vector<BSONObj>> MultiIndexBlockImpl::init(const std::vector<BSO
} catch (const WriteConflictException&) {
throw;
} catch (...) {
- return {exceptionToStatus().code(),
+ auto status = exceptionToStatus();
+ std::string separator =
+ (status.reason().size() > 0 && status.reason()[status.reason().size() - 1] == '.')
+ ? ""
+ : ".";
+ return {status.code(),
str::stream() << "Caught exception during index builder initialization "
<< _collection->ns().toString()
<< " ("
<< _collection->uuid()
<< "): "
+ << status.reason()
+ << separator
+ << " First index spec (of "
<< indexSpecs.size()
- << " provided. First index spec: "
+ << "): "
<< (indexSpecs.empty() ? BSONObj() : indexSpecs[0])};
}
}
diff --git a/src/mongo/db/index/hash_access_method.cpp b/src/mongo/db/index/hash_access_method.cpp
index d7b79f1c0c9..a3a96a997bd 100644
--- a/src/mongo/db/index/hash_access_method.cpp
+++ b/src/mongo/db/index/hash_access_method.cpp
@@ -43,7 +43,7 @@ HashAccessMethod::HashAccessMethod(IndexCatalogEntry* btreeState, SortedDataInte
// We can change these if the single-field limitation is lifted later.
uassert(16763,
- "Currently only single field hashed index supported.",
+ "Hashed indices currently only support a single field.",
1 == descriptor->getNumFields());
uassert(16764,