function _continuousPrimaryStepdownFn(seedNode, stopCounter) {
        'use strict';

        var stepdownDelaySeconds = 10;

        print('*** Continuous stepdown thread running with seed node ' + seedNode);

        try {
            var replSet = new ReplSetTest(seedNode);
            var primary = replSet.getPrimary();

            while (stopCounter.getCount() > 0) {
                print('*** Stepping down ' + primary);

                assert.throws(function() {
                    var result = primary.adminCommand({
                        replSetStepDown: stepdownDelaySeconds,
                        secondaryCatchUpPeriodSecs: stepdownDelaySeconds });
                    print('replSetStepDown command did not throw and returned: ' + tojson(result));

                    // The call to replSetStepDown should never succeed
                    assert.commandWorked(result);
                });

                // Wait for primary to get elected and allow the test to make some progress before
                // attempting another stepdown.
                if (stopCounter.getCount() > 0)
                    primary = replSet.getPrimary();

                if (stopCounter.getCount() > 0)
                    sleep(8000);
            }

            print('*** Continuous stepdown thread completed successfully');
            return { ok: 1 };
        }
        catch (e) {
            print('*** Continuous stepdown thread caught exception: ' + tojson(e));
            return { ok: 0, error: e.toString(), stack: e.stack };
        }
    }
/**
     * This function is intended to be called in a separate thread and it continuously steps down
     * the current primary for a number of attempts.
     *
     * @param {string} seedNode The connection string of a node from which to discover the primary
     *                          of the replica set.
     * @param {CountDownLatch} stopCounter Object, which can be used to stop the thread.
     *
     * @return Object with the following fields:
     *      ok {integer}: 0 if it failed, 1 if it succeeded.
     *      error {string}: Only present if ok == 0. Contains the cause for the error.
     *      stack {string}: Only present if ok == 0. Contains the stack at the time of the error.
     */
This function is intended to be called in a separate thread and it continuously steps down
the current primary for a number of attempts.

@param {string} seedNode The connection string of a node from which to discover the primary
of the replica set.
@param {CountDownLatch} stopCounter Object, which can be used to stop the thread.

@return Object with the following fields:
ok {integer}: 0 if it failed, 1 if it succeeded.
error {string}: Only present if ok == 0. Contains the cause for the error.
stack {string}: Only present if ok == 0. Contains the stack at the time of the error.
This function is intended to be called in a separate thread and it continuously steps down the current primary for a number of attempts . @param { string } seedNode The connection string of a node from which to discover the primary of the replica set . @param { CountDownLatch } stopCounter Object which can be used to stop the thread . @return Object with the following fields : ok { integer } : 0 if it failed 1 if it succeeded . error { string } : Only present if ok == 0 . Contains the cause for the error . stack { string } : Only present if ok == 0 . Contains the stack at the time of the error .
function _continuousPrimaryStepdownFn(seedNode, stopCounter) {
        'use strict';
        var stepdownDelaySeconds = 10;
        print('*** Continuous stepdown thread running with seed node ' + seedNode);
        try {
            var replSet = new ReplSetTest(seedNode);
            var primary = replSet.getPrimary();
            while (stopCounter.getCount() > 0) {
                print('*** Stepping down ' + primary);
                assert.throws(function() {
                    var result = primary.adminCommand({
                        replSetStepDown: stepdownDelaySeconds,
                        secondaryCatchUpPeriodSecs: stepdownDelaySeconds });
                    print('replSetStepDown command did not throw and returned: ' + tojson(result));
                    assert.commandWorked(result);
                });
                if (stopCounter.getCount() > 0)
                    primary = replSet.getPrimary();
                if (stopCounter.getCount() > 0)
                    sleep(8000);
            }
            print('*** Continuous stepdown thread completed successfully');
            return { ok: 1 };
        }
        catch (e) {
            print('*** Continuous stepdown thread caught exception: ' + tojson(e));
            return { ok: 0, error: e.toString(), stack: e.stack };
        }
    }
function _continuousPrimaryStepdownFn ( seedNode , stopCounter ) { 'use strict' ; var stepdownDelaySeconds = 10 ; print ( '*** Continuous stepdown thread running with seed node ' + seedNode ) ; try { var replSet = new ReplSetTest ( seedNode ) ; var primary = replSet . getPrimary ( ) ; while ( stopCounter . getCount ( ) > 0 ) { print ( '*** Stepping down ' + primary ) ; assert . throws ( function ( ) { var result = primary . adminCommand ( { replSetStepDown : stepdownDelaySeconds , secondaryCatchUpPeriodSecs : stepdownDelaySeconds } ) ; print ( 'replSetStepDown command did not throw and returned: ' + tojson ( result ) ) ; assert . commandWorked ( result ) ; } ) ; if ( stopCounter . getCount ( ) > 0 ) primary = replSet . getPrimary ( ) ; if ( stopCounter . getCount ( ) > 0 ) sleep ( 8000 ) ; } print ( '*** Continuous stepdown thread completed successfully' ) ; return { ok : 1 } ; } catch ( e ) { print ( '*** Continuous stepdown thread caught exception: ' + tojson ( e ) ) ; return { ok : 0 , error : e . toString ( ) , stack : e . stack } ; } }
This function is intended to be called in a separate thread and it continuously steps down
 the current primary for a number of attempts.
This function is intended to be called in a separate thread and it continuously steps down the current primary for a number of attempts .
// The call to replSetStepDown should never succeed
 // Wait for primary to get elected and allow the test to make some progress before
 // attempting another stepdown.
