Priority: Trivial - P5
Affects Version/s: 2.8.0-rc1
Fix Version/s: 3.1.0
Steps To Reproduce:
- Start 2 node replica set
- Wait for members to be primary and secondary
- Connect to secondary
- Run listDatabases, listCollections, and listIndexes commands
Sprint:RPL 0 3/13/15
Since listDatabases, listCollections and listIndexes are commands that can work on a secondary with slaveOk, their error should indicate that.
Otherwise, the user might mistakenly believe that these commands are completely forbidden on secondaries.
SERVER-15994 changed the behaviour of listDatabases, listCollections and listIndexes to require the slaveOk bit to be set when run on secondaries. This makes sense: since they are effectively reads that can return stale data, they should require the user to state that this is okay by setting slaveOk.
However, the error they give is "not master":
This is misleading, because it is the error used for operations that only work on the primary, such as writes:
Operations such as reads, which can work on a secondary if slaveOk is set, usually give the error "not master and slaveOk=false":
Note that querying system.namespaces and system.indexes in earlier versions (what listDatabases, listCollections and listIndexes have replaced) also return an error that mentions slaveOk:
Thus, the desired behaviour is simply to adjust the error message to include mention of slaveOk=false: