coinbase / mongobetween

Apache License 2.0
111 stars 47 forks source link

opMsg.IsIsMaster always reports false #15

Closed divjotarora closed 4 years ago

divjotarora commented 4 years ago

The *opMsg.IsIsMaster function always returns false. However, drivers will use OP_MSG for the periodic server heartbeats. OP_QUERY is only used when creating new connections because the server version is unknown at that point. The server monitor uses a dedicated connection, so after the initial connection handshake, subsequent heartbeats will use OP_MSG because the server version is known to be greater than 3.6.

I think the implication here is that mongobetween will actually proxy these heartbeats to the underlying cluster rather than intercepting and manually responding.

Note: I wasn't sure where to file issues for mongobetween, so feel free to move to another location if Github issues aren't correct.

mdehoog commented 4 years ago

Thanks for the report; will open a fix PR this week.

Just a small note that this doesn't appear to affect the Ruby driver, as it only uses OP_QUERY for heartbeats, ignoring the server version (see https://github.com/mongodb/mongo-ruby-driver/blob/74a1d7fb491bcbbd2e07f9cffa6a38beca7a1a67/lib/mongo/server/monitor/connection.rb#L62, this constant isn't used anywhere).