diff options
author | Haley Connelly <haley.connelly@10gen.com> | 2019-09-25 17:03:51 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-25 17:03:51 +0000 |
commit | 996f1ed14075eb66b87259181809507756737870 (patch) | |
tree | 6b7d2bc381ab08411967fc34384bc86088279e81 | |
parent | 55c54c3c287d07ba2764521a085dff9add20b505 (diff) | |
download | mongo-996f1ed14075eb66b87259181809507756737870.tar.gz |
SERVER-42524 remove the touch command
49 files changed, 4 insertions, 786 deletions
diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_kill_primary_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_kill_primary_with_balancer.yml index b069bfcad65..4ac3e21675a 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_kill_primary_with_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_kill_primary_with_balancer.yml @@ -134,10 +134,6 @@ selector: - jstests/concurrency/fsm_workloads/reindex_background.js - jstests/concurrency/fsm_workloads/remove_multiple_documents.js - jstests/concurrency/fsm_workloads/server_status_with_time_out_cursors.js - - jstests/concurrency/fsm_workloads/touch_base.js - - jstests/concurrency/fsm_workloads/touch_data.js - - jstests/concurrency/fsm_workloads/touch_index.js - - jstests/concurrency/fsm_workloads/touch_no_data_no_index.js - jstests/concurrency/fsm_workloads/update_where.js - jstests/concurrency/fsm_workloads/yield.js - jstests/concurrency/fsm_workloads/yield_fetch.js diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn.yml index fc3f25ebbba..6f7c3828f71 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn.yml @@ -153,11 +153,6 @@ selector: - does_not_support_causal_consistency - requires_replication - assumes_balancer_on - # The touch command does not exist on mongos, which is enforced before session information is - # parsed, causing state functions in these workloads to fail before starting a transaction despite - # sending a command with startTransaction=true, leading to an infinite loop in the auto - # transaction retry override. - - requires_touch # Sharing cursors between state functions will fail in this suite because it will attempt to use # the same cursor in multiple transactions. - state_functions_share_cursor diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn_with_balancer.yml index 2f94a3f0954..67e6ce6cc47 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn_with_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn_with_balancer.yml @@ -153,11 +153,6 @@ selector: - assumes_balancer_off - does_not_support_causal_consistency - requires_replication - # The touch command does not exist on mongos, which is enforced before session information is - # parsed, causing state functions in these workloads to fail before starting a transaction despite - # sending a command with startTransaction=true, leading to an infinite loop in the auto - # transaction retry override. - - requires_touch # Sharing cursors between state functions will fail in this suite because it will attempt to use # the same cursor in multiple transactions. - state_functions_share_cursor diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn.yml index f636ea78ed6..3a337cf68eb 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn.yml @@ -153,11 +153,6 @@ selector: - does_not_support_causal_consistency - requires_replication - assumes_balancer_on - # The touch command does not exist on mongos, which is enforced before session information is - # parsed, causing state functions in these workloads to fail before starting a transaction despite - # sending a command with startTransaction=true, leading to an infinite loop in the auto - # transaction retry override. - - requires_touch # Sharing cursors between state functions will fail in this suite because it will attempt to use # the same cursor in multiple transactions. - state_functions_share_cursor diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_kill_primary.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_kill_primary.yml index eb2185c10f1..4f4a359f6f2 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_kill_primary.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_kill_primary.yml @@ -213,11 +213,6 @@ selector: exclude_with_any_tags: - requires_replication - # The touch command does not exist on mongos, which is enforced before session information is - # parsed, causing state functions in these workloads to fail before starting a transaction despite - # sending a command with startTransaction=true, leading to an infinite loop in the auto - # transaction retry override. - - requires_touch # Sharing cursors between state functions will fail in this suite because it will attempt to use # the same cursor in multiple transactions. - state_functions_share_cursor diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_terminate_primary.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_terminate_primary.yml index 5aabb355233..afca532317b 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_terminate_primary.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_terminate_primary.yml @@ -213,11 +213,6 @@ selector: exclude_with_any_tags: - requires_replication - # The touch command does not exist on mongos, which is enforced before session information is - # parsed, causing state functions in these workloads to fail before starting a transaction despite - # sending a command with startTransaction=true, leading to an infinite loop in the auto - # transaction retry override. - - requires_touch # Sharing cursors between state functions will fail in this suite because it will attempt to use # the same cursor in multiple transactions. - state_functions_share_cursor diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_balancer.yml index f6e6eedcf5b..ca4b35b5650 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_balancer.yml @@ -153,11 +153,6 @@ selector: - assumes_balancer_off - does_not_support_causal_consistency - requires_replication - # The touch command does not exist on mongos, which is enforced before session information is - # parsed, causing state functions in these workloads to fail before starting a transaction despite - # sending a command with startTransaction=true, leading to an infinite loop in the auto - # transaction retry override. - - requires_touch # Sharing cursors between state functions will fail in this suite because it will attempt to use # the same cursor in multiple transactions. - state_functions_share_cursor diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_stepdowns.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_stepdowns.yml index 04ab9c72e67..f5b01aa04ef 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_stepdowns.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_stepdowns.yml @@ -203,11 +203,6 @@ selector: - does_not_support_causal_consistency - requires_replication - assumes_balancer_on - # The touch command does not exist on mongos, which is enforced before session information is - # parsed, causing state functions in these workloads to fail before starting a transaction despite - # sending a command with startTransaction=true, leading to an infinite loop in the auto - # transaction retry override. - - requires_touch # Sharing cursors between state functions will fail in this suite because it will attempt to use # the same cursor in multiple transactions. - state_functions_share_cursor diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_terminate_primary_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_terminate_primary_with_balancer.yml index 11f158e38ef..8e47aa0cd45 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_terminate_primary_with_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_terminate_primary_with_balancer.yml @@ -134,10 +134,6 @@ selector: - jstests/concurrency/fsm_workloads/reindex_background.js - jstests/concurrency/fsm_workloads/remove_multiple_documents.js - jstests/concurrency/fsm_workloads/server_status_with_time_out_cursors.js - - jstests/concurrency/fsm_workloads/touch_base.js - - jstests/concurrency/fsm_workloads/touch_data.js - - jstests/concurrency/fsm_workloads/touch_index.js - - jstests/concurrency/fsm_workloads/touch_no_data_no_index.js - jstests/concurrency/fsm_workloads/update_where.js - jstests/concurrency/fsm_workloads/yield.js - jstests/concurrency/fsm_workloads/yield_fetch.js diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml index 5c78bcd414a..5aac53747b7 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml @@ -123,10 +123,6 @@ selector: - jstests/concurrency/fsm_workloads/remove_multiple_documents.js - jstests/concurrency/fsm_workloads/remove_where.js - jstests/concurrency/fsm_workloads/server_status_with_time_out_cursors.js - - jstests/concurrency/fsm_workloads/touch_base.js - - jstests/concurrency/fsm_workloads/touch_data.js - - jstests/concurrency/fsm_workloads/touch_index.js - - jstests/concurrency/fsm_workloads/touch_no_data_no_index.js - jstests/concurrency/fsm_workloads/update_where.js - jstests/concurrency/fsm_workloads/yield.js - jstests/concurrency/fsm_workloads/yield_fetch.js diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml index 3f987f6e47b..31394bad9fc 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml @@ -128,10 +128,6 @@ selector: - jstests/concurrency/fsm_workloads/reindex_writeconflict.js - jstests/concurrency/fsm_workloads/remove_multiple_documents.js - jstests/concurrency/fsm_workloads/server_status_with_time_out_cursors.js - - jstests/concurrency/fsm_workloads/touch_base.js - - jstests/concurrency/fsm_workloads/touch_data.js - - jstests/concurrency/fsm_workloads/touch_index.js - - jstests/concurrency/fsm_workloads/touch_no_data_no_index.js - jstests/concurrency/fsm_workloads/update_where.js - jstests/concurrency/fsm_workloads/yield.js - jstests/concurrency/fsm_workloads/yield_fetch.js diff --git a/jstests/auth/commands_builtin_roles.js b/jstests/auth/commands_builtin_roles.js index 0c87ea82763..4b0c803a771 100644 --- a/jstests/auth/commands_builtin_roles.js +++ b/jstests/auth/commands_builtin_roles.js @@ -70,7 +70,7 @@ function testProperAuthorization(conn, t, testcase, r) { r.key; } else if (res.ok == 0 && !testcase.expectFail && res.code != commandNotSupportedCode) { // don't error if the test failed with code commandNotSupported since - // some storage engines (e.g wiredTiger) don't support some commands (e.g. touch) + // some storage engines don't support some commands. out = "command failed with " + tojson(res) + " on db " + testcase.runOnDb + " with role " + r.key; } diff --git a/jstests/auth/commands_user_defined_roles.js b/jstests/auth/commands_user_defined_roles.js index 003957abe64..f1b5730eb94 100644 --- a/jstests/auth/commands_user_defined_roles.js +++ b/jstests/auth/commands_user_defined_roles.js @@ -47,7 +47,7 @@ function testProperAuthorization(conn, t, testcase, privileges) { if (!testcase.expectFail && res.ok != 1 && res.code != commandNotSupportedCode) { // don't error if the test failed with code commandNotSupported since - // some storage engines (e.g wiredTiger) don't support some commands (e.g. touch) + // some storage engines don't support some commands. out = "command failed with " + tojson(res) + " on db " + testcase.runOnDb + " with privileges " + tojson(privileges); } else if (testcase.expectFail && res.code == authErrCode) { diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js index 4ab37824919..40c539c205c 100644 --- a/jstests/auth/lib/commands_lib.js +++ b/jstests/auth/lib/commands_lib.js @@ -5278,34 +5278,6 @@ var authCommandsLib = { ] }, { - testname: "touch", - command: {touch: "x", data: true, index: false}, - skipSharded: true, - setup: function(db) { - db.x.save({}); - }, - teardown: function(db) { - db.x.drop(); - }, - testcases: [ - { - runOnDb: adminDbName, - roles: roles_hostManager, - privileges: [{resource: {cluster: true}, actions: ["touch"]}] - }, - { - runOnDb: firstDbName, - roles: roles_hostManager, - privileges: [{resource: {cluster: true}, actions: ["touch"]}] - }, - { - runOnDb: secondDbName, - roles: roles_hostManager, - privileges: [{resource: {cluster: true}, actions: ["touch"]}] - } - ] - }, - { testname: "unsetSharding", command: {unsetSharding: "x"}, skipSharded: true, diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_where.js b/jstests/concurrency/fsm_workloads/indexed_insert_where.js index 88c69594378..5233c6c3e48 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_where.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_where.js @@ -4,9 +4,8 @@ * indexed_insert_where.js * * Bulk inserts documents in batches of 100, and then queries for documents inserted by the thread. - * Note: This workload is extended by remove_where.js, touch_base.js, update_where.js, - * and upsert_where.js. data.insertedDocuments is used as a counter by all of those workloads - * for their own checks. + * Note: This workload is extended by remove_where.js, update_where.js, and upsert_where.js. + * data.insertedDocuments is used as a counter by all of those workloads for their own checks. */ var $config = (function() { diff --git a/jstests/concurrency/fsm_workloads/touch_base.js b/jstests/concurrency/fsm_workloads/touch_base.js deleted file mode 100644 index fce4bfc6195..00000000000 --- a/jstests/concurrency/fsm_workloads/touch_base.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -/** - * touch_base.js - * - * Bulk inserts documents in batches of 100, uses the touch command on "data" and "index", - * and queries to verify the number of documents inserted by the thread. - * - * @tags: [requires_touch] - */ - -load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload -load('jstests/concurrency/fsm_workloads/indexed_insert_where.js'); // for $config -// For isMongod and isEphemeral. -load('jstests/concurrency/fsm_workload_helpers/server_types.js'); - -var $config = extendWorkload($config, function($config, $super) { - $config.data.generateDocumentToInsert = function generateDocumentToInsert() { - return {tid: this.tid, x: Random.randInt(10)}; - }; - - $config.data.generateTouchCmdObj = function generateTouchCmdObj(collName) { - return {touch: collName, data: true, index: true}; - }; - - $config.states.touch = function touch(db, collName) { - var res = db.runCommand(this.generateTouchCmdObj(collName)); - if (isMongod(db) && isEphemeral(db)) { - assertAlways.commandWorked(res); - } else { - // SERVER-16850 and SERVER-16797 - assertAlways.commandFailed(res); - } - }; - - $config.states.query = function query(db, collName) { - var count = db[collName].find({tid: this.tid}).itcount(); - assertWhenOwnColl.eq(count, - this.insertedDocuments, - 'collection scan should return the number of documents this thread' + - ' inserted'); - }; - - $config.transitions = { - insert: {insert: 0.2, touch: 0.4, query: 0.4}, - touch: {insert: 0.4, touch: 0.2, query: 0.4}, - query: {insert: 0.4, touch: 0.4, query: 0.2} - }; - - $config.setup = function setup(db, collName, cluster) { - assertAlways.commandWorked(db[collName].ensureIndex({x: 1})); - }; - - return $config; -}); diff --git a/jstests/concurrency/fsm_workloads/touch_data.js b/jstests/concurrency/fsm_workloads/touch_data.js deleted file mode 100644 index 82724bc57ae..00000000000 --- a/jstests/concurrency/fsm_workloads/touch_data.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -/** - * touch_data.js - * - * Bulk inserts documents in batches of 100, uses touch on "data" but not "index", - * and queries to verify the number of documents inserted by the thread. - * - * @tags: [requires_touch] - */ - -load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload -load('jstests/concurrency/fsm_workloads/touch_base.js'); // for $config - -var $config = extendWorkload($config, function($config, $super) { - $config.data.generateTouchCmdObj = function generateTouchCmdObj(collName) { - return {touch: collName, data: true, index: false}; - }; - - return $config; -}); diff --git a/jstests/concurrency/fsm_workloads/touch_index.js b/jstests/concurrency/fsm_workloads/touch_index.js deleted file mode 100644 index 7f127060240..00000000000 --- a/jstests/concurrency/fsm_workloads/touch_index.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -/** - * touch_index.js - * - * Bulk inserts documents in batches of 100, uses touch on "index" but not "data", - * and queries to verify the number of documents inserted by the thread. - * - * @tags: [requires_touch] - */ - -load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload -load('jstests/concurrency/fsm_workloads/touch_base.js'); // for $config - -var $config = extendWorkload($config, function($config, $super) { - $config.data.generateTouchCmdObj = function generateTouchCmdObj(collName) { - return {touch: collName, data: false, index: true}; - }; - - return $config; -}); diff --git a/jstests/concurrency/fsm_workloads/touch_no_data_no_index.js b/jstests/concurrency/fsm_workloads/touch_no_data_no_index.js deleted file mode 100644 index bd87cbd7352..00000000000 --- a/jstests/concurrency/fsm_workloads/touch_no_data_no_index.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -/** - * touch_no_data_no_index.js - * - * Bulk inserts documents in batches of 100, uses touch as a no-op, - * and queries to verify the number of documents inserted by the thread. - * - * @tags: [requires_touch] - */ - -load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload -load('jstests/concurrency/fsm_workloads/touch_base.js'); // for $config - -var $config = extendWorkload($config, function($config, $super) { - $config.data.generateTouchCmdObj = function generateTouchCmdObj(collName) { - return {touch: collName, data: false, index: false}; - }; - - $config.states.touch = function touch(db, collName) { - var res = db.runCommand(this.generateTouchCmdObj(collName)); - // The command always fails because "index" and "data" are both false - assertAlways.commandFailed(res); - }; - - return $config; -}); diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js index ae1c882cac2..3fbfb5ab7b5 100644 --- a/jstests/core/views/views_all_commands.js +++ b/jstests/core/views/views_all_commands.js @@ -499,10 +499,6 @@ let viewsCommandTests = { startSession: {skip: isAnInternalCommand}, stopRecordingTraffic: {skip: isUnrelated}, top: {skip: "tested in views/views_stats.js"}, - touch: { - command: {touch: "view", data: true}, - expectFailure: true, - }, unsetSharding: {skip: isAnInternalCommand}, update: {command: {update: "view", updates: [{q: {x: 1}, u: {x: 2}}]}, expectFailure: true}, updateRole: { diff --git a/jstests/sharding/safe_secondary_reads_drop_recreate.js b/jstests/sharding/safe_secondary_reads_drop_recreate.js index 8f9bc26cd15..d28561d7f4d 100644 --- a/jstests/sharding/safe_secondary_reads_drop_recreate.js +++ b/jstests/sharding/safe_secondary_reads_drop_recreate.js @@ -292,7 +292,6 @@ let testCases = { startSession: {skip: "does not return user data"}, stopRecordingTraffic: {skip: "does not return user data"}, top: {skip: "does not return user data"}, - touch: {skip: "does not return user data"}, unsetSharding: {skip: "does not return user data"}, update: {skip: "primary only"}, updateRole: {skip: "primary only"}, diff --git a/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js b/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js index f5348d6be82..43905e82b86 100644 --- a/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js +++ b/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js @@ -327,7 +327,6 @@ let testCases = { startSession: {skip: "does not return user data"}, stopRecordingTraffic: {skip: "does not return user data"}, top: {skip: "does not return user data"}, - touch: {skip: "does not return user data"}, unsetSharding: {skip: "does not return user data"}, update: {skip: "primary only"}, updateRole: {skip: "primary only"}, diff --git a/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js b/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js index 4ffb6b2c5ea..873c6d06ad6 100644 --- a/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js +++ b/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js @@ -297,7 +297,6 @@ let testCases = { startSession: {skip: "does not return user data"}, stopRecordingTraffic: {skip: "does not return user data"}, top: {skip: "does not return user data"}, - touch: {skip: "does not return user data"}, unsetSharding: {skip: "does not return user data"}, update: {skip: "primary only"}, updateRole: {skip: "primary only"}, 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>(); |