diff options
author | Spencer T Brody <spencer@mongodb.com> | 2017-08-11 14:57:17 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2017-08-11 17:15:19 -0400 |
commit | bf3c4e9ab60879053b8bf65932c0bbe4b520ff84 (patch) | |
tree | b80f0246cfcae4d501d73b7a6659c11a743970bb /jstests/replsets/rslib.js | |
parent | 8ddfeab4644aa38082b3cd03cfeef1dd6c65d35a (diff) | |
download | mongo-bf3c4e9ab60879053b8bf65932c0bbe4b520ff84.tar.gz |
SERVER-30625 Reconnect connection after waiting for repl state transition in the shell
Diffstat (limited to 'jstests/replsets/rslib.js')
-rw-r--r-- | jstests/replsets/rslib.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/jstests/replsets/rslib.js b/jstests/replsets/rslib.js index 5403b129b3c..320906321c8 100644 --- a/jstests/replsets/rslib.js +++ b/jstests/replsets/rslib.js @@ -275,7 +275,8 @@ var getLastOpTime; }; /** - * Waits for the given node to reach the given state, ignoring network errors. + * Waits for the given node to reach the given state, ignoring network errors. Ensures that the + * connection is re-connected and usable when the function returns. */ waitForState = function(node, state) { assert.soonNoExcept(function() { @@ -283,6 +284,10 @@ var getLastOpTime; {replSetTest: 1, waitForMemberState: state, timeoutMillis: 60 * 1000 * 5})); return true; }); + // Some state transitions cause connections to be closed, but whether the connection close + // happens before or after the replSetTest command above returns is racy, so to ensure that + // the connection to 'node' is usable after this function returns, reconnect it first. + reconnect(node); }; /** |