summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2020-02-03 15:38:46 +0000
committerevergreen <evergreen@mongodb.com>2020-02-03 15:38:46 +0000
commit6be973434ba90a6442c2e5ffecb04b75d08ab5b2 (patch)
treeed886486474c09149a2a9b7718b7a420694805d3
parentdaadd41a21fb248c518dfceec5b80d8f710c5045 (diff)
downloadmongo-6be973434ba90a6442c2e5ffecb04b75d08ab5b2.tar.gz
SERVER-45536 index_secondary_commit_after_scan_error.js should wait for the secondary before shutting it down
-rw-r--r--jstests/noPassthrough/index_secondary_commit_after_scan_error.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/jstests/noPassthrough/index_secondary_commit_after_scan_error.js b/jstests/noPassthrough/index_secondary_commit_after_scan_error.js
index 55570c3b819..1130044a1b0 100644
--- a/jstests/noPassthrough/index_secondary_commit_after_scan_error.js
+++ b/jstests/noPassthrough/index_secondary_commit_after_scan_error.js
@@ -74,9 +74,18 @@ IndexBuildTest.waitForIndexBuildToStop(testDB);
const exitCode = createIdx();
assert.eq(0, exitCode, 'expected shell to exit successfully');
+// Wait until the secondary process exits. We don't use ReplSetTest.stop() because if the secondary
+// hasn't processed the commitIndexBuild oplog entry yet, the node will get signaled to shutdown
+// cleanly and return an exit code of 0.
+let res;
+assert.soon(function() {
+ res = checkProgram(secondary.pid);
+ return !res.alive;
+});
+
// Secondary should crash on receiving the unexpected commitIndexBuild oplog entry.
const fassertProcessExitCode = _isWindows() ? MongoRunner.EXIT_ABRUPT : MongoRunner.EXIT_ABORT;
-rst.stop(secondary, undefined, {allowedExitCode: fassertProcessExitCode});
+assert.eq(fassertProcessExitCode, res.exitCode);
assert(rawMongoProgramOutput().match('Fatal assertion 51101 OperationFailed: Index build:'),
'Index build should have aborted secondary due to unexpected commitIndexBuild oplog entry.');