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

Calling RSLocalClient::queryOnce(kMajorityReadConcern) causes subsequent local writes in same OperationContext to also read stale data

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.2.0
    • 4.0.0, 4.2.0, 4.4.0, 5.0.0, 5.1.0
    • Internal Client
    • None
    • Fully Compatible
    • ALL
    • Execution Team 2021-11-29
    • 152

    Description

      RSLocalClient::queryOnce(kMajorityReadConcern) will modify the ReadSource for the RecoveryUnit to be kMajorityCommitted. It won't restore the original ReadSource upon returning from the function. This issue was discovered during SERVER-59831 because it caused a later write using the same OperationContext to still be using kMajorityCommitted as its ReadSource and for the later write not to see the effects of an earlier write from secondary batch application.

      if (readConcernLevel == repl::ReadConcernLevel::kMajorityReadConcern) {
          // Set up operation context with majority read snapshot so correct optime can be retrieved.
          opCtx->recoveryUnit()->setTimestampReadSource(RecoveryUnit::ReadSource::kMajorityCommitted);
          ...
      }
      

      My thought here would be to introduce a new RAII type to enable the ReadSource to be temporarily overridden and to use it in RSLocalClient::queryOnce().

      Attachments

        Activity

          People

            yuhong.zhang@mongodb.com Yuhong Zhang
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: