diff options
author | Dan Larkin-York <dan.larkin-york@mongodb.com> | 2021-02-09 20:07:17 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-11 21:01:26 +0000 |
commit | 2084b2b2baba4028d7cbc0cb3dc22222e25bb6f8 (patch) | |
tree | 75b1ca6d803d76166bb504452763c00e8e049e6c | |
parent | 13567cae5052e075150552f9e7c79f9ffbedfc59 (diff) | |
download | mongo-2084b2b2baba4028d7cbc0cb3dc22222e25bb6f8.tar.gz |
SERVER-50073 Error message when creating a mixed hashed/not hashed index should state the problem
-rw-r--r-- | src/mongo/db/catalog/multi_index_block.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/index/hash_access_method.cpp | 2 |
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, |