summaryrefslogtreecommitdiff
path: root/jstests/sharding/features3.js
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-12-29 12:04:55 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-12-30 15:35:28 -0500
commit5d2d6e209acd862324612c7f9c41d65940f8dcba (patch)
tree8ccfea2ba5cc6b118d5d82d70ebe06ba88b135aa /jstests/sharding/features3.js
parent5f4c54029d47229533b54c7683df71809cc26ff0 (diff)
downloadmongo-5d2d6e209acd862324612c7f9c41d65940f8dcba.tar.gz
SERVER-22027 Sharding should not retry killed operations
Diffstat (limited to 'jstests/sharding/features3.js')
-rw-r--r--jstests/sharding/features3.js32
1 files changed, 15 insertions, 17 deletions
diff --git a/jstests/sharding/features3.js b/jstests/sharding/features3.js
index 84c857e644c..5e256676c73 100644
--- a/jstests/sharding/features3.js
+++ b/jstests/sharding/features3.js
@@ -29,8 +29,9 @@ s.startBalancer();
// insert 10k small documents into the sharded collection
var bulk = dbForTest.foo.initializeUnorderedBulkOp();
-for (i = 0; i < numDocs; i++)
+for (var i = 0; i < numDocs; i++) {
bulk.insert({ _id: i });
+}
assert.writeOK(bulk.execute());
var x = dbForTest.foo.stats();
@@ -53,12 +54,9 @@ assert(!x.sharded, "XXX3: " + tojson(x));
// fork shell and start querying the data
var start = new Date();
-// TODO: Still potential problem when our sampling of current ops misses when $where is active -
-// solution is to increase sleep time
-var whereKillSleepTime = 10000;
var parallelCommand =
"db.foo.find(function() { " +
- " sleep( " + whereKillSleepTime + " ); " +
+ " sleep(1000); " +
" return false; " +
"}).itcount(); ";
@@ -68,17 +66,22 @@ var awaitShell = startParallelShell(parallelCommand, s.s.port);
print("done forking shell at: " + Date());
// Get all current $where operations
-function getMine(printInprog) {
+function getInProgWhereOps() {
var inprog = dbForTest.currentOp().inprog;
- if (printInprog)
- printjson(inprog);
// Find all the where queries
var myProcs = [];
- for (var x = 0; x < inprog.length; x++) {
- if (inprog[x].query && inprog[x].query.filter && inprog[x].query.filter.$where) {
- myProcs.push(inprog[x]);
+ inprog.forEach(function(op) {
+ if (op.query && op.query.filter && op.query.filter.$where) {
+ myProcs.push(op);
}
+ });
+
+ if (myProcs.length == 0) {
+ print('No $where operations found: ' + tojson(inprog));
+ }
+ else {
+ print('Found ' + myProcs.length + ' $where operations: ' + tojson(myProcs));
}
return myProcs;
@@ -86,16 +89,11 @@ function getMine(printInprog) {
var curOpState = 0; // 0 = not found, 1 = killed
var killTime = null;
-var i = 0;
var mine;
assert.soon(function() {
// Get all the current operations
- mine = getMine(true); // SERVER-8794: print all operations
-
- // get curren tops, but only print out operations before we see a $where op has started
- // mine = getMine(curOpState == 0 && i > 20);
- i++;
+ mine = getInProgWhereOps();
// Wait for the queries to start (one per shard, so 2 total)
if (curOpState == 0 && mine.length == 2) {