Hi,
The goal is to periodically check mongodb for long running queries and be able to kill such queries (optional) using Java driver only.
The following function works great from mongodb shell:
function slowOps(threshold) {
inprog = db.currentOp({'ns' : {$ne : ''}, 'secs_running' : { $gte : threshold}, 'op' : { $in : ['getmore', 'query']}}).inprog;
var result = [];
for (var i in inprog) {
result.push(inprog[i].opid);
}
return result;
}
output:
mongos> slowOps(10)
[
"m1-shard1set:1902811044",
"m1-shard1set:1902811046",
"m1-shard2set:-2101478616",
"m1-shard2set:-2101478621",
"m1-shard2set:-2101478620",
"m1-shard3set:275802478"
]
and I'm able to kill operations using these ids.
But when I run the same function from Java driver using db.eval() function I'm getting numerical (not string) "opid"s and can't use them to kill running operations.
Could you please suggest me some reliable way to receive valid "opid"s of in-progress operations from Java driver in sharded mongo cluster.
Thank you in advance,
Victor
I understand your point. The only question that remains open for me is how to limit query execution time from Java driver.
I think it's very important to have possibility to specify query execution timeout and be 100% sure that when timeout has been exceeded there is no operations related to the query running on server side.
Victor
Any ideas?
--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.