summaryrefslogtreecommitdiff
path: root/src/mongo/db/index
diff options
context:
space:
mode:
authorZach Yam <zach.yam@mongodb.com>2019-06-13 13:06:39 -0400
committerZach Yam <zach.yam@mongodb.com>2019-06-13 13:06:39 -0400
commit0eb5d53338bfcff847ce1b9e34b7344dcaf9ed84 (patch)
treec067050a455532031d78652b85c59d59e12cff95 /src/mongo/db/index
parentbde7615a648ad9bacef680bc5144dcc8c308f6f4 (diff)
downloadmongo-0eb5d53338bfcff847ce1b9e34b7344dcaf9ed84.tar.gz
Revert "Make get(Grouped)SortedDataInterface return a unique pointer"
This reverts commit 90a74a50044d4daff7fa66e050bd76e70a0c7e56.
Diffstat (limited to 'src/mongo/db/index')
-rw-r--r--src/mongo/db/index/2d_access_method.cpp5
-rw-r--r--src/mongo/db/index/2d_access_method.h2
-rw-r--r--src/mongo/db/index/btree_access_method.cpp5
-rw-r--r--src/mongo/db/index/btree_access_method.h2
-rw-r--r--src/mongo/db/index/fts_access_method.cpp6
-rw-r--r--src/mongo/db/index/fts_access_method.h2
-rw-r--r--src/mongo/db/index/hash_access_method.cpp5
-rw-r--r--src/mongo/db/index/hash_access_method.h2
-rw-r--r--src/mongo/db/index/haystack_access_method.cpp4
-rw-r--r--src/mongo/db/index/haystack_access_method.h2
-rw-r--r--src/mongo/db/index/index_access_method.cpp6
-rw-r--r--src/mongo/db/index/index_access_method.h7
-rw-r--r--src/mongo/db/index/index_access_method_factory_impl.cpp16
-rw-r--r--src/mongo/db/index/index_access_method_factory_impl.h4
-rw-r--r--src/mongo/db/index/s2_access_method.cpp5
-rw-r--r--src/mongo/db/index/s2_access_method.h2
-rw-r--r--src/mongo/db/index/wildcard_access_method.cpp4
-rw-r--r--src/mongo/db/index/wildcard_access_method.h3
18 files changed, 36 insertions, 46 deletions
diff --git a/src/mongo/db/index/2d_access_method.cpp b/src/mongo/db/index/2d_access_method.cpp
index efd9c56b4f6..99f52b5e5ed 100644
--- a/src/mongo/db/index/2d_access_method.cpp
+++ b/src/mongo/db/index/2d_access_method.cpp
@@ -41,9 +41,8 @@
namespace mongo {
-TwoDAccessMethod::TwoDAccessMethod(IndexCatalogEntry* btreeState,
- std::unique_ptr<SortedDataInterface> btree)
- : AbstractIndexAccessMethod(btreeState, std::move(btree)) {
+TwoDAccessMethod::TwoDAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree)
+ : AbstractIndexAccessMethod(btreeState, btree) {
const IndexDescriptor* descriptor = btreeState->descriptor();
ExpressionParams::parseTwoDParams(descriptor->infoObj(), &_params);
diff --git a/src/mongo/db/index/2d_access_method.h b/src/mongo/db/index/2d_access_method.h
index 9e40c7aa2fc..0d350f99869 100644
--- a/src/mongo/db/index/2d_access_method.h
+++ b/src/mongo/db/index/2d_access_method.h
@@ -42,7 +42,7 @@ struct TwoDIndexingParams;
class TwoDAccessMethod : public AbstractIndexAccessMethod {
public:
- TwoDAccessMethod(IndexCatalogEntry* btreeState, std::unique_ptr<SortedDataInterface> btree);
+ TwoDAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree);
private:
const IndexDescriptor* getDescriptor() {
diff --git a/src/mongo/db/index/btree_access_method.cpp b/src/mongo/db/index/btree_access_method.cpp
index 51d4ba3acbe..c96fcfc1dc8 100644
--- a/src/mongo/db/index/btree_access_method.cpp
+++ b/src/mongo/db/index/btree_access_method.cpp
@@ -42,9 +42,8 @@ namespace mongo {
using std::vector;
// Standard Btree implementation below.
-BtreeAccessMethod::BtreeAccessMethod(IndexCatalogEntry* btreeState,
- std::unique_ptr<SortedDataInterface> btree)
- : AbstractIndexAccessMethod(btreeState, std::move(btree)) {
+BtreeAccessMethod::BtreeAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree)
+ : AbstractIndexAccessMethod(btreeState, btree) {
// The key generation wants these values.
vector<const char*> fieldNames;
vector<BSONElement> fixed;
diff --git a/src/mongo/db/index/btree_access_method.h b/src/mongo/db/index/btree_access_method.h
index 3af203d1f78..126c1fa86eb 100644
--- a/src/mongo/db/index/btree_access_method.h
+++ b/src/mongo/db/index/btree_access_method.h
@@ -45,7 +45,7 @@ class IndexDescriptor;
*/
class BtreeAccessMethod : public AbstractIndexAccessMethod {
public:
- BtreeAccessMethod(IndexCatalogEntry* btreeState, std::unique_ptr<SortedDataInterface> btree);
+ BtreeAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree);
private:
void doGetKeys(const BSONObj& obj,
diff --git a/src/mongo/db/index/fts_access_method.cpp b/src/mongo/db/index/fts_access_method.cpp
index 46f20b77b78..2912569dfb4 100644
--- a/src/mongo/db/index/fts_access_method.cpp
+++ b/src/mongo/db/index/fts_access_method.cpp
@@ -34,10 +34,8 @@
namespace mongo {
-FTSAccessMethod::FTSAccessMethod(IndexCatalogEntry* btreeState,
- std::unique_ptr<SortedDataInterface> btree)
- : AbstractIndexAccessMethod(btreeState, std::move(btree)),
- _ftsSpec(btreeState->descriptor()->infoObj()) {}
+FTSAccessMethod::FTSAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree)
+ : AbstractIndexAccessMethod(btreeState, btree), _ftsSpec(btreeState->descriptor()->infoObj()) {}
void FTSAccessMethod::doGetKeys(const BSONObj& obj,
BSONObjSet* keys,
diff --git a/src/mongo/db/index/fts_access_method.h b/src/mongo/db/index/fts_access_method.h
index f4ec0c14468..dbd0a6eb175 100644
--- a/src/mongo/db/index/fts_access_method.h
+++ b/src/mongo/db/index/fts_access_method.h
@@ -39,7 +39,7 @@ namespace mongo {
class FTSAccessMethod : public AbstractIndexAccessMethod {
public:
- FTSAccessMethod(IndexCatalogEntry* btreeState, std::unique_ptr<SortedDataInterface> btree);
+ FTSAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree);
const fts::FTSSpec& getSpec() const {
return _ftsSpec;
diff --git a/src/mongo/db/index/hash_access_method.cpp b/src/mongo/db/index/hash_access_method.cpp
index 3aae1930d40..c78a3f1cf9f 100644
--- a/src/mongo/db/index/hash_access_method.cpp
+++ b/src/mongo/db/index/hash_access_method.cpp
@@ -36,9 +36,8 @@
namespace mongo {
-HashAccessMethod::HashAccessMethod(IndexCatalogEntry* btreeState,
- std::unique_ptr<SortedDataInterface> btree)
- : AbstractIndexAccessMethod(btreeState, std::move(btree)) {
+HashAccessMethod::HashAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree)
+ : AbstractIndexAccessMethod(btreeState, btree) {
const IndexDescriptor* descriptor = btreeState->descriptor();
// We can change these if the single-field limitation is lifted later.
diff --git a/src/mongo/db/index/hash_access_method.h b/src/mongo/db/index/hash_access_method.h
index e96ce878625..a11403ff784 100644
--- a/src/mongo/db/index/hash_access_method.h
+++ b/src/mongo/db/index/hash_access_method.h
@@ -46,7 +46,7 @@ class CollatorInterface;
*/
class HashAccessMethod : public AbstractIndexAccessMethod {
public:
- HashAccessMethod(IndexCatalogEntry* btreeState, std::unique_ptr<SortedDataInterface> btree);
+ HashAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree);
private:
/**
diff --git a/src/mongo/db/index/haystack_access_method.cpp b/src/mongo/db/index/haystack_access_method.cpp
index 93be4804030..bbfa78b1b35 100644
--- a/src/mongo/db/index/haystack_access_method.cpp
+++ b/src/mongo/db/index/haystack_access_method.cpp
@@ -53,8 +53,8 @@ using std::unique_ptr;
namespace dps = ::mongo::dotted_path_support;
HaystackAccessMethod::HaystackAccessMethod(IndexCatalogEntry* btreeState,
- std::unique_ptr<SortedDataInterface> btree)
- : AbstractIndexAccessMethod(btreeState, std::move(btree)) {
+ SortedDataInterface* btree)
+ : AbstractIndexAccessMethod(btreeState, btree) {
const IndexDescriptor* descriptor = btreeState->descriptor();
ExpressionParams::parseHaystackParams(
diff --git a/src/mongo/db/index/haystack_access_method.h b/src/mongo/db/index/haystack_access_method.h
index 6c609e04cde..99ab21dfde4 100644
--- a/src/mongo/db/index/haystack_access_method.h
+++ b/src/mongo/db/index/haystack_access_method.h
@@ -57,7 +57,7 @@ class OperationContext;
*/
class HaystackAccessMethod : public AbstractIndexAccessMethod {
public:
- HaystackAccessMethod(IndexCatalogEntry* btreeState, std::unique_ptr<SortedDataInterface> btree);
+ HaystackAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree);
protected:
friend class GeoHaystackSearchCommand;
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp
index 4fd9a9264bc..da5fd8cf64a 100644
--- a/src/mongo/db/index/index_access_method.cpp
+++ b/src/mongo/db/index/index_access_method.cpp
@@ -131,10 +131,8 @@ private:
};
AbstractIndexAccessMethod::AbstractIndexAccessMethod(IndexCatalogEntry* btreeState,
- std::unique_ptr<SortedDataInterface> btree)
- : _btreeState(btreeState),
- _descriptor(btreeState->descriptor()),
- _newInterface(std::move(btree)) {
+ SortedDataInterface* btree)
+ : _btreeState(btreeState), _descriptor(btreeState->descriptor()), _newInterface(btree) {
verify(IndexDescriptor::isIndexVersionSupported(_descriptor->version()));
}
diff --git a/src/mongo/db/index/index_access_method.h b/src/mongo/db/index/index_access_method.h
index 39e98a3dfbb..91b35a95ddb 100644
--- a/src/mongo/db/index/index_access_method.h
+++ b/src/mongo/db/index/index_access_method.h
@@ -364,8 +364,8 @@ public:
static void set(ServiceContext* service,
std::unique_ptr<IndexAccessMethodFactory> collectionFactory);
- virtual std::unique_ptr<IndexAccessMethod> make(
- IndexCatalogEntry* entry, std::unique_ptr<SortedDataInterface> sortedDataInterface) = 0;
+ virtual std::unique_ptr<IndexAccessMethod> make(IndexCatalogEntry* entry,
+ SortedDataInterface* sortedDataInterface) = 0;
};
/**
@@ -449,8 +449,7 @@ public:
static std::pair<std::vector<BSONObj>, std::vector<BSONObj>> setDifference(
const BSONObjSet& left, const BSONObjSet& right);
- AbstractIndexAccessMethod(IndexCatalogEntry* btreeState,
- std::unique_ptr<SortedDataInterface> btree);
+ AbstractIndexAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree);
Status insert(OperationContext* opCtx,
const BSONObj& obj,
diff --git a/src/mongo/db/index/index_access_method_factory_impl.cpp b/src/mongo/db/index/index_access_method_factory_impl.cpp
index 2eb06511d1b..485bfac25b7 100644
--- a/src/mongo/db/index/index_access_method_factory_impl.cpp
+++ b/src/mongo/db/index/index_access_method_factory_impl.cpp
@@ -45,23 +45,23 @@
namespace mongo {
std::unique_ptr<IndexAccessMethod> IndexAccessMethodFactoryImpl::make(
- IndexCatalogEntry* entry, std::unique_ptr<SortedDataInterface> sortedDataInterface) {
+ IndexCatalogEntry* entry, SortedDataInterface* sortedDataInterface) {
auto desc = entry->descriptor();
const std::string& type = desc->getAccessMethodName();
if ("" == type)
- return std::make_unique<BtreeAccessMethod>(entry, std::move(sortedDataInterface));
+ return std::make_unique<BtreeAccessMethod>(entry, sortedDataInterface);
else if (IndexNames::HASHED == type)
- return std::make_unique<HashAccessMethod>(entry, std::move(sortedDataInterface));
+ return std::make_unique<HashAccessMethod>(entry, sortedDataInterface);
else if (IndexNames::GEO_2DSPHERE == type)
- return std::make_unique<S2AccessMethod>(entry, std::move(sortedDataInterface));
+ return std::make_unique<S2AccessMethod>(entry, sortedDataInterface);
else if (IndexNames::TEXT == type)
- return std::make_unique<FTSAccessMethod>(entry, std::move(sortedDataInterface));
+ return std::make_unique<FTSAccessMethod>(entry, sortedDataInterface);
else if (IndexNames::GEO_HAYSTACK == type)
- return std::make_unique<HaystackAccessMethod>(entry, std::move(sortedDataInterface));
+ return std::make_unique<HaystackAccessMethod>(entry, sortedDataInterface);
else if (IndexNames::GEO_2D == type)
- return std::make_unique<TwoDAccessMethod>(entry, std::move(sortedDataInterface));
+ return std::make_unique<TwoDAccessMethod>(entry, sortedDataInterface);
else if (IndexNames::WILDCARD == type)
- return std::make_unique<WildcardAccessMethod>(entry, std::move(sortedDataInterface));
+ return std::make_unique<WildcardAccessMethod>(entry, sortedDataInterface);
log() << "Can't find index for keyPattern " << desc->keyPattern();
fassertFailed(31021);
}
diff --git a/src/mongo/db/index/index_access_method_factory_impl.h b/src/mongo/db/index/index_access_method_factory_impl.h
index dae1a2204ac..7c89e702d0e 100644
--- a/src/mongo/db/index/index_access_method_factory_impl.h
+++ b/src/mongo/db/index/index_access_method_factory_impl.h
@@ -38,8 +38,8 @@ public:
IndexAccessMethodFactoryImpl() = default;
~IndexAccessMethodFactoryImpl() = default;
- std::unique_ptr<IndexAccessMethod> make(
- IndexCatalogEntry* entry, std::unique_ptr<SortedDataInterface> SortedDataInterface) final;
+ std::unique_ptr<IndexAccessMethod> make(IndexCatalogEntry* entry,
+ SortedDataInterface* SortedDataInterface) final;
};
} // namespace mongo
diff --git a/src/mongo/db/index/s2_access_method.cpp b/src/mongo/db/index/s2_access_method.cpp
index 3f9ac46d57e..731e0a14123 100644
--- a/src/mongo/db/index/s2_access_method.cpp
+++ b/src/mongo/db/index/s2_access_method.cpp
@@ -47,9 +47,8 @@ namespace mongo {
static const string kIndexVersionFieldName("2dsphereIndexVersion");
-S2AccessMethod::S2AccessMethod(IndexCatalogEntry* btreeState,
- std::unique_ptr<SortedDataInterface> btree)
- : AbstractIndexAccessMethod(btreeState, std::move(btree)) {
+S2AccessMethod::S2AccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree)
+ : AbstractIndexAccessMethod(btreeState, btree) {
const IndexDescriptor* descriptor = btreeState->descriptor();
ExpressionParams::initialize2dsphereParams(
diff --git a/src/mongo/db/index/s2_access_method.h b/src/mongo/db/index/s2_access_method.h
index 4851f6fbc7d..164b38c5af5 100644
--- a/src/mongo/db/index/s2_access_method.h
+++ b/src/mongo/db/index/s2_access_method.h
@@ -40,7 +40,7 @@ namespace mongo {
class S2AccessMethod : public AbstractIndexAccessMethod {
public:
- S2AccessMethod(IndexCatalogEntry* btreeState, std::unique_ptr<SortedDataInterface> btree);
+ S2AccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree);
/**
* Takes an index spec object for this index and returns a copy tweaked to conform to the
diff --git a/src/mongo/db/index/wildcard_access_method.cpp b/src/mongo/db/index/wildcard_access_method.cpp
index 4269d3dcab2..cfa6adc1e46 100644
--- a/src/mongo/db/index/wildcard_access_method.cpp
+++ b/src/mongo/db/index/wildcard_access_method.cpp
@@ -38,8 +38,8 @@
namespace mongo {
WildcardAccessMethod::WildcardAccessMethod(IndexCatalogEntry* wildcardState,
- std::unique_ptr<SortedDataInterface> btree)
- : AbstractIndexAccessMethod(wildcardState, std::move(btree)),
+ SortedDataInterface* btree)
+ : AbstractIndexAccessMethod(wildcardState, btree),
_keyGen(
_descriptor->keyPattern(), _descriptor->pathProjection(), _btreeState->getCollator()) {}
diff --git a/src/mongo/db/index/wildcard_access_method.h b/src/mongo/db/index/wildcard_access_method.h
index 7fde78eb256..45d866c1020 100644
--- a/src/mongo/db/index/wildcard_access_method.h
+++ b/src/mongo/db/index/wildcard_access_method.h
@@ -56,8 +56,7 @@ public:
*/
static FieldRef extractMultikeyPathFromIndexKey(const IndexKeyEntry& entry);
- WildcardAccessMethod(IndexCatalogEntry* wildcardState,
- std::unique_ptr<SortedDataInterface> btree);
+ WildcardAccessMethod(IndexCatalogEntry* wildcardState, SortedDataInterface* btree);
/**
* Returns 'true' if the index should become multikey on the basis of the passed arguments.