From 907c8c786e26414735892bfbe763cd67e7f7e7e4 Mon Sep 17 00:00:00 2001 From: William Schultz Date: Fri, 4 Jan 2019 18:05:41 -0500 Subject: Revert "SERVER-37853 Create sharded_core_txn with balancer suite" This reverts commit 62076130c3321f842f3ce4fb426aefc078074206. --- jstests/core/batch_size.js | 2 +- jstests/core/distinct_compound_index.js | 1 - jstests/core/explain5.js | 1 - jstests/core/explain_execution_error.js | 2 +- jstests/core/getmore_invalidated_cursors.js | 3 +- jstests/core/index_check7.js | 1 - jstests/core/index_diag.js | 1 - jstests/core/min_max_bounds.js | 1 - jstests/core/minmax.js | 1 - jstests/core/orf.js | 1 - jstests/core/remove7.js | 2 +- jstests/core/wildcard_and_text_indexes.js | 1 - jstests/core/wildcard_index_basic_index_bounds.js | 2 +- jstests/core/wildcard_index_cached_plans.js | 2 +- jstests/core/wildcard_index_multikey.js | 1 - jstests/core/wildcard_index_nonblocking_sort.js | 1 - jstests/hooks/drop_sharded_collections.js | 33 ---------- .../implicitly_shard_accessed_collections.js | 77 ++++------------------ 18 files changed, 18 insertions(+), 115 deletions(-) delete mode 100644 jstests/hooks/drop_sharded_collections.js (limited to 'jstests') diff --git a/jstests/core/batch_size.js b/jstests/core/batch_size.js index b280b8ceb77..cdd60e77cd2 100644 --- a/jstests/core/batch_size.js +++ b/jstests/core/batch_size.js @@ -1,4 +1,4 @@ -// @tags: [requires_getmore, assumes_balancer_off] +// @tags: [requires_getmore] // Test subtleties of batchSize and limit. diff --git a/jstests/core/distinct_compound_index.js b/jstests/core/distinct_compound_index.js index 2af57ffa3bb..446313fee7f 100644 --- a/jstests/core/distinct_compound_index.js +++ b/jstests/core/distinct_compound_index.js @@ -1,4 +1,3 @@ -// @tags [assumes_balancer_off] (function() { "use strict"; diff --git a/jstests/core/explain5.js b/jstests/core/explain5.js index 03fcec4ddc6..35841ac0789 100644 --- a/jstests/core/explain5.js +++ b/jstests/core/explain5.js @@ -1,5 +1,4 @@ // Check explain results for a plan that uses an index to obtain the requested sort order. -// @tags: [assumes_balancer_off] t = db.jstests_explain5; t.drop(); diff --git a/jstests/core/explain_execution_error.js b/jstests/core/explain_execution_error.js index a59a4b7930f..ff999f48bb9 100644 --- a/jstests/core/explain_execution_error.js +++ b/jstests/core/explain_execution_error.js @@ -1,4 +1,4 @@ -// @tags: [requires_getmore, assumes_balancer_off] +// @tags: [requires_getmore] // Test that even when the execution of a query fails, explain reports query // planner information. diff --git a/jstests/core/getmore_invalidated_cursors.js b/jstests/core/getmore_invalidated_cursors.js index 788fb662cba..37f2a508013 100644 --- a/jstests/core/getmore_invalidated_cursors.js +++ b/jstests/core/getmore_invalidated_cursors.js @@ -1,5 +1,4 @@ -// @tags: [requires_getmore, requires_non_retryable_commands, requires_collstats, -// assumes_balancer_off] +// @tags: [requires_getmore, requires_non_retryable_commands, requires_collstats] // Tests that running a getMore on a cursor that has been invalidated by something like a collection // drop will return an appropriate error message. diff --git a/jstests/core/index_check7.js b/jstests/core/index_check7.js index d02725616a8..fda248db467 100644 --- a/jstests/core/index_check7.js +++ b/jstests/core/index_check7.js @@ -1,4 +1,3 @@ -// @tags: [assumes_balancer_off] t = db.index_check7; t.drop(); diff --git a/jstests/core/index_diag.js b/jstests/core/index_diag.js index 2064527ef72..3779d5f3c78 100644 --- a/jstests/core/index_diag.js +++ b/jstests/core/index_diag.js @@ -1,4 +1,3 @@ -// @tags: [assumes_balancer_off] load("jstests/libs/fixture_helpers.js"); t = db.index_diag; diff --git a/jstests/core/min_max_bounds.js b/jstests/core/min_max_bounds.js index 713dc75b844..1e4a80efbf6 100644 --- a/jstests/core/min_max_bounds.js +++ b/jstests/core/min_max_bounds.js @@ -1,6 +1,5 @@ /** * This test ensures that queries using simple ranges handle bound inclusion properly. - * @tags: [assumes_balancer_off] */ (function() { 'use strict'; diff --git a/jstests/core/minmax.js b/jstests/core/minmax.js index 43a321d9c80..72653b23811 100644 --- a/jstests/core/minmax.js +++ b/jstests/core/minmax.js @@ -1,5 +1,4 @@ // Test min / max query parameters. -// @tags: [assumes_balancer_off] (function() { "use strict"; diff --git a/jstests/core/orf.js b/jstests/core/orf.js index 66d943aa764..5d58e59c74f 100644 --- a/jstests/core/orf.js +++ b/jstests/core/orf.js @@ -1,5 +1,4 @@ // Test a query with 200 $or clauses -// @tags: [assumes_balancer_off] t = db.jstests_orf; t.drop(); diff --git a/jstests/core/remove7.js b/jstests/core/remove7.js index 2cda8945089..226a4cfb150 100644 --- a/jstests/core/remove7.js +++ b/jstests/core/remove7.js @@ -25,7 +25,7 @@ for (i = 0; i < 200; i++) { t.save({tags: getTags(100)}); var q = {tags: {$in: getTags(10)}}; var before = t.find(q).count(); - var res = assert.writeOK(t.remove(q)); + var res = t.remove(q); var after = t.find(q).count(); assert.eq(0, after, "not zero after!"); assert.writeOK(res); diff --git a/jstests/core/wildcard_and_text_indexes.js b/jstests/core/wildcard_and_text_indexes.js index a4b552e3220..4fd7ad34ac1 100644 --- a/jstests/core/wildcard_and_text_indexes.js +++ b/jstests/core/wildcard_and_text_indexes.js @@ -1,6 +1,5 @@ /** * Tests that a {$**: 1} index can coexist with a {$**: 'text'} index in the same collection. - * @tags: [assumes_balancer_off] */ (function() { "use strict"; diff --git a/jstests/core/wildcard_index_basic_index_bounds.js b/jstests/core/wildcard_index_basic_index_bounds.js index e2ee7da8710..c5e1f87f7e1 100644 --- a/jstests/core/wildcard_index_basic_index_bounds.js +++ b/jstests/core/wildcard_index_basic_index_bounds.js @@ -4,7 +4,7 @@ * Does not support stepdowns because the test issues getMores, which the stepdown/kill_primary * passthroughs will reject. * - * @tags: [does_not_support_stepdowns, assumes_balancer_off] + * @tags: [does_not_support_stepdowns] */ (function() { "use strict"; diff --git a/jstests/core/wildcard_index_cached_plans.js b/jstests/core/wildcard_index_cached_plans.js index 96b8cfa4055..d0c2a50abe9 100644 --- a/jstests/core/wildcard_index_cached_plans.js +++ b/jstests/core/wildcard_index_cached_plans.js @@ -5,7 +5,7 @@ * $planCacheStats aggregation source. Both operations must be routed to the primary, and the latter * only supports 'local' readConcern. * @tags: [assumes_read_preference_unchanged, assumes_read_concern_unchanged, - * does_not_support_stepdowns, assumes_balancer_off] + * does_not_support_stepdowns] */ (function() { "use strict"; diff --git a/jstests/core/wildcard_index_multikey.js b/jstests/core/wildcard_index_multikey.js index d9704963720..93e9492d6de 100644 --- a/jstests/core/wildcard_index_multikey.js +++ b/jstests/core/wildcard_index_multikey.js @@ -1,6 +1,5 @@ /** * Tests that queries using a multikey $** index, return correct results. - * @tags: [assumes_balancer_off] */ (function() { "use strict"; diff --git a/jstests/core/wildcard_index_nonblocking_sort.js b/jstests/core/wildcard_index_nonblocking_sort.js index c21a0cacdb5..fa400fb89e6 100644 --- a/jstests/core/wildcard_index_nonblocking_sort.js +++ b/jstests/core/wildcard_index_nonblocking_sort.js @@ -1,4 +1,3 @@ -// @tags: [assumes_balancer_off] (function() { "use strict"; diff --git a/jstests/hooks/drop_sharded_collections.js b/jstests/hooks/drop_sharded_collections.js deleted file mode 100644 index 5758e3027e5..00000000000 --- a/jstests/hooks/drop_sharded_collections.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Drops all sharded collections (except for collections used internally, - * like config.system.sessions). - */ -(function() { - "use strict"; - - load("jstests/libs/fixture_helpers.js"); // For isMongos. - - assert.neq(typeof db, 'undefined', 'No `db` object, is the shell connected to a mongod?'); - assert(FixtureHelpers.isMongos(db), "not connected to mongos"); - - let balSettingResult = assert.commandWorked(db.adminCommand({balancerStatus: 1})); - if (balSettingResult.mode !== 'off') { - assert.commandWorked(db.adminCommand({balancerStop: 1})); - } - - db.getSiblingDB('config').collections.find().forEach(collEntry => { - if (collEntry._id !== 'config.system.sessions') { - let nsSplit = collEntry._id.split('.'); - const dbName = nsSplit.shift(); - const collName = nsSplit.join('.'); - - // Note: drop also cleans up tags and chunks associated with ns. - assert.commandWorked(db.getSiblingDB(dbName).runCommand({drop: collName})); - } - }); - - // Turn balancer back on if it was not off earlier. - if (balSettingResult.mode !== 'off') { - assert.commandWorked(db.adminCommand({balancerStart: 1})); - } -})(); diff --git a/jstests/libs/override_methods/implicitly_shard_accessed_collections.js b/jstests/libs/override_methods/implicitly_shard_accessed_collections.js index a6cb5a6c2a0..93f3cbd3e15 100644 --- a/jstests/libs/override_methods/implicitly_shard_accessed_collections.js +++ b/jstests/libs/override_methods/implicitly_shard_accessed_collections.js @@ -9,30 +9,6 @@ * dropped in a sharded cluster. */ -/** - * Settings for the converting implictily accessed collections to sharded collections. - */ -const ImplicitlyShardAccessCollSettings = (function() { - let mode = 0; // Default to hashed shard key. - - return { - Modes: { - kUseHashedSharding: 0, - kHashedMoveToSingleShard: 1, - }, - setMode: function(newMode) { - if (newMode !== 0 && newMode !== 1) { - throw new Error("Cannot set mode to unknown mode: " + newMode); - } - - mode = newMode; - }, - getMode: function() { - return mode; - }, - }; -})(); - (function() { 'use strict'; @@ -55,8 +31,6 @@ const ImplicitlyShardAccessCollSettings = (function() { /\.system\./, ]; - const kZoneName = 'moveToHereForMigrationPassthrough'; - function shardCollection(collection) { var db = collection.getDB(); var dbName = db.getName(); @@ -77,45 +51,18 @@ const ImplicitlyShardAccessCollSettings = (function() { res = db.adminCommand( {shardCollection: fullName, key: {_id: 'hashed'}, collation: {locale: "simple"}}); - - let checkResult = function(res, opDescription) { - if (res.ok === 0 && testMayRunDropInParallel) { - // We ignore ConflictingOperationInProgress error responses from the - // "shardCollection" command if it's possible the test was running a "drop" command - // concurrently. We could retry running the "shardCollection" command, but tests - // that are likely to trigger this case are also likely running the "drop" command - // in a loop. We therefore just let the test continue with the collection being - // unsharded. - assert.commandFailedWithCode(res, ErrorCodes.ConflictingOperationInProgress); - jsTest.log("Ignoring failure while " + opDescription + - " due to a concurrent drop operation: " + tojson(res)); - } else { - assert.commandWorked(res, opDescription + " failed"); - } - }; - - checkResult(res, 'shard ' + fullName); - - // Set the entire chunk range to a single zone, so balancer will be forced to move the - // evenly distributed chunks to a shard (selected at random). - if (res.ok === 1 && - ImplicitlyShardAccessCollSettings.getMode() === - ImplicitlyShardAccessCollSettings.Modes.kHashedMoveToSingleShard) { - let shardName = - db.getSiblingDB('config').shards.aggregate([{$sample: {size: 1}}]).toArray()[0]._id; - - checkResult(db.adminCommand({addShardToZone: shardName, zone: kZoneName}), - 'add ' + shardName + ' to zone ' + kZoneName); - checkResult(db.adminCommand({ - updateZoneKeyRange: fullName, - min: {_id: MinKey}, - max: {_id: MaxKey}, - zone: kZoneName - }), - 'set zone for ' + fullName); - - // Wake up the balancer. - checkResult(db.adminCommand({balancerStart: 1}), 'turn on balancer'); + if (res.ok === 0 && testMayRunDropInParallel) { + // We ignore ConflictingOperationInProgress error responses from the + // "shardCollection" command if it's possible the test was running a "drop" command + // concurrently. We could retry running the "shardCollection" command, but tests + // that are likely to trigger this case are also likely running the "drop" command + // in a loop. We therefore just let the test continue with the collection being + // unsharded. + assert.commandFailedWithCode(res, ErrorCodes.ConflictingOperationInProgress); + print("collection '" + fullName + + "' failed to be sharded due to a concurrent drop operation"); + } else { + assert.commandWorked(res, "sharding '" + fullName + "' with a hashed _id key failed"); } } -- cgit v1.2.1