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

Race in PrimaryOnlyServiceMongoDTest::stepUp causes invariant failure

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.5
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v7.0
    • Service Arch 2023-07-24, Service Arch 2023-08-07
    • 6

      PrimaryOnlyServiceMongoDTest::stepUp artificially advances the last applied optime by incrementing the term but keeping the same timestamp. Reading the existing timestamp and updating it are done non-atomically, so if there are operations in the background that could modify the last applied op time, then it is possible that stepUp could try to set the op time to an older time, triggering an invariant failure.

      PrimaryOnlyServiceTest runs into this race because the _rebuildService implementation in the service it uses (TestService) builds an index. _rebuildService is invoked asynchronously via opStepUpComplete, so its possible that a test case could begin while this index build is happening in the background.

      There are several test cases that may fail due to this (e.g. ShutdownDuringStepUp and StateTransitionFromRebuildingShouldWakeUpConditionVariable).

            Assignee:
            patrick.freed@mongodb.com Patrick Freed
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: