summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Larkin-York <dan.larkin-york@mongodb.com>2021-02-12 19:41:48 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-12 20:04:43 +0000
commitecbb91d31416fc9a68d896ea255f5494ca2a54d4 (patch)
tree3ea05fd6bc9316171613099956ff139d29773be7 /src
parent338667a3cbfced1ca3aa3656c666ce44d449a93a (diff)
downloadmongo-ecbb91d31416fc9a68d896ea255f5494ca2a54d4.tar.gz
SERVER-50073 Error message when creating a mixed hashed/not hashed index should state the problem
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/multi_index_block.cpp12
-rw-r--r--src/mongo/db/index/hash_access_method.cpp2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/mongo/db/catalog/multi_index_block.cpp b/src/mongo/db/catalog/multi_index_block.cpp
index 60720c89443..36eb9c08eb2 100644
--- a/src/mongo/db/catalog/multi_index_block.cpp
+++ b/src/mongo/db/catalog/multi_index_block.cpp
@@ -433,11 +433,17 @@ StatusWith<std::vector<BSONObj>> MultiIndexBlock::init(OperationContext* opCtx,
} 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() << " (" << collection->uuid()
- << "): " << indexSpecs.size() << " provided. First index spec: "
- << (indexSpecs.empty() ? BSONObj() : indexSpecs[0])};
+ << "): " << status.reason() << separator << " First index spec (of "
+ << indexSpecs.size()
+ << "): " << (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 d7d91f48239..27c51f15c14 100644
--- a/src/mongo/db/index/hash_access_method.cpp
+++ b/src/mongo/db/index/hash_access_method.cpp
@@ -42,7 +42,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,