If we are running a standalone mongod, executing the following commands from a shell will cause an invariant failure:
use test db.test.runCommand({find:"test", readConcern: {level:"majority", afterClusterTime: new Timestamp(0,0)}});
There is an issue with the way read concern options are handled in Command::run in db/commands/dbcommands.cpp. The waitForReadConcern function will try to execute makeNoopWriteIfNeeded if the read concern level is "majority" and there is an "afterClusterTime" field, which will in turn try to run getMyLastAppliedOpTime which will cause this invariant failure if we are not running as a replica set.
To fix this bug, I think the simplest approach may be to bypass any handling of readConcern options in Command::run if we know that we are not running as a replica set or master/slave node.
- is related to
-
SERVER-48301 find command should reject $_internalReadAtClusterTime values less than afterClusterTime
- Closed