diff options
author | Xiangyu Yao <xiangyu.yao@mongodb.com> | 2018-08-03 14:22:13 -0400 |
---|---|---|
committer | Xiangyu Yao <xiangyu.yao@mongodb.com> | 2018-08-13 19:20:21 -0400 |
commit | ab5cf1f214277536f1d4d2d1dc1fa319af911bbe (patch) | |
tree | 4965379813dc8ebb75bc1848d484d95996f3f093 /src/mongo/db/fts | |
parent | c764ee142f633b3a88954f336b11633e1baeffdc (diff) | |
download | mongo-ab5cf1f214277536f1d4d2d1dc1fa319af911bbe.tar.gz |
SERVER-22078 Remove term list limits for text index in FCV 4.2
Diffstat (limited to 'src/mongo/db/fts')
-rw-r--r-- | src/mongo/db/fts/fts_index_format.cpp | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/mongo/db/fts/fts_index_format.cpp b/src/mongo/db/fts/fts_index_format.cpp index 770930e90c1..2b0477a5d31 100644 --- a/src/mongo/db/fts/fts_index_format.cpp +++ b/src/mongo/db/fts/fts_index_format.cpp @@ -36,6 +36,7 @@ #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/fts/fts_index_format.h" #include "mongo/db/fts/fts_spec.h" +#include "mongo/db/server_options.h" #include "mongo/util/hex.h" #include "mongo/util/md5.hpp" #include "mongo/util/mongoutils/str.h" @@ -160,12 +161,17 @@ void FTSIndexFormat::getKeys(const FTSSpec& spec, const BSONObj& obj, BSONObjSet // create index keys from raw scores // only 1 per string - uassert(16732, - mongoutils::str::stream() << "too many unique keys for a single document to" - << " have a text index, max is " - << term_freqs.size() - << obj["_id"], - term_freqs.size() <= 400000); + // TODO SERVER-36440: Completely remove this limit in 4.3. + if (serverGlobalParams.featureCompatibility.isVersionInitialized() && + serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40) { + uassert(16732, + mongoutils::str::stream() << "too many unique keys for a single document to" + << " have a text index, max is " + << term_freqs.size() + << obj["_id"], + term_freqs.size() <= 400000); + } long long keyBSONSize = 0; const int MaxKeyBSONSizeMB = 4; @@ -194,13 +200,18 @@ void FTSIndexFormat::getKeys(const FTSSpec& spec, const BSONObj& obj, BSONObjSet keys->insert(res); keyBSONSize += res.objsize(); - uassert(16733, - mongoutils::str::stream() - << "trying to index text where term list is too big, max is " - << MaxKeyBSONSizeMB - << "mb " - << obj["_id"], - keyBSONSize <= (MaxKeyBSONSizeMB * 1024 * 1024)); + // TODO SERVER-36440: Completely remove this limit in 4.3. + if (serverGlobalParams.featureCompatibility.isVersionInitialized() && + serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40) { + uassert(16733, + mongoutils::str::stream() + << "trying to index text where term list is too big, max is " + << MaxKeyBSONSizeMB + << "mb " + << obj["_id"], + keyBSONSize <= (MaxKeyBSONSizeMB * 1024 * 1024)); + } } } |