summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaley Connelly <haley.connelly@10gen.com>2019-09-25 17:03:51 +0000
committerevergreen <evergreen@mongodb.com>2019-09-25 17:03:51 +0000
commit996f1ed14075eb66b87259181809507756737870 (patch)
tree6b7d2bc381ab08411967fc34384bc86088279e81 /src
parent55c54c3c287d07ba2764521a085dff9add20b505 (diff)
downloadmongo-996f1ed14075eb66b87259181809507756737870.tar.gz
SERVER-42524 remove the touch command
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/collection.h8
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp32
-rw-r--r--src/mongo/db/catalog/collection_impl.h8
-rw-r--r--src/mongo/db/catalog/collection_mock.h7
-rw-r--r--src/mongo/db/commands/SConscript1
-rw-r--r--src/mongo/db/commands/touch.cpp113
-rw-r--r--src/mongo/db/index/index_access_method.cpp21
-rw-r--r--src/mongo/db/index/index_access_method.h17
-rw-r--r--src/mongo/db/storage/SConscript2
-rw-r--r--src/mongo/db/storage/biggie/biggie_record_store.cpp4
-rw-r--r--src/mongo/db/storage/biggie/biggie_record_store.h2
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.cpp4
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp5
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp8
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h2
-rw-r--r--src/mongo/db/storage/mobile/mobile_record_store.cpp4
-rw-r--r--src/mongo/db/storage/mobile/mobile_record_store.h2
-rw-r--r--src/mongo/db/storage/record_store.h14
-rw-r--r--src/mongo/db/storage/record_store_test_touch.cpp173
-rw-r--r--src/mongo/db/storage/sorted_data_interface.h13
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_touch.cpp90
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp9
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_index.h2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp8
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h2
-rw-r--r--src/mongo/dbtests/commandtests.cpp20
26 files changed, 0 insertions, 571 deletions
diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h
index ee12d90656d..492b0628e32 100644
--- a/src/mongo/db/catalog/collection.h
+++ b/src/mongo/db/catalog/collection.h
@@ -335,14 +335,6 @@ public:
virtual Status truncate(OperationContext* const opCtx) = 0;
/**
- * forces data into cache.
- */
- virtual Status touch(OperationContext* const opCtx,
- const bool touchData,
- const bool touchIndexes,
- BSONObjBuilder* const output) const = 0;
-
- /**
* Truncate documents newer than the document at 'end' from the capped
* collection. The collection cannot be completely emptied using this
* function. An assertion will be thrown if that is attempted.
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index dae155bdb28..61df6557190 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -1003,38 +1003,6 @@ StatusWith<std::vector<BSONObj>> CollectionImpl::addCollationDefaultsToIndexSpec
return newIndexSpecs;
}
-Status CollectionImpl::touch(OperationContext* opCtx,
- bool touchData,
- bool touchIndexes,
- BSONObjBuilder* output) const {
- if (touchData) {
- BSONObjBuilder b;
- Status status = _recordStore.get()->touch(opCtx, &b);
- if (!status.isOK())
- return status;
- output->append("data", b.obj());
- }
-
- if (touchIndexes) {
- Timer t;
- std::unique_ptr<IndexCatalog::IndexIterator> ii =
- _indexCatalog->getIndexIterator(opCtx, false);
- while (ii->more()) {
- const IndexCatalogEntry* entry = ii->next();
- const IndexAccessMethod* iam = entry->accessMethod();
- Status status = iam->touch(opCtx);
- if (!status.isOK())
- return status;
- }
-
- output->append(
- "indexes",
- BSON("num" << _indexCatalog->numIndexesTotal(opCtx) << "millis" << t.millis()));
- }
-
- return Status::OK();
-}
-
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> CollectionImpl::makePlanExecutor(
OperationContext* opCtx, PlanExecutor::YieldPolicy yieldPolicy, ScanDirection scanDirection) {
auto isForward = scanDirection == ScanDirection::kForward;
diff --git a/src/mongo/db/catalog/collection_impl.h b/src/mongo/db/catalog/collection_impl.h
index baf5e5a61f1..a33c507ecda 100644
--- a/src/mongo/db/catalog/collection_impl.h
+++ b/src/mongo/db/catalog/collection_impl.h
@@ -216,14 +216,6 @@ public:
Status truncate(OperationContext* opCtx) final;
/**
- * forces data into cache
- */
- Status touch(OperationContext* opCtx,
- bool touchData,
- bool touchIndexes,
- BSONObjBuilder* output) const final;
-
- /**
* Truncate documents newer than the document at 'end' from the capped
* collection. The collection cannot be completely emptied using this
* function. An assertion will be thrown if that is attempted.
diff --git a/src/mongo/db/catalog/collection_mock.h b/src/mongo/db/catalog/collection_mock.h
index 458fd31722b..c851d8ceb51 100644
--- a/src/mongo/db/catalog/collection_mock.h
+++ b/src/mongo/db/catalog/collection_mock.h
@@ -154,13 +154,6 @@ public:
std::abort();
}
- Status touch(OperationContext* opCtx,
- bool touchData,
- bool touchIndexes,
- BSONObjBuilder* output) const {
- std::abort();
- }
-
void cappedTruncateAfter(OperationContext* opCtx, RecordId end, bool inclusive) {
std::abort();
}
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index 0aee9dccb22..c46add8de57 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -364,7 +364,6 @@ env.Library(
"shutdown_d.cpp",
"snapshot_management.cpp",
"top_command.cpp",
- "touch.cpp",
"txn_cmds.cpp",
"user_management_commands.cpp",
"vote_commit_index_build_command.cpp",
diff --git a/src/mongo/db/commands/touch.cpp b/src/mongo/db/commands/touch.cpp
deleted file mode 100644
index 1ad4dd6c215..00000000000
--- a/src/mongo/db/commands/touch.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-/**
- * compaction of deleted space in pdfiles (datafiles)
- */
-
-#include "mongo/platform/basic.h"
-
-#include <string>
-#include <vector>
-
-#include "mongo/db/auth/action_set.h"
-#include "mongo/db/auth/action_type.h"
-#include "mongo/db/auth/privilege.h"
-#include "mongo/db/catalog/collection.h"
-#include "mongo/db/catalog/database.h"
-#include "mongo/db/client.h"
-#include "mongo/db/commands.h"
-#include "mongo/db/concurrency/d_concurrency.h"
-#include "mongo/db/db_raii.h"
-#include "mongo/db/jsobj.h"
-#include "mongo/util/timer.h"
-
-namespace mongo {
-namespace {
-
-class TouchCmd : public ErrmsgCommandDeprecated {
-public:
- virtual bool supportsWriteConcern(const BSONObj& cmd) const override {
- return false;
- }
- virtual bool adminOnly() const {
- return false;
- }
- AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
- return AllowedOnSecondary::kAlways;
- }
- virtual bool maintenanceMode() const {
- return true;
- }
- std::string help() const override {
- return "touch collection\n"
- "Page in all pages of memory containing every extent for the given collection\n"
- "{ touch : <collection_name>, [data : true] , [index : true] }\n"
- " at least one of data or index must be true; default is both are false\n";
- }
- virtual void addRequiredPrivileges(const std::string& dbname,
- const BSONObj& cmdObj,
- std::vector<Privilege>* out) const {
- ActionSet actions;
- actions.addAction(ActionType::touch);
- out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
- }
- TouchCmd() : ErrmsgCommandDeprecated("touch") {}
-
- virtual bool errmsgRun(OperationContext* opCtx,
- const std::string& dbname,
- const BSONObj& cmdObj,
- std::string& errmsg,
- BSONObjBuilder& result) {
- const NamespaceString nss = CommandHelpers::parseNsCollectionRequired(dbname, cmdObj);
-
- bool touch_indexes(cmdObj["index"].trueValue());
- bool touch_data(cmdObj["data"].trueValue());
-
- if (!(touch_indexes || touch_data)) {
- errmsg = "must specify at least one of (data:true, index:true)";
- return false;
- }
-
- AutoGetCollectionForReadCommand context(opCtx, nss);
-
- Collection* collection = context.getCollection();
- if (!collection) {
- errmsg = "collection not found";
- return false;
- }
-
- uassertStatusOK(collection->touch(opCtx, touch_data, touch_indexes, &result));
- return true;
- }
-
-} touchCmd;
-
-} // namespace
-} // namespace mongo
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp
index 0991681cdf9..05a93d4ebfe 100644
--- a/src/mongo/db/index/index_access_method.cpp
+++ b/src/mongo/db/index/index_access_method.cpp
@@ -229,27 +229,6 @@ Status AbstractIndexAccessMethod::initializeAsEmpty(OperationContext* opCtx) {
return _newInterface->initAsEmpty(opCtx);
}
-Status AbstractIndexAccessMethod::touch(OperationContext* opCtx, const BSONObj& obj) {
- KeyStringSet keys;
- // There's no need to compute the prefixes of the indexed fields that cause the index to be
- // multikey when paging a document's index entries into memory.
- KeyStringSet* multikeyMetadataKeys = nullptr;
- MultikeyPaths* multikeyPaths = nullptr;
- getKeys(obj, GetKeysMode::kEnforceConstraints, &keys, multikeyMetadataKeys, multikeyPaths);
-
- std::unique_ptr<SortedDataInterface::Cursor> cursor(_newInterface->newCursor(opCtx));
- for (const auto& keyString : keys) {
- cursor->seekExact(keyString);
- }
-
- return Status::OK();
-}
-
-
-Status AbstractIndexAccessMethod::touch(OperationContext* opCtx) const {
- return _newInterface->touch(opCtx);
-}
-
RecordId AbstractIndexAccessMethod::findSingle(OperationContext* opCtx,
const BSONObj& requestedKey) const {
// Generate the key for this index.
diff --git a/src/mongo/db/index/index_access_method.h b/src/mongo/db/index/index_access_method.h
index 344dc08c971..b769dfe5a08 100644
--- a/src/mongo/db/index/index_access_method.h
+++ b/src/mongo/db/index/index_access_method.h
@@ -155,19 +155,6 @@ public:
virtual Status initializeAsEmpty(OperationContext* opCtx) = 0;
/**
- * Try to page-in the pages that contain the keys generated from 'obj'.
- * This can be used to speed up future accesses to an index by trying to ensure the
- * appropriate pages are not swapped out.
- * See prefetch.cpp.
- */
- virtual Status touch(OperationContext* opCtx, const BSONObj& obj) = 0;
-
- /**
- * this pages in the entire index
- */
- virtual Status touch(OperationContext* opCtx) const = 0;
-
- /**
* Walk the entire index, checking the internal structure for consistency.
* Set numKeys to the number of keys in the index.
*/
@@ -486,10 +473,6 @@ public:
Status initializeAsEmpty(OperationContext* opCtx) final;
- Status touch(OperationContext* opCtx, const BSONObj& obj) final;
-
- Status touch(OperationContext* opCtx) const final;
-
void validate(OperationContext* opCtx,
int64_t* numKeys,
ValidateResults* fullResults) const final;
diff --git a/src/mongo/db/storage/SConscript b/src/mongo/db/storage/SConscript
index 38f2d9e5c13..44e3e5abb99 100644
--- a/src/mongo/db/storage/SConscript
+++ b/src/mongo/db/storage/SConscript
@@ -168,7 +168,6 @@ env.Library(
'sorted_data_interface_test_isempty.cpp',
'sorted_data_interface_test_rollback.cpp',
'sorted_data_interface_test_spaceused.cpp',
- 'sorted_data_interface_test_touch.cpp',
'sorted_data_interface_test_unindex.cpp',
],
LIBDEPS=[
@@ -196,7 +195,6 @@ env.Library(
'record_store_test_recorditer.cpp',
'record_store_test_recordstore.cpp',
'record_store_test_storagesize.cpp',
- 'record_store_test_touch.cpp',
'record_store_test_truncate.cpp',
'record_store_test_updaterecord.cpp',
'record_store_test_updatewithdamages.cpp',
diff --git a/src/mongo/db/storage/biggie/biggie_record_store.cpp b/src/mongo/db/storage/biggie/biggie_record_store.cpp
index 8e2aadc7041..ff113dc0982 100644
--- a/src/mongo/db/storage/biggie/biggie_record_store.cpp
+++ b/src/mongo/db/storage/biggie/biggie_record_store.cpp
@@ -298,10 +298,6 @@ void RecordStore::appendCustomStats(OperationContext* opCtx,
}
}
-Status RecordStore::touch(OperationContext* opCtx, BSONObjBuilder* output) const {
- return Status::OK(); // All data is already in 'cache'.
-}
-
void RecordStore::updateStatsAfterRepair(OperationContext* opCtx,
long long numRecords,
long long dataSize) {
diff --git a/src/mongo/db/storage/biggie/biggie_record_store.h b/src/mongo/db/storage/biggie/biggie_record_store.h
index 005d49ee293..d604ba51826 100644
--- a/src/mongo/db/storage/biggie/biggie_record_store.h
+++ b/src/mongo/db/storage/biggie/biggie_record_store.h
@@ -100,8 +100,6 @@ public:
BSONObjBuilder* result,
double scale) const;
- virtual Status touch(OperationContext* opCtx, BSONObjBuilder* output) const;
-
virtual boost::optional<RecordId> oplogStartHack(OperationContext* opCtx,
const RecordId& startingPosition) const;
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
index dbc5a724d7c..28b3a8037ce 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
@@ -145,10 +145,6 @@ public:
result->appendNumber("numInserts", _numInserts);
}
- virtual Status touch(OperationContext* opCtx, BSONObjBuilder* output) const {
- return Status::OK();
- }
-
void waitForAllEarlierOplogWritesToBeVisible(OperationContext* opCtx) const override {}
virtual void updateStatsAfterRepair(OperationContext* opCtx,
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 79222964c48..4568596e939 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
@@ -254,11 +254,6 @@ public:
return _data->empty();
}
- virtual Status touch(OperationContext* opCtx) const {
- // already in memory...
- return Status::OK();
- }
-
class Cursor final : public SortedDataInterface::Cursor {
public:
Cursor(OperationContext* opCtx,
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp
index cc49ab9fbd0..69e553375e0 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp
@@ -548,14 +548,6 @@ void EphemeralForTestRecordStore::appendCustomStats(OperationContext* opCtx,
}
}
-Status EphemeralForTestRecordStore::touch(OperationContext* opCtx, BSONObjBuilder* output) const {
- if (output) {
- output->append("numRanges", 1);
- output->append("millis", 0);
- }
- return Status::OK();
-}
-
int64_t EphemeralForTestRecordStore::storageSize(OperationContext* opCtx,
BSONObjBuilder* extraInfo,
int infoLevel) const {
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h
index 3bd7ffb0ce5..a29bc0fa014 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h
@@ -95,8 +95,6 @@ public:
BSONObjBuilder* result,
double scale) const;
- virtual Status touch(OperationContext* opCtx, BSONObjBuilder* output) const;
-
virtual int64_t storageSize(OperationContext* opCtx,
BSONObjBuilder* extraInfo = nullptr,
int infoLevel = 0) const;
diff --git a/src/mongo/db/storage/mobile/mobile_record_store.cpp b/src/mongo/db/storage/mobile/mobile_record_store.cpp
index f60142d95fe..e07dd4ecb7b 100644
--- a/src/mongo/db/storage/mobile/mobile_record_store.cpp
+++ b/src/mongo/db/storage/mobile/mobile_record_store.cpp
@@ -390,10 +390,6 @@ void MobileRecordStore::validate(OperationContext* opCtx,
embedded::doValidate(opCtx, results);
}
-Status MobileRecordStore::touch(OperationContext* opCtx, BSONObjBuilder* output) const {
- return Status(ErrorCodes::CommandNotSupported, "this storage engine does not support touch");
-}
-
/**
* Note: does not accurately return the size of the table on disk. Instead, it returns the number of
* bytes used to store the BSON documents.
diff --git a/src/mongo/db/storage/mobile/mobile_record_store.h b/src/mongo/db/storage/mobile/mobile_record_store.h
index d9457edd985..d595ec980e0 100644
--- a/src/mongo/db/storage/mobile/mobile_record_store.h
+++ b/src/mongo/db/storage/mobile/mobile_record_store.h
@@ -98,8 +98,6 @@ public:
// No custom stats to add
}
- Status touch(OperationContext* opCtx, BSONObjBuilder* output) const override;
-
int64_t storageSize(OperationContext* opCtx,
BSONObjBuilder* extraInfo = nullptr,
int infoLevel = 0) const override;
diff --git a/src/mongo/db/storage/record_store.h b/src/mongo/db/storage/record_store.h
index 2e06f17ead2..ee5793c128d 100644
--- a/src/mongo/db/storage/record_store.h
+++ b/src/mongo/db/storage/record_store.h
@@ -450,20 +450,6 @@ public:
double scale) const = 0;
/**
- * Load all data into cache.
- * What cache depends on implementation.
- *
- * If the underlying storage engine does not support the operation,
- * returns ErrorCodes::CommandNotSupported
- *
- * @param output (optional) - where to put detailed stats
- */
- virtual Status touch(OperationContext* opCtx, BSONObjBuilder* output) const {
- return Status(ErrorCodes::CommandNotSupported,
- "this storage engine does not support touch");
- }
-
- /**
* Return the RecordId of an oplog entry as close to startingPosition as possible without
* being higher. If there are no entries <= startingPosition, return RecordId().
*
diff --git a/src/mongo/db/storage/record_store_test_touch.cpp b/src/mongo/db/storage/record_store_test_touch.cpp
deleted file mode 100644
index ead23584b87..00000000000
--- a/src/mongo/db/storage/record_store_test_touch.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/storage/record_store_test_harness.h"
-
-
-#include "mongo/db/storage/record_store.h"
-#include "mongo/unittest/unittest.h"
-
-namespace mongo {
-namespace {
-
-using std::string;
-using std::stringstream;
-using std::unique_ptr;
-
-// Verify that calling touch() on an empty collection returns an OK status.
-TEST(RecordStoreTestHarness, TouchEmpty) {
- const auto harnessHelper(newRecordStoreHarnessHelper());
- unique_ptr<RecordStore> rs(harnessHelper->newNonCappedRecordStore());
-
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT_EQUALS(0, rs->numRecords(opCtx.get()));
- }
-
- {
- ServiceContext::UniqueOperationContext opCtx(
- harnessHelper->newOperationContext(harnessHelper->client()));
- {
- BSONObjBuilder stats;
- Status status = rs->touch(opCtx.get(), &stats);
- ASSERT(status.isOK() || status.code() == ErrorCodes::CommandNotSupported);
- }
- }
-}
-
-// Insert multiple records, and verify that calling touch() on a nonempty collection
-// returns an OK status.
-TEST(RecordStoreTestHarness, TouchNonEmpty) {
- const auto harnessHelper(newRecordStoreHarnessHelper());
- unique_ptr<RecordStore> rs(harnessHelper->newNonCappedRecordStore());
-
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT_EQUALS(0, rs->numRecords(opCtx.get()));
- }
-
- int nToInsert = 10;
- for (int i = 0; i < nToInsert; i++) {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- {
- stringstream ss;
- ss << "record " << i;
- string data = ss.str();
-
- WriteUnitOfWork uow(opCtx.get());
- StatusWith<RecordId> res =
- rs->insertRecord(opCtx.get(), data.c_str(), data.size() + 1, Timestamp());
- ASSERT_OK(res.getStatus());
- uow.commit();
- }
- }
-
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT_EQUALS(nToInsert, rs->numRecords(opCtx.get()));
- }
-
- {
- ServiceContext::UniqueOperationContext opCtx(
- harnessHelper->newOperationContext(harnessHelper->client()));
- {
- BSONObjBuilder stats;
- // XXX does not verify the collection was loaded into cache
- // (even if supported by storage engine)
- Status status = rs->touch(opCtx.get(), &stats);
- ASSERT(status.isOK() || status.code() == ErrorCodes::CommandNotSupported);
- }
- }
-}
-
-// Verify that calling touch() on an empty collection returns an OK status,
-// even when NULL is passed in for the stats output.
-TEST(RecordStoreTestHarness, TouchEmptyWithNullStats) {
- const auto harnessHelper(newRecordStoreHarnessHelper());
- unique_ptr<RecordStore> rs(harnessHelper->newNonCappedRecordStore());
-
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT_EQUALS(0, rs->numRecords(opCtx.get()));
- }
-
- {
- ServiceContext::UniqueOperationContext opCtx(
- harnessHelper->newOperationContext(harnessHelper->client()));
- Status status = rs->touch(opCtx.get(), nullptr /* stats output */);
- ASSERT(status.isOK() || status.code() == ErrorCodes::CommandNotSupported);
- }
-}
-
-// Insert multiple records, and verify that calling touch() on a nonempty collection
-// returns an OK status, even when NULL is passed in for the stats output.
-TEST(RecordStoreTestHarness, TouchNonEmptyWithNullStats) {
- const auto harnessHelper(newRecordStoreHarnessHelper());
- unique_ptr<RecordStore> rs(harnessHelper->newNonCappedRecordStore());
-
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT_EQUALS(0, rs->numRecords(opCtx.get()));
- }
-
- int nToInsert = 10;
- for (int i = 0; i < nToInsert; i++) {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- {
- stringstream ss;
- ss << "record " << i;
- string data = ss.str();
-
- WriteUnitOfWork uow(opCtx.get());
- StatusWith<RecordId> res =
- rs->insertRecord(opCtx.get(), data.c_str(), data.size() + 1, Timestamp());
- ASSERT_OK(res.getStatus());
- uow.commit();
- }
- }
-
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT_EQUALS(nToInsert, rs->numRecords(opCtx.get()));
- }
-
- {
- ServiceContext::UniqueOperationContext opCtx(
- harnessHelper->newOperationContext(harnessHelper->client()));
- // XXX does not verify the collection was loaded into cache
- // (even if supported by storage engine)
- Status status = rs->touch(opCtx.get(), nullptr /* stats output */);
- ASSERT(status.isOK() || status.code() == ErrorCodes::CommandNotSupported);
- }
-}
-
-} // namespace
-} // namespace mongo
diff --git a/src/mongo/db/storage/sorted_data_interface.h b/src/mongo/db/storage/sorted_data_interface.h
index b52d5f52374..d546b3b14c6 100644
--- a/src/mongo/db/storage/sorted_data_interface.h
+++ b/src/mongo/db/storage/sorted_data_interface.h
@@ -154,19 +154,6 @@ public:
virtual bool isEmpty(OperationContext* opCtx) = 0;
/**
- * Attempt to bring the entirety of 'this' index into memory.
- *
- * If the underlying storage engine does not support the operation,
- * returns ErrorCodes::CommandNotSupported
- *
- * @return Status::OK()
- */
- virtual Status touch(OperationContext* opCtx) const {
- return Status(ErrorCodes::CommandNotSupported,
- "this storage engine does not support touch");
- }
-
- /**
* Return the number of entries in 'this' index.
*
* The default implementation should be overridden with a more
diff --git a/src/mongo/db/storage/sorted_data_interface_test_touch.cpp b/src/mongo/db/storage/sorted_data_interface_test_touch.cpp
deleted file mode 100644
index 4b9fc2137de..00000000000
--- a/src/mongo/db/storage/sorted_data_interface_test_touch.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#include "mongo/db/storage/sorted_data_interface_test_harness.h"
-
-#include <memory>
-
-#include "mongo/db/storage/sorted_data_interface.h"
-#include "mongo/unittest/unittest.h"
-
-namespace mongo {
-namespace {
-
-// Verify that calling touch() on an empty index returns an OK status.
-TEST(SortedDataInterface, TouchEmpty) {
- const auto harnessHelper(newSortedDataInterfaceHarnessHelper());
- const std::unique_ptr<SortedDataInterface> sorted(
- harnessHelper->newSortedDataInterface(/*unique=*/false, /*partial=*/false));
-
- {
- const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- Status status = sorted->touch(opCtx.get());
- ASSERT(status.isOK() || status.code() == ErrorCodes::CommandNotSupported);
- }
-}
-
-// Verify that calling touch() on a nonempty index returns an OK status.
-TEST(SortedDataInterface, TouchNonEmpty) {
- const auto harnessHelper(newSortedDataInterfaceHarnessHelper());
- const std::unique_ptr<SortedDataInterface> sorted(
- harnessHelper->newSortedDataInterface(/*unique=*/true, /*partial=*/false));
-
- {
- const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT(sorted->isEmpty(opCtx.get()));
- }
-
- {
- const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- {
- WriteUnitOfWork uow(opCtx.get());
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key1, loc1), false));
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key2, loc2), false));
- ASSERT_OK(sorted->insert(opCtx.get(), makeKeyString(sorted.get(), key3, loc3), false));
- uow.commit();
- }
- }
-
- {
- const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT_EQUALS(3, sorted->numEntries(opCtx.get()));
- }
-
- {
- const ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- // XXX does not verify the index was brought into memory
- // (even if supported by storage engine)
- Status status = sorted->touch(opCtx.get());
- ASSERT(status.isOK() || status.code() == ErrorCodes::CommandNotSupported);
- }
-}
-
-} // namespace
-} // namespace mongo
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
index f3a2c93e709..fca296342ce 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
@@ -401,15 +401,6 @@ bool WiredTigerIndex::isEmpty(OperationContext* opCtx) {
return false;
}
-Status WiredTigerIndex::touch(OperationContext* opCtx) const {
- if (WiredTigerRecoveryUnit::get(opCtx)->getSessionCache()->isEphemeral()) {
- // Everything is already in memory.
- return Status::OK();
- }
- return Status(ErrorCodes::CommandNotSupported, "this storage engine does not support touch");
-}
-
-
long long WiredTigerIndex::getSpaceUsedBytes(OperationContext* opCtx) const {
dassert(opCtx->lockState()->isReadLocked());
auto ru = WiredTigerRecoveryUnit::get(opCtx);
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h
index 3e962b1356d..5fefad39b92 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h
@@ -109,8 +109,6 @@ public:
virtual bool isEmpty(OperationContext* opCtx);
- virtual Status touch(OperationContext* opCtx) const;
-
virtual long long getSpaceUsedBytes(OperationContext* opCtx) const;
virtual Status initAsEmpty(OperationContext* opCtx);
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index 0c4c1956e51..881885b56ea 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -1574,14 +1574,6 @@ void WiredTigerRecordStore::appendCustomStats(OperationContext* opCtx,
}
}
-Status WiredTigerRecordStore::touch(OperationContext* opCtx, BSONObjBuilder* output) const {
- if (_isEphemeral) {
- // Everything is already in memory.
- return Status::OK();
- }
- return Status(ErrorCodes::CommandNotSupported, "this storage engine does not support touch");
-}
-
void WiredTigerRecordStore::waitForAllEarlierOplogWritesToBeVisible(OperationContext* opCtx) const {
// Make sure that callers do not hold an active snapshot so it will be able to see the oplog
// entries it waited for afterwards.
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
index 044d57339d7..3b73b91e0d4 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
@@ -191,8 +191,6 @@ public:
BSONObjBuilder* result,
double scale) const;
- virtual Status touch(OperationContext* opCtx, BSONObjBuilder* output) const;
-
virtual void cappedTruncateAfter(OperationContext* opCtx, RecordId end, bool inclusive);
virtual boost::optional<RecordId> oplogStartHack(OperationContext* opCtx,
diff --git a/src/mongo/dbtests/commandtests.cpp b/src/mongo/dbtests/commandtests.cpp
index f8822b0a315..d2479943ffc 100644
--- a/src/mongo/dbtests/commandtests.cpp
+++ b/src/mongo/dbtests/commandtests.cpp
@@ -341,25 +341,6 @@ public:
}
}
};
-
-class Touch : Base {
-public:
- void run() {
- ASSERT(db.createCollection(nss().ns()));
- {
- BSONObjBuilder cmd;
- cmd.appendSymbol("touch", nsColl()); // Use Symbol for SERVER-16260
- cmd.append("data", true);
- cmd.append("index", true);
-
- BSONObj result;
- bool ok = db.runCommand(nsDb(), cmd.obj(), result);
- log() << result.jsonString();
- ASSERT(ok || result["code"].Int() == ErrorCodes::CommandNotSupported);
- }
- }
-};
-
} // namespace SymbolArgument
/**
@@ -390,7 +371,6 @@ public:
add<FileMD5::Type2>();
add<SymbolArgument::DropIndexes>();
add<SymbolArgument::FindAndModify>();
- add<SymbolArgument::Touch>();
add<SymbolArgument::Drop>();
add<SymbolArgument::GeoSearch>();
add<SymbolArgument::CreateIndexWithNoKey>();