diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2019-06-20 17:19:53 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2019-06-20 17:19:53 -0400 |
commit | eea65efbdd4f20022973cf38455c22c5b62af9f3 (patch) | |
tree | 7b0f655d61c98cb39940e53043081503496b3d56 /jstests/concurrency/fsm_libs/resmoke_runner.js | |
parent | 8503bfafadf9c193c5f2d97aa7291814b673c344 (diff) | |
download | mongo-eea65efbdd4f20022973cf38455c22c5b62af9f3.tar.gz |
SERVER-41096 Fix file-based protocol for permitting stepdowns.
Changes the file-based protocol for controlling when stepdowns are
permitted to be a one-shot mechanism usable only once during a test.
That is to say, the indication for whether the stepdown thread isn't
currently and will no longer continue to run stepdowns during the test
persists until after the test finishes.
Diffstat (limited to 'jstests/concurrency/fsm_libs/resmoke_runner.js')
-rw-r--r-- | jstests/concurrency/fsm_libs/resmoke_runner.js | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/jstests/concurrency/fsm_libs/resmoke_runner.js b/jstests/concurrency/fsm_libs/resmoke_runner.js index 2b6b1512bed..908eb126cb0 100644 --- a/jstests/concurrency/fsm_libs/resmoke_runner.js +++ b/jstests/concurrency/fsm_libs/resmoke_runner.js @@ -100,8 +100,7 @@ // Await replication after running the $config.setup() function when stepdowns are // permitted to ensure its effects aren't rolled back. - if (cluster.isReplication() && - typeof executionOptions.stepdownPermittedFile === 'string') { + if (cluster.isReplication() && executionOptions.stepdownFiles !== undefined) { cluster.awaitReplication(); } @@ -127,8 +126,8 @@ // Indicate that the stepdown thread can run. It is unnecessary for the stepdown thread // to indicate that it is going to start running because it will eventually after the // worker threads have started. - if (typeof executionOptions.stepdownPermittedFile === 'string') { - writeFile(executionOptions.stepdownPermittedFile, ''); + if (executionOptions.stepdownFiles !== undefined) { + writeFile(executionOptions.stepdownFiles.permitted, ''); } // Since the worker threads may be running with causal consistency enabled, we set the @@ -175,14 +174,14 @@ // signal that it has stopped. // // Signal to the stepdown thread to stop stepping down the cluster. - if (typeof executionOptions.stepdownPermittedFile === 'string' && - typeof executionOptions.steppingDownFile === 'string') { - removeFile(executionOptions.stepdownPermittedFile); - // Wait for the steppingDownFile to be removed by the stepdown thread. + if (executionOptions.stepdownFiles !== undefined) { + writeFile(executionOptions.stepdownFiles.idleRequest, ''); + + // Wait for the acknowledgement file to be created by the stepdown thread. assert.soonNoExcept(function() { - if (ls().indexOf(executionOptions.steppingDownFile) === -1) { - return true; - } + // The cat() function will throw an exception if the file isn't found. + cat(executionOptions.stepdownFiles.idleAck); + return true; }, "stepdown still in progress"); } } @@ -271,13 +270,11 @@ // The stepdown file names need to match the same construction as found in // buildscripts/resmokelib/testing/hooks/stepdown.py. if (TestData.useStepdownPermittedFile) { - executionOptions.stepdownPermittedFile = - resmokeDbPathPrefix + '/concurrency_sharded_stepdown_stepdown_permitted'; - } - - if (TestData.useSteppingDownFile) { - executionOptions.steppingDownFile = - resmokeDbPathPrefix + '/concurrency_sharded_stepdown_stepping_down'; + executionOptions.stepdownFiles = { + permitted: resmokeDbPathPrefix + '/permitted', + idleRequest: resmokeDbPathPrefix + '/idle_request', + idleAck: resmokeDbPathPrefix + '/idle_ack', + }; } if (Object.keys(sessionOptions).length > 0 || TestData.runningWithSessions) { |