diff options
author | Randolph Tan <randolph@10gen.com> | 2018-02-13 16:56:05 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2018-03-07 10:27:45 -0500 |
commit | 4b02c3e3ca7d377714535deeeaff24be8eb51feb (patch) | |
tree | bc57b5b32a243fe9155b4983a6e28e952a1c2e7a /jstests/core/mr_killop.js | |
parent | 8a51cc0623447d7e3f81a98d2d74e26c8e6b7470 (diff) | |
download | mongo-4b02c3e3ca7d377714535deeeaff24be8eb51feb.tar.gz |
SERVER-32615 Make most outgoing mongos user commands that can write set implicit create flag to false
Diffstat (limited to 'jstests/core/mr_killop.js')
-rw-r--r-- | jstests/core/mr_killop.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/jstests/core/mr_killop.js b/jstests/core/mr_killop.js index 25675fa64ab..f2bf64fba2c 100644 --- a/jstests/core/mr_killop.js +++ b/jstests/core/mr_killop.js @@ -18,6 +18,23 @@ function debug(x) { function op(childLoop) { p = db.currentOp().inprog; debug(p); + + let isMapReduce = function(op) { + if (!op.command) { + return false; + } + + let cmdBody = op.command; + if (cmdBody.$truncated) { + let stringifiedCmd = cmdBody.$truncated; + print('str: ' + tojson(stringifiedCmd)); + return stringifiedCmd.search('mapreduce') >= 0 && + stringifiedCmd.search('jstests_mr_killop') >= 0; + } + + return cmdBody.mapreduce && cmdBody.mapreduce == "jstests_mr_killop"; + }; + for (var i in p) { var o = p[i]; // Identify a map/reduce or where distinct operation by its collection, whether or not @@ -28,8 +45,7 @@ function op(childLoop) { return o.opid; } } else { - if ((o.active || o.waitingForLock) && o.command && o.command.mapreduce && - o.command.mapreduce == "jstests_mr_killop") { + if ((o.active || o.waitingForLock) && isMapReduce(o)) { return o.opid; } } |