[CSHARP-4014] Remove code to run `getLastError` command once minimum supported server is 4.2 Created: 13/Jan/22  Updated: 16/Nov/22

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

Type: Improvement Priority: Major - P3
Reporter: Dmitry Lukyanov (Inactive) Assignee: Unassigned
Resolution: Unresolved 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
Server Compat: 4.1

 Description   

In the scope of CSHARP-3480, we removed using "buildInfo", we also can consider removing "getLastError".

NOTE: currently, the spec tests don't expect that we call it that forced us to apply a workaround in UnifiedEventMatcher here



 Comments   
Comment by Robert Stam [ 18/Jan/22 ]

Removing the link to CSHARP-3480 as this is unrelated.

CSHARP-3480 is about using `MaxWireVersion` instead of `ServerVersion` which allows us to stop running the `buildInfo` command, which is the only way to get the server version.

This ticket is about not running the `getLastError` command which is a different issue.

While they do have in common that they both are efforts to remove code, they are different scenarios.

Comment by Robert Stam [ 18/Jan/22 ]

As background: the reason we used to run the `getLastError` command is to get the `connectionId` value. This is the server's `connectionId`. We want to associate the server's `connectionId` with the client's connection to make it easier to correlate errors or events that are observed client-side with a corresponding server connection. That information is usually needed to correlate with events in the server log.

Since at least server version 4.0 the `hello` comand has been including the `connectionId` in the response. When we are able to get the `connectionId` from the `hello` response we do not run the `getLastError` command.

So use of this command has essentially gone away by itself due to the `connectionId` field being added to the `hello` response.

We should leave this ticket open for now so that once 4.0 becomes the minimum supported server version we can physically remove the code that conditionally runs the `getLastError` command.

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