[SERVER-77154] Change server's internal client implementations to always use "hello" rather than "isMaster" for the connection handshake Created: 15/May/23  Updated: 29/Oct/23  Resolved: 05/Jun/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 6.0.7, 7.0.0-rc3

Type: Improvement Priority: Major - P3
Reporter: David Storch Assignee: David Storch
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Duplicate
is duplicated by SERVER-53034 Investigate internal usages of "isMas... Closed
Related
is related to SERVER-59300 Change AsyncDBClient to use OP_MSG fo... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.0, v6.0
Sprint: QE 2023-05-29, QE 2023-06-12
Participants:

 Description   

The "hello" command was introduced in 5.0 and was intended as a replacement for the "isMaster" command. However, drivers still issue the initial connection handshake using an OP_QUERY isMaster command in some circumstances order to ensure that they can communicate with older servers. This is discussed in this section of the drivers' connection handshake specification:

https://github.com/mongodb/specifications/blob/474ddfcc335225df4410986be2b10ae41a736d20/source/mongodb-handshake/handshake.rst#connection-handshake

The server's implementation of the client, however, does not need to connect to old server versions that do not support "hello" or OP_MSG. The server codebase's client implementations are also used inside the legacy mongo shell. The mongo shell became an internal test-only tool starting in 6.0, and therefore it also does not have to remain compatible with servers before 5.0 that either don't support "hello" or OP_MSG. For these reasons, it should be safe to make the AsyncDBClient and DBClientConnection always use "hello" rather than "isMaster".

Looking at the code, the AsyncDBClient always uses "isMaster" and can be changed to always use "hello" instead. The DBClientConnection uses "hello" if an API version is set but should change to use "hello" unconditionally.



 Comments   
Comment by Githook User [ 08/Jun/23 ]

Author:

{'name': 'David Storch', 'email': 'david.storch@mongodb.com', 'username': 'dstorch'}

Message: SERVER-77154 Always use "hello" for connection handshake in internal client code

(cherry picked from commit a8f33f8888f76f07e01edec9b0ba90a8a336e6ae)
Branch: v6.0
https://github.com/mongodb/mongo/commit/6a5a43a7fafcf3e3e7dfcda72b917cd417e6778e

Comment by Githook User [ 06/Jun/23 ]

Author:

{'name': 'David Storch', 'email': 'david.storch@mongodb.com', 'username': 'dstorch'}

Message: SERVER-77154 Always use "hello" for connection handshake in internal client code

(cherry picked from commit 379a9256c85ce6871fbe1792bd578d8dbd06a065)
Branch: v7.0
https://github.com/mongodb/mongo/commit/a8f33f8888f76f07e01edec9b0ba90a8a336e6ae

Comment by Githook User [ 05/Jun/23 ]

Author:

{'name': 'David Storch', 'email': 'david.storch@mongodb.com', 'username': 'dstorch'}

Message: SERVER-77154 Always use "hello" for connection handshake in internal client code
Branch: master
https://github.com/mongodb/mongo/commit/379a9256c85ce6871fbe1792bd578d8dbd06a065

Generated at Thu Feb 08 06:34:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.