[SERVER-58502] Change the hello command on mongos to handle requests with the loadBalanced flag Created: 13/Jul/21  Updated: 29/Oct/23  Resolved: 02/Sep/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.1.0-rc0, 5.0.7

Type: Task Priority: Major - P3
Reporter: Matthew Saltz (Inactive) Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
depends on SERVER-58499 Add a new error code LoadBalancerSupp... Closed
depends on SERVER-58500 Change hello command on mongos to ret... Closed
is depended on by PHPC-1752 Load Balancer Support Closed
is depended on by SERVER-58500 Change hello command on mongos to ret... Closed
is depended on by PYTHON-2712 Remove topologyVersion fallback when ... Closed
is depended on by NODE-3431 Remove Mocked Service Id When Server ... Closed
Related
related to DRIVERS-1983 Update load balancer tests to support... Implementing
is related to SERVER-58562 Add a boolean field _isFromLoadBalanc... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v5.0
Sprint: Service Arch 2021-09-06
Participants:
Story Points: 4

 Description   

This behavior only applies to the initial hello command on a connection. Any subsequent hello commands executed on a connection are not subject to these constraints.

 

hello request/connection mode Connections established with the Proxy Protocol Connections established without the Proxy Protocol
loadBalanced = true Response must include a serviceId field of type ObjectID, which the server will generate at process start. Response will be the normal hello response, not containing the serviceId. The load balancer specification for drivers states that: “When the server's hello response does not contain a serviceId field, the driver MUST throw an exception with the message "Driver attempted to initialize in load balancing mode, but the server does not support this mode."” So there is no need to do anything special or return an error from mongos in this case.
loadBalanced = false (or absent) Return an error with a message “The server is being accessed through a load balancer, but this driver does not have load balancing enabled.” and an error code LoadBalancerSupportMismatch. Response will be the normal hello response, not containing the serviceId.


 Comments   
Comment by Githook User [ 17/Mar/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-58502 mongos hello loadBalanced option

(cherry picked from commit 4a9c2e6f412619a50770ba867c11a6526840558f)
Branch: LB
https://github.com/mongodb/mongo/commit/14062af8ee92c4e593f6db34f6e55a09680769b8

Comment by Githook User [ 15/Mar/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-58502 mongos hello loadBalanced option

(cherry picked from commit 4a9c2e6f412619a50770ba867c11a6526840558f)
Branch: v5.0
https://github.com/mongodb/mongo/commit/702832c9abb9cf21d19e0a1aec49e546a85abc64

Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Billy Donahue [ 29/Sep/21 ]

I didn't realize this but the feature is being backported so disgregard my Sep24 comment.

Comment by Billy Donahue [ 28/Sep/21 ]

The feature is incomplete. This project PM-2369 is mid-swing.

Comment by Abraham Egnor [ 28/Sep/21 ]

Relatedly, I'm attempting to set up a test environment for the Rust driver's LB support, and even when running against a server version cut from a very recent commit serviceId is never returned.  Looking at the commit for this ticket, it looks like it'll only be returned if setClientIsFromLoadBalancer has been called, but I can't find anywhere that happens - is this feature incomplete?

Comment by Jeremy Mikola [ 24/Sep/21 ]

Thanks for the quick reply. I was referring to the driver team, which needs to test specific drivers with load balancers. Apart from Atlas Serverless testing (where I believe the proxy injects a server ID), our non-Atlas testing uses HAProxy on Evergreen, which requires the mocking I alluded to above. I didn't realize that the changes in this ticket only pertained to functionality for 5.1+, so please disregard my backport request.

For drivers where mocking is not possible (e.g. PHP), we'll just limit our non-Atlas testing to 5.1+ server versions where we can rely on the functionality introduced by this ticket.

Comment by Billy Donahue [ 24/Sep/21 ]

jmikola I don't understand why drivers (you mean the team or the software?) need to mock the serviceID with 5.0 servers.
5.0 will never have this feature that that should be ok.

I'm reluctant to introduce this code into a server that will never support a loadBalancer in a real sense.

Comment by Jeremy Mikola [ 24/Sep/21 ]

billy.donahue, matthew.saltz: Not sure who to ask about this, but is it possible to get this backported to 5.0.x? Drivers currently need to mock the service ID when testing against 5.0, and that is especially problematic for drivers such as Swift and PHP, which are built atop libmongoc. The mocking functionality only appears in libmongoc's private API, as this isn't something that belongs in a public API. Swift was able to patch their bundled libmongoc sources when compiling for tests (SWIFT-1319), but PHP really doesn't have that option since we also test using libmongoc as a shared library (patching sources is out of the question).

Beyond libmongoc and its downstream drivers, backporting this would generally be helpful to allow all drivers to remove this mocking behavior from their test suites.

Comment by Githook User [ 30/Aug/21 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-58502 mongos hello loadBalanced option
Branch: master
https://github.com/mongodb/mongo/commit/4a9c2e6f412619a50770ba867c11a6526840558f

Comment by Billy Donahue [ 24/Aug/21 ]

The Client _isFromLoadBalancer state from SERVER-58562 is better off living in the per-Client decoration struct we're going to need anyway for more advanced features of load balancer support. Moving it as part of SERVER-58502.

Generated at Thu Feb 08 05:44:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.