You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 15, 2024. It is now read-only.
A script that does one insert, and one query every couple seconds in the loop (using eventual consistency)
While the script is running, on mongo shell, do rs0:PRIMARY> rs.stepDown(). As the result, one of the secondary nodes becomes primary and the ex-primary becomes a secondary.
Before the replica set information gets refreshed, insert operations still go the ex-primary and get dropped (no new doc created).
After the replica set information refreshes, new docs are now created.
However the query operation starts failing with this error:
#<Moped::Errors::QueryFailure: The operation: #<Moped::Protocol::Query
@length=61
@request_id=98
@response_to=0
@op_code=2004
@flags=[:slave_ok]
@full_collection_name="test.users"
@skip=0
@limit=-1
@selector={:_id=>"52ba15d345f540523400007a"}
@fields=nil>
failed with error 16550: "not authorized for query on test.users"
On the ex-primary, now-secondary mongodb logs, similar error:
[conn327] assertion 16550 not authorized for query on test.users ns:test.users query:{ _id: ObjectId('52ba0b3c45f5406fd9000086') }
The error only happens on the ex-primary, the other secondary node is fine.
The error won't go away until either I restart the script, or I restart the ex-primary node.
It seems to me that moped continues to use the connection to the ex-primary node for querying purpose now but mongodb requires reauth (or even reconnect, that's what mongo shell does).