coinbase / coinbase/mongobetween

Drivers could mark mongobetween Unknown for server issues

Open
#16 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
167
Forks
70
PR merge metrics
No merged PRs in 30d

Description

The README says that mongobetween appears as an always-available mongos server, but I believe a driver would mark mongobetween as `Unknown` if there were a server error like `NotMaster`. In this case, mongobetween would extract the error and use the Go driver's `ProcessError` function to mark the actual mongos Unknown, which is correct, but would also proxy the message back to the original driver, which would then mark mongobetween Unknown per the error handling section of the SDAM [spec](https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#not-master-and-node-is-recovering).

EDIT: I think the same is true for connection errors. `mongo.RoundTrip` returns an error if the `WriteWireMessage` or `ReadWireMessage` calls fail. This is propagated upward so `handleConnection` returns the error to the goroutine launched by `Proxy.accept`, which closes the connection. This would show up in the application as a non-timeout network error, which would cause the application to mark the proxy as Unknown and clear its connection pool.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the README and trace the named flow through mongo.RoundTrip, WriteWireMessage, ReadWireMessage, handleConnection, Proxy.accept, and the Go driver's ProcessError. Verify how server and connection errors are reported to both mongos and the original driver; done means the expected SDAM behavior and any required change are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mongodb
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.