[JAVA-3255] Prefer connectionId from isMaster response to connectionid from getLastError response Created: 02/Apr/19  Updated: 28/Oct/23  Resolved: 05/Apr/19

Status: Closed
Project: Java Driver
Component/s: Connection Management
Affects Version/s: None
Fix Version/s: 3.11.0

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

Issue Links:
Depends
depends on SERVER-10637 Provide a mechanism to expose the con... Closed
Related
Server Compat: 4.1

 Description   

The Java driver currently executes the getLastError command as part of the server handshake, in order to get the connectionId from its response. This is useful for logging and monitoring connection use and correlating with server log files. As of 4.2, the server will return the connectionId in the isMaster response, which the driver has to execute anyway on every connection. If the driver detects a connectionId in the isMaster response, it should just use it and not execute getLastError.



 Comments   
Comment by Githook User [ 05/Apr/19 ]

Author:

{'name': 'Jeff Yemin', 'username': 'jyemin', 'email': 'jeff.yemin@10gen.com'}

Message: Get server connectionId from isMaster if possible

As of MongoDB 4.2, the isMaster response includes the connectionId.
Formerly this value was only available in the response to the
getLastError command. If the driver finds the connectionId in the
isMaster response, it will use it and then avoid executing the
getLastError command.

JAVA-3255
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/ead407d62934b97987e0ba1d45451e643274c9b2

Generated at Thu Feb 08 08:59:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.