|
This message is logged from 'ReadWriteConcernDefaults::refreshIfNecessary' function under following condition:
if (!currentDefaultsHandle || !possibleNewDefaults->getUpdateOpTime() ||
|
(possibleNewDefaults->getUpdateOpTime() > currentDefaultsHandle->getUpdateOpTime()))
|
which is basically
if (X || Y || Z)
|
|
where
|
X: !currentDefaultsHandle
|
Y: !possibleNewDefaults->getUpdateOpTime()
|
Z: possibleNewDefaults->getUpdateOpTime() > currentDefaultsHandle->getUpdateOpTime()
|
in mongos X is always false so the condition is effectively
Y is true on fresh sharded cluster - that is on the sharded cluster where `setDefaultRWConcern` command has not been called. After first `setDefaultRWConcern` call defaults are persisted in the CSRS and Y becomes false.
Thus there is a workaround to prevent excessive log messages: just do a `setDefaultRWConcern` call. For example if defaults are not necessary set them to empty values:
db.adminCommand({
|
"setDefaultRWConcern" : 1,
|
"defaultReadConcern" : {},
|
"defaultWriteConcern" : {}
|
})
|
Unfortunately due to another bug condition Z is never true (both times are always equal) so log will not receive "Refreshed RWC defaults" message when defaults are really changed. And following line is not executed too:
setDefault(opCtx, std::move(*possibleNewDefaults));
|
But is seems defaults are updated somewhere else.
|