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

RunChangeStreamsInBackground hook resets the global PRNG state

    • Fully Compatible
    • ALL
    • QE 2022-10-31

      The seed has already been set earlier in resmoke. Reusing the same sequence of pseudo-random bits as the ones used to shuffle the order of test execution seems like an accident.

      class RunChangeStreamsInBackground(interface.Hook):
          """A hook to run change streams in the background."""
      
          IS_BACKGROUND = True
      
          def __init__(self, hook_logger, fixture):
              """Initialize RunChangeStreamsInBackground."""
              description = (
                  "Run in the background full cluster change streams while a test is running."
                  " Open and close the change stream every 1..10 tests (random using config.RANDOM_SEED)."
              )
              interface.Hook.__init__(self, hook_logger, fixture, description)
              self._fixture = fixture
              self._change_streams_thread = None
              self._test_run = None
              random.seed(config.RANDOM_SEED)
              self._every_n_tests = random.randint(1, 10)
              self._full_suite_changes_num = 0
      

      https://github.com/mongodb/mongo/blob/08cb7afe3cbc66cd07dd3ca645f965b3adc5edda/buildscripts/resmokelib/testing/hooks/change_streams.py#L27

            Assignee:
            jennifer.peshansky@mongodb.com Jennifer Peshansky (Inactive)
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: