summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage
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/storage
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/storage')
-rw-r--r--src/mongo/db/storage/biggie/biggie_kv_engine.cpp7
-rw-r--r--src/mongo/db/storage/biggie/biggie_kv_engine.h5
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.cpp7
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.h5
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp23
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.h13
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp5
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h5
-rw-r--r--src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp5
-rw-r--r--src/mongo/db/storage/kv/kv_engine.h13
-rw-r--r--src/mongo/db/storage/kv/kv_engine_test_harness.cpp4
-rw-r--r--src/mongo/db/storage/mobile/mobile_kv_engine.cpp9
-rw-r--r--src/mongo/db/storage/mobile/mobile_kv_engine.h5
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp10
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h13
15 files changed, 71 insertions, 58 deletions
diff --git a/src/mongo/db/storage/biggie/biggie_kv_engine.cpp b/src/mongo/db/storage/biggie/biggie_kv_engine.cpp
index 3aeefdf59c2..d0c4a4b987a 100644
--- a/src/mongo/db/storage/biggie/biggie_kv_engine.cpp
+++ b/src/mongo/db/storage/biggie/biggie_kv_engine.cpp
@@ -111,10 +111,11 @@ Status KVEngine::createSortedDataInterface(OperationContext* opCtx,
return Status::OK(); // I don't think we actually need to do anything here
}
-std::unique_ptr<mongo::SortedDataInterface> KVEngine::getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc) {
+mongo::SortedDataInterface* KVEngine::getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc) {
_idents[ident.toString()] = false;
- return std::make_unique<SortedDataInterface>(opCtx, ident, desc);
+ return new SortedDataInterface(opCtx, ident, desc);
}
Status KVEngine::dropIdent(OperationContext* opCtx, StringData ident) {
diff --git a/src/mongo/db/storage/biggie/biggie_kv_engine.h b/src/mongo/db/storage/biggie/biggie_kv_engine.h
index e41f334a329..e14a879bef6 100644
--- a/src/mongo/db/storage/biggie/biggie_kv_engine.h
+++ b/src/mongo/db/storage/biggie/biggie_kv_engine.h
@@ -70,8 +70,9 @@ public:
StringData ident,
const IndexDescriptor* desc);
- virtual std::unique_ptr<mongo::SortedDataInterface> getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc);
+ virtual mongo::SortedDataInterface* getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc);
virtual Status beginBackup(OperationContext* opCtx) {
return Status::OK();
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
index 6500879bde3..b53c345ceed 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
@@ -256,9 +256,10 @@ std::unique_ptr<RecordStore> DevNullKVEngine::makeTemporaryRecordStore(Operation
return std::make_unique<DevNullRecordStore>("", CollectionOptions());
}
-std::unique_ptr<SortedDataInterface> DevNullKVEngine::getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc) {
- return std::make_unique<DevNullSortedDataInterface>();
+SortedDataInterface* DevNullKVEngine::getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc) {
+ return new DevNullSortedDataInterface();
}
int64_t DevNullKVEngine::getCacheOverflowTableInsertCount(OperationContext* opCtx) const {
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.h b/src/mongo/db/storage/devnull/devnull_kv_engine.h
index 33fe29d38f4..d73f5a97768 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.h
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.h
@@ -70,8 +70,9 @@ public:
return Status::OK();
}
- virtual std::unique_ptr<SortedDataInterface> getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc);
+ virtual SortedDataInterface* getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc);
virtual Status dropIdent(OperationContext* opCtx, StringData ident) {
return Status::OK();
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp
index c82d629a2af..d9fa673dba5 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp
@@ -521,22 +521,21 @@ private:
// IndexCatalogEntry argument taken by non-const pointer for consistency with other Btree
// factories. We don't actually modify it.
-std::unique_ptr<SortedDataInterface> getEphemeralForTestBtreeImpl(
- const Ordering& ordering,
- bool isUnique,
- const NamespaceString& collectionNamespace,
- const std::string& indexName,
- const BSONObj& keyPattern,
- std::shared_ptr<void>* dataInOut) {
+SortedDataInterface* getEphemeralForTestBtreeImpl(const Ordering& ordering,
+ bool isUnique,
+ const NamespaceString& collectionNamespace,
+ const std::string& indexName,
+ const BSONObj& keyPattern,
+ std::shared_ptr<void>* dataInOut) {
invariant(dataInOut);
if (!*dataInOut) {
*dataInOut = std::make_shared<IndexSet>(IndexEntryComparison(ordering));
}
- return std::make_unique<EphemeralForTestBtreeImpl>(static_cast<IndexSet*>(dataInOut->get()),
- isUnique,
- collectionNamespace,
- indexName,
- keyPattern);
+ return new EphemeralForTestBtreeImpl(static_cast<IndexSet*>(dataInOut->get()),
+ isUnique,
+ collectionNamespace,
+ indexName,
+ keyPattern);
}
} // namespace mongo
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.h
index 60431c1cfa7..2b8b566e711 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.h
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.h
@@ -40,12 +40,11 @@ class IndexCatalogEntry;
* Caller takes ownership.
* All permanent data will be stored and fetch from dataInOut.
*/
-std::unique_ptr<SortedDataInterface> getEphemeralForTestBtreeImpl(
- const Ordering& ordering,
- bool isUnique,
- const NamespaceString& collectionNamespace,
- const std::string& indexName,
- const BSONObj& keyPattern,
- std::shared_ptr<void>* dataInOut);
+SortedDataInterface* getEphemeralForTestBtreeImpl(const Ordering& ordering,
+ bool isUnique,
+ const NamespaceString& collectionNamespace,
+ const std::string& indexName,
+ const BSONObj& keyPattern,
+ std::shared_ptr<void>* dataInOut);
} // namespace mongo
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp
index 0cb25117917..782c425ffd0 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp
@@ -92,8 +92,9 @@ Status EphemeralForTestEngine::createSortedDataInterface(OperationContext* opCtx
return Status::OK();
}
-std::unique_ptr<SortedDataInterface> EphemeralForTestEngine::getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc) {
+SortedDataInterface* EphemeralForTestEngine::getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc) {
stdx::lock_guard<stdx::mutex> lk(_mutex);
return getEphemeralForTestBtreeImpl(Ordering::make(desc->keyPattern()),
desc->unique(),
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h
index a499bba6b67..008c0084587 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h
@@ -61,8 +61,9 @@ public:
StringData ident,
const IndexDescriptor* desc);
- virtual std::unique_ptr<SortedDataInterface> getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc);
+ virtual SortedDataInterface* getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc);
virtual Status beginBackup(OperationContext* opCtx) {
return Status::OK();
diff --git a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp
index 064a5ee66e6..e5fad9811a5 100644
--- a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp
+++ b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp
@@ -71,8 +71,9 @@ public:
const CollectionOptions& options) override {
return {};
}
- std::unique_ptr<SortedDataInterface> getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc) override {
+ SortedDataInterface* getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc) override {
return nullptr;
}
Status createRecordStore(OperationContext* opCtx,
diff --git a/src/mongo/db/storage/kv/kv_engine.h b/src/mongo/db/storage/kv/kv_engine.h
index e6801dab6c7..4f622259075 100644
--- a/src/mongo/db/storage/kv/kv_engine.h
+++ b/src/mongo/db/storage/kv/kv_engine.h
@@ -39,7 +39,6 @@
#include "mongo/db/catalog/collection_options.h"
#include "mongo/db/storage/kv/kv_prefix.h"
#include "mongo/db/storage/record_store.h"
-#include "mongo/db/storage/sorted_data_interface.h"
#include "mongo/db/storage/storage_engine.h"
namespace mongo {
@@ -48,6 +47,7 @@ class IndexDescriptor;
class JournalListener;
class OperationContext;
class RecoveryUnit;
+class SortedDataInterface;
class SnapshotManager;
class KVEngine {
@@ -87,8 +87,9 @@ public:
return getRecordStore(opCtx, ns, ident, options);
}
- virtual std::unique_ptr<SortedDataInterface> getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc) = 0;
+ virtual SortedDataInterface* getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc) = 0;
/**
* Get a SortedDataInterface that may share an underlying table with other
@@ -99,8 +100,10 @@ public:
* between indexes sharing an underlying table. A value of `KVPrefix::kNotPrefixed`
* guarantees the index is the sole resident of the table.
*/
- virtual std::unique_ptr<SortedDataInterface> getGroupedSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc, KVPrefix prefix) {
+ virtual SortedDataInterface* getGroupedSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc,
+ KVPrefix prefix) {
invariant(prefix == KVPrefix::kNotPrefixed);
return getSortedDataInterface(opCtx, ident, desc);
}
diff --git a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp
index 22cb8778836..afd0cbb68b8 100644
--- a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp
+++ b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp
@@ -182,7 +182,7 @@ TEST(KVEngineTestHarness, SimpleSorted1) {
{
MyOperationContext opCtx(engine);
ASSERT_OK(engine->createSortedDataInterface(&opCtx, ident, &desc));
- sorted = engine->getSortedDataInterface(&opCtx, ident, &desc);
+ sorted.reset(engine->getSortedDataInterface(&opCtx, ident, &desc));
ASSERT(sorted);
}
@@ -725,7 +725,7 @@ DEATH_TEST_F(KVCatalogTest, TerminateOnNonNumericIndexVersion, "Fatal Assertion
{
MyOperationContext opCtx(engine);
ASSERT_OK(engine->createSortedDataInterface(&opCtx, ident, &desc));
- sorted = engine->getSortedDataInterface(&opCtx, ident, &desc);
+ sorted.reset(engine->getSortedDataInterface(&opCtx, ident, &desc));
ASSERT(sorted);
}
}
diff --git a/src/mongo/db/storage/mobile/mobile_kv_engine.cpp b/src/mongo/db/storage/mobile/mobile_kv_engine.cpp
index 4c8b2401683..3426827ee1e 100644
--- a/src/mongo/db/storage/mobile/mobile_kv_engine.cpp
+++ b/src/mongo/db/storage/mobile/mobile_kv_engine.cpp
@@ -235,12 +235,13 @@ Status MobileKVEngine::createSortedDataInterface(OperationContext* opCtx,
return MobileIndex::create(opCtx, ident.toString());
}
-std::unique_ptr<SortedDataInterface> MobileKVEngine::getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc) {
+SortedDataInterface* MobileKVEngine::getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc) {
if (desc->unique()) {
- return std::make_unique<MobileIndexUnique>(opCtx, desc, ident.toString());
+ return new MobileIndexUnique(opCtx, desc, ident.toString());
}
- return std::make_unique<MobileIndexStandard>(opCtx, desc, ident.toString());
+ return new MobileIndexStandard(opCtx, desc, ident.toString());
}
Status MobileKVEngine::dropIdent(OperationContext* opCtx, StringData ident) {
diff --git a/src/mongo/db/storage/mobile/mobile_kv_engine.h b/src/mongo/db/storage/mobile/mobile_kv_engine.h
index 10da2d2e1a0..a2e6f7702f1 100644
--- a/src/mongo/db/storage/mobile/mobile_kv_engine.h
+++ b/src/mongo/db/storage/mobile/mobile_kv_engine.h
@@ -68,8 +68,9 @@ public:
StringData ident,
const IndexDescriptor* desc) override;
- std::unique_ptr<SortedDataInterface> getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc) override;
+ SortedDataInterface* getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc) override;
Status beginBackup(OperationContext* opCtx) override {
return Status::OK();
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index 9971b1e387d..7e8aa78c7d1 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -1281,13 +1281,15 @@ Status WiredTigerKVEngine::createGroupedSortedDataInterface(OperationContext* op
return wtRCToStatus(WiredTigerIndex::Create(opCtx, _uri(ident), config));
}
-std::unique_ptr<SortedDataInterface> WiredTigerKVEngine::getGroupedSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc, KVPrefix prefix) {
+SortedDataInterface* WiredTigerKVEngine::getGroupedSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc,
+ KVPrefix prefix) {
if (desc->unique()) {
- return std::make_unique<WiredTigerIndexUnique>(opCtx, _uri(ident), desc, prefix, _readOnly);
+ return new WiredTigerIndexUnique(opCtx, _uri(ident), desc, prefix, _readOnly);
}
- return std::make_unique<WiredTigerIndexStandard>(opCtx, _uri(ident), desc, prefix, _readOnly);
+ return new WiredTigerIndexStandard(opCtx, _uri(ident), desc, prefix, _readOnly);
}
std::unique_ptr<RecordStore> WiredTigerKVEngine::makeTemporaryRecordStore(OperationContext* opCtx,
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
index bf194231e61..1ad5243f710 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
@@ -123,8 +123,9 @@ public:
return createGroupedSortedDataInterface(opCtx, ident, desc, KVPrefix::kNotPrefixed);
}
- std::unique_ptr<SortedDataInterface> getSortedDataInterface(
- OperationContext* opCtx, StringData ident, const IndexDescriptor* desc) override {
+ SortedDataInterface* getSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc) override {
return getGroupedSortedDataInterface(opCtx, ident, desc, KVPrefix::kNotPrefixed);
}
@@ -145,10 +146,10 @@ public:
const IndexDescriptor* desc,
KVPrefix prefix) override;
- std::unique_ptr<SortedDataInterface> getGroupedSortedDataInterface(OperationContext* opCtx,
- StringData ident,
- const IndexDescriptor* desc,
- KVPrefix prefix) override;
+ SortedDataInterface* getGroupedSortedDataInterface(OperationContext* opCtx,
+ StringData ident,
+ const IndexDescriptor* desc,
+ KVPrefix prefix) override;
Status dropIdent(OperationContext* opCtx, StringData ident) override;