Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SERVER-10382 add error code if count command is interrupted
Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// interrupting a count returns an error code | ||
|
||
t = db.count10; | ||
t.drop(); | ||
|
||
for ( i=0; i<100; i++ ){ | ||
t.save( { x : i } ); | ||
} | ||
// make sure data is written | ||
db.getLastError(); | ||
|
||
var thr = new Thread(function () { | ||
try { | ||
db.count10.find("sleep(1000)").count(); | ||
} | ||
catch (e) { | ||
return e; | ||
} | ||
}); | ||
|
||
thr.start(); | ||
sleep(1000); | ||
|
||
current = db.currentOp({"ns": t.getFullName(), "query.count": t.getName()}); | ||
assert(current); | ||
countOp = current.inprog[0]; | ||
assert(countOp); | ||
|
||
db.killOp(countOp.opid); | ||
res = thr.returnData(); | ||
|
||
assert(res); | ||
assert(res.match(/count failed/) !== null); | ||
assert(res.match(/\"code\"/) !== null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters