summaryrefslogtreecommitdiff
path: root/jstests/sharding/features3.js
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-12-30 17:01:04 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-12-30 17:09:27 -0500
commit715e9e1cdc618dad480a7a1a73458daf6ea9ce0f (patch)
tree95ee80f3e51d3218647bc6fb013dec7f3f735297 /jstests/sharding/features3.js
parent5d2d6e209acd862324612c7f9c41d65940f8dcba (diff)
downloadmongo-715e9e1cdc618dad480a7a1a73458daf6ea9ce0f.tar.gz
Revert "SERVER-22027 Sharding should not retry killed operations"
This reverts commit 5d2d6e209acd862324612c7f9c41d65940f8dcba.
Diffstat (limited to 'jstests/sharding/features3.js')
-rw-r--r--jstests/sharding/features3.js32
1 files changed, 17 insertions, 15 deletions
diff --git a/jstests/sharding/features3.js b/jstests/sharding/features3.js
index 5e256676c73..84c857e644c 100644
--- a/jstests/sharding/features3.js
+++ b/jstests/sharding/features3.js
@@ -29,9 +29,8 @@ s.startBalancer();
// insert 10k small documents into the sharded collection
var bulk = dbForTest.foo.initializeUnorderedBulkOp();
-for (var i = 0; i < numDocs; i++) {
+for (i = 0; i < numDocs; i++)
bulk.insert({ _id: i });
-}
assert.writeOK(bulk.execute());
var x = dbForTest.foo.stats();
@@ -54,9 +53,12 @@ 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(1000); " +
+ " sleep( " + whereKillSleepTime + " ); " +
" return false; " +
"}).itcount(); ";
@@ -66,22 +68,17 @@ var awaitShell = startParallelShell(parallelCommand, s.s.port);
print("done forking shell at: " + Date());
// Get all current $where operations
-function getInProgWhereOps() {
+function getMine(printInprog) {
var inprog = dbForTest.currentOp().inprog;
+ if (printInprog)
+ printjson(inprog);
// Find all the where queries
var myProcs = [];
- inprog.forEach(function(op) {
- if (op.query && op.query.filter && op.query.filter.$where) {
- myProcs.push(op);
+ 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]);
}
- });
-
- if (myProcs.length == 0) {
- print('No $where operations found: ' + tojson(inprog));
- }
- else {
- print('Found ' + myProcs.length + ' $where operations: ' + tojson(myProcs));
}
return myProcs;
@@ -89,11 +86,16 @@ function getInProgWhereOps() {
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 = getInProgWhereOps();
+ 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++;
// Wait for the queries to start (one per shard, so 2 total)
if (curOpState == 0 && mine.length == 2) {