[CDRIVER-4117] Error earlier if server does not support load balanced mode Created: 04/Aug/21  Updated: 15/Apr/22

Status: Backlog
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Kevin Albertson Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: CDRIVER-4107

 Description   

Background & Motivation
mongoc_cmd_parts_assemble currently checks if the topology description is load balanced when serializing a command for pre OP_MSG.

This is necessary to prevent an assertion in mongoc_cmd_parts_assemble_mongod. That asserts that the topology type is not load balanced.

In the scenario that the server is not a mongos and is a pre 3.6. _mongoc_cluster_stream_for_server will return an error with the message "Driver attempted to initialize in load balancing mode, but the server does not support this mode" if the server does not report a serviceId. But that error check only occurs after the authentication handshake is attempted.

The check is necessary to avoid the assertion during the authentication handshake. A preferable change would be to check for the presence of serviceId before authentication is attempted. That would preclude mongoc_cmd_parts_assemble from ever being called with a non-mongos server in load balanced mode.

Scope
When in load balanced mode, check for the presence of a serviceId field before authentication occurs and return an error.


Generated at Wed Feb 07 21:19:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.