summaryrefslogtreecommitdiff
path: root/jstests/sharding
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2018-05-18 17:29:14 -0400
committerHenrik Edin <henrik.edin@mongodb.com>2018-09-18 16:34:02 -0400
commit27e0275301eed05bea3d65c766dbe76ee1da9b8a (patch)
treec744bad9984e66cbce25c1f907f3e203db78fad5 /jstests/sharding
parentdf38daf87387969413c66df415601663e63cbb34 (diff)
downloadmongo-27e0275301eed05bea3d65c766dbe76ee1da9b8a.tar.gz
SERVER-32198 Get rid of CollectionShardingState::collectionIsSharded
(cherry picked from commit 80de0da37b00dbeed576b28a842cb172b6714358) SERVER-35773 Remove references to the CatalogCache from MetadataManager (cherry picked from commit 2aa65a86193e5d38934a4f2d6b0a8298e2432485) SERVER-32198 Add support for an optional `vWanted` to StaleConfigInfo (cherry picked from commit 60559a00b81293184922b3418a8e56610edf8dd9) SERVER-36054 Remove ScopedCollectionMetadata's operator bool (cherry picked from commit c9c340ad6e9e1f33cb001a8375c62d6b16138c74) SERVER-36054 Remove more unused methods from CSS/MetadataManager (cherry picked from commit ca04f5bcf9bfa73c9162b3a77225c997c6deec8a) SERVER-36116 Get rid of CollectionShardingState::resetAll (cherry picked from commit db1cc80d13d203b6351f5510f7756cc1c7bfc0ea) SERVER-36054 Get rid of unused methods from CollectionShardingState (cherry picked from commit 884d232473dca72e0872f0e540d4c3108c1e0b3d) SERVER-36164 Decouple ScopedCollectionMetadata from MetadataManager (cherry picked from commit d91262c4a2ed7d94923c3b1c5ff5d208aa981c73) SERVER-29908 Move CollectionShardingState under sharding_api_d (cherry picked from commit e491e284e8066929c8272c96a3128241ab481be8) SERVER-29908 Remove ShardingState::appendInfo Expose the ShardingState properties and move the appendInfo logic to be entirely inside the 'getShardingState' function, which is its only consumer. (cherry picked from commit 24e411d5cd7f64c5b4da25a351529cd1873284b8) SERVER-29908 Move 'updateConfigServerOpTimeFromMetadata' out of ShardingState (cherry picked from commit 7a97557ce5bf74dc2b663762b7a5ffb9c958d580) SERVER-29908 Move all runtime logic out of ShardingState ... and move it into a ShardingInitializationMongoD class, which is responsible for driving the sharding-awareness of the node and setting it onto ShardingState. Also gets rid of the 'sharding' library, so there is no more library dependency cycle. (cherry picked from commit 200c3dc58410d8b3287a2075cc9b2ad085100e83) SERVER-29908 Fold the 'sharding_connection_hook' library into 'sharding_initialization' ... and also remove dependency of MongoS on the replication coordinator (cherry picked from commit fab6864f4edcae7bb304f79e601f1f62cc376a77)
Diffstat (limited to 'jstests/sharding')
-rw-r--r--jstests/sharding/shard_collection_cache_upgrade_downgrade.js4
-rw-r--r--jstests/sharding/view_rewrite.js39
2 files changed, 19 insertions, 24 deletions
diff --git a/jstests/sharding/shard_collection_cache_upgrade_downgrade.js b/jstests/sharding/shard_collection_cache_upgrade_downgrade.js
index d810f7bab1d..0baa6bd7954 100644
--- a/jstests/sharding/shard_collection_cache_upgrade_downgrade.js
+++ b/jstests/sharding/shard_collection_cache_upgrade_downgrade.js
@@ -171,10 +171,10 @@
checkCachedCollectionEntry(st.shard1, ns2, ns2EntryOriginal);
// The shards' chunk caches should have been updated with histories removed.
- checkCachedChunksEntry(st.shard0, ns1, ns1ChunkEntryFCV36);
+ checkCachedChunksEntry(st.shard0, ns1, ns1ChunkEntryFCV40);
checkCachedChunksEntry(st.shard0, ns2, undefined);
checkCachedChunksEntry(st.shard1, ns1, undefined);
- checkCachedChunksEntry(st.shard1, ns2, ns2ChunkEntryFCV36);
+ checkCachedChunksEntry(st.shard1, ns2, ns2ChunkEntryFCV40);
st.stop();
})();
diff --git a/jstests/sharding/view_rewrite.js b/jstests/sharding/view_rewrite.js
index 74a5dd8a605..652937ff113 100644
--- a/jstests/sharding/view_rewrite.js
+++ b/jstests/sharding/view_rewrite.js
@@ -27,19 +27,23 @@
}
});
- const mongos = st.s;
+ const mongos = st.s0;
const config = mongos.getDB("config");
const mongosDB = mongos.getDB("view_rewrite");
- assert.commandWorked(mongosDB.dropDatabase());
-
const coll = mongosDB.getCollection("coll");
assert.commandWorked(config.adminCommand({enableSharding: mongosDB.getName()}));
st.ensurePrimaryShard(mongosDB.getName(), "view_rewrite-rs0");
+
const rs0Secondary = st.rs0.getSecondary();
const rs1Primary = st.rs1.getPrimary();
const rs1Secondary = st.rs1.getSecondary();
+ assert.commandWorked(config.adminCommand({shardCollection: coll.getFullName(), key: {a: 1}}));
+ assert.commandWorked(mongos.adminCommand({split: coll.getFullName(), middle: {a: 5}}));
+ assert.commandWorked(mongosDB.adminCommand(
+ {moveChunk: coll.getFullName(), find: {a: 5}, to: "view_rewrite-rs1"}));
+
for (let i = 0; i < 10; ++i) {
assert.writeOK(coll.insert({a: i}));
}
@@ -155,7 +159,8 @@
// Aggregation
assert.commandWorked(mongosDB.runCommand({
query: {aggregate: "view", pipeline: [], comment: "agg_readPref", cursor: {}},
- $readPreference: {mode: "nearest", tags: [{tag: "secondary"}]}
+ $readPreference: {mode: "nearest", tags: [{tag: "secondary"}]},
+ readConcern: {level: "local"}
}));
profilerHasSingleMatchingEntryOrThrow({
@@ -172,7 +177,8 @@
// Find
assert.commandWorked(mongosDB.runCommand({
query: {find: "view", comment: "find_readPref", maxTimeMS: 5 * 60 * 1000},
- $readPreference: {mode: "nearest", tags: [{tag: "secondary"}]}
+ $readPreference: {mode: "nearest", tags: [{tag: "secondary"}]},
+ readConcern: {level: "local"}
}));
profilerHasSingleMatchingEntryOrThrow({
@@ -189,7 +195,8 @@
// Count
assert.commandWorked(mongosDB.runCommand({
query: {count: "view", comment: "count_readPref"},
- $readPreference: {mode: "nearest", tags: [{tag: "secondary"}]}
+ $readPreference: {mode: "nearest", tags: [{tag: "secondary"}]},
+ readConcern: {level: "local"}
}));
profilerHasSingleMatchingEntryOrThrow({
@@ -206,7 +213,8 @@
// Distinct
assert.commandWorked(mongosDB.runCommand({
query: {distinct: "view", key: "a", comment: "distinct_readPref"},
- $readPreference: {mode: "nearest", tags: [{tag: "secondary"}]}
+ $readPreference: {mode: "nearest", tags: [{tag: "secondary"}]},
+ readConcern: {level: "local"}
}));
profilerHasSingleMatchingEntryOrThrow({
@@ -223,22 +231,9 @@
assert.commandWorked(shardSecondary.setProfilingLevel(0));
}
- //
- // Test rewrite for queries run against an unsharded collection.
- //
- confirmOptionsInProfiler(st.rs0.getPrimary().getDB(mongosDB.getName()));
- confirmReadPreference(st.rs0.getSecondary().getDB(mongosDB.getName()));
-
- //
- // Test rewrite for queries run against a sharded collection.
- //
- assert.commandWorked(coll.createIndex({a: 1}));
- assert.commandWorked(config.adminCommand({shardCollection: coll.getFullName(), key: {a: 1}}));
- assert.commandWorked(mongos.adminCommand({split: coll.getFullName(), middle: {a: 6}}));
- assert.commandWorked(mongosDB.adminCommand(
- {moveChunk: coll.getFullName(), find: {a: 25}, to: "view_rewrite-rs1"}));
- // Sharded tests are run against the non-primary shard for the "view_rewrite" db.
confirmOptionsInProfiler(st.rs1.getPrimary().getDB(mongosDB.getName()));
+
+ confirmReadPreference(st.rs0.getSecondary().getDB(mongosDB.getName()));
confirmReadPreference(st.rs1.getSecondary().getDB(mongosDB.getName()));
st.stop();