|
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().
|