summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Percy <david.percy@mongodb.com>2020-09-18 19:27:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-09 21:28:07 +0000
commitdfb31874bf10e55c39e615ef86290b68ba0f43b3 (patch)
treedd6e6e635ded0d43eda2d8a4771056a8366ba409
parent16945f7e2ab037928563e248d9b6a592be863ae5 (diff)
downloadmongo-dfb31874bf10e55c39e615ef86290b68ba0f43b3.tar.gz
SERVER-51058 Use rawMongoProgramOutput carefully in log_remote_op_wait.js
On the v4.2 branch, log_remote_op_wait.js uses the rawMongoProgramOutput() function to assert that a query produces the right log line. But rawMongoProgramOutput() doesn't necessarily include the log line, even though the server did write it, and the client did receive the response. The problem is that the command response and the log line happen over two different channels (the network, vs a background thread reading from a pipe). It looks like other jstests fix this by shutting down the server before checking rawMongoProgramOutput(); that should work here too. This only affects the v4.2 branch. Originally log_remote_op_wait.js used the getLog command, but when backporting the test to 4.2 we switched one assertion to rawMongoProgramOutput to overcome the log-line length limit of getLog.
-rw-r--r--jstests/sharding/log_remote_op_wait.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/jstests/sharding/log_remote_op_wait.js b/jstests/sharding/log_remote_op_wait.js
index 7d3d3440445..1844742fdad 100644
--- a/jstests/sharding/log_remote_op_wait.js
+++ b/jstests/sharding/log_remote_op_wait.js
@@ -144,6 +144,10 @@ st.shard0.getDB('admin').setProfilingLevel(0, -1);
st.shard1.getDB('admin').setProfilingLevel(0, -1);
clearRawMongoProgramOutput();
coll.aggregate(pipeline2, {allowDiskUse: true, comment: pipelineComment2}).next();
+
+// We terminate the processes to ensure that the next call to rawMongoProgramOutput()
+// will return all of their output.
+st.stop();
{
const line = rawMongoProgramOutput().split('\n').find(line => line.match(/mergeCursors/) &&
line.match(/fromMongos: true/));
@@ -152,6 +156,4 @@ coll.aggregate(pipeline2, {allowDiskUse: true, comment: pipelineComment2}).next(
const duration = getDuration(line);
assert.lte(remoteOpWait, duration);
}
-
-st.stop();
})();