diff options
author | Bernard Gorman <bernard.gorman@gmail.com> | 2018-03-09 15:00:47 -0500 |
---|---|---|
committer | Nick Zolnierz <nicholas.zolnierz@mongodb.com> | 2018-03-09 16:55:05 -0500 |
commit | dbfc1e30a2e06732c5cd3d20aabfff67737f3521 (patch) | |
tree | 7c8512c6e742a8783e7f8da6db852d1379f2df9b /jstests | |
parent | 234e98e2f3c5a71327960097b60d9d616661d4dc (diff) | |
download | mongo-dbfc1e30a2e06732c5cd3d20aabfff67737f3521.tar.gz |
SERVER-31999: Race condition in awaitdata_getmore_cmd.js
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/awaitdata_getmore_cmd.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/jstests/core/awaitdata_getmore_cmd.js b/jstests/core/awaitdata_getmore_cmd.js index 252e44d4475..edcf529e259 100644 --- a/jstests/core/awaitdata_getmore_cmd.js +++ b/jstests/core/awaitdata_getmore_cmd.js @@ -156,6 +156,9 @@ // getMore should time out if we insert a non-matching document. let insertshell = startParallelShell(function() { + // Signal to the original shell that the parallel shell has successfully started. + assert.writeOK(db.await_data.insert({_id: "signal parent shell"})); + // Wait for the parent shell to start watching for the next document. assert.soon( function() { return db.currentOp({ @@ -167,9 +170,16 @@ function() { return tojson(db.currentOp().inprog); }); + // Now write a non-matching document to the collection. assert.writeOK(db.await_data.insert({x: 0})); }); + // Wait until we receive confirmation that the parallel shell has started. + assert.soon(() => db.await_data.findOne({_id: "signal parent shell"}) !== null); + + // Now issue a getMore which will match the parallel shell's currentOp filter, signalling it to + // write a non-matching document into the collection. Confirm that we do not receive this + // document and that we subsequently time out. now = new Date(); cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 4000}); assert.commandWorked(cmdRes); |