Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-30928

Add a fixture for testing rollback on top of ReplSetTest

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • TIG 2017-09-11, TIG 2017-10-02

    Description

      Many of our rollback javascript tests follow the same pattern of setting up a replica set, doing some operations, change the replica set configuration to induce rollback, do more operations that will be rolled back, check that the replica set is in a consistent state after rolling back.

      A lot of work goes into the template code to set up the cluster and trigger a roll back, so we should provide a unified interface that allows the user to define n operations of which the first k will be persisted and the last n-k will be rolled back. This should make it significantly easier to add new rollback tests and to increase our test coverage of rollback.

      The existing tests should also be simplified to use the new rollback fixture.

      The RollbackFixture will wrap around a 3 node ReplSetTest with 1 arbiter, which is the setup used by all existing rollback JS tests. It will expose the following functions to the user:

      - transitionToRollbackState() // isolate a node in the cluster such that all operations on it will be rolled back
      - transitionToNormalState(waitForRollback=true) // un-isolate the node with the option of waiting for rollback to finish
      - getPersistentNodeConn() // get a connection to the node whose operations won't be rolled back.
      - getRollbackNodeConn() // get a connection to the node whose operations will be rolled back.
      

      Internally it will keep track of the state of the replicaset with the following states: TRANSITIONING, STOPPED, ROLLBACK, NORMAL

      These set of functions should be sufficient for handling the rollback logic for the majority of rollback tests, but more complicated scenarios that require a specific sequence of partitions or more than 3 nodes in a replica set e.g. double_rollback.js will not be able to use this fixture for the time being.

      Attachments

        Activity

          People

            robert.guo@mongodb.com Robert Guo (Inactive)
            robert.guo@mongodb.com Robert Guo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: