[CSHARP-3048] RetryableWrites are only supported if session Id has a value Created: 08/Apr/20  Updated: 28/Oct/23  Resolved: 13/Apr/20

Status: Closed
Project: C# Driver
Component/s: Write Operations
Affects Version/s: 2.10.3
Fix Version/s: 2.10.4

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Case:
Backwards Compatibility: Fully Compatible

 Description   

Certain server versions have an issue that can result in some mongos instances reporting a value for `LogicalSessionTimeoutMinutes` in the `isMaster` reply while other instances of mongos do not.

The C# driver currently assumes that all mongos instances would be consistent in either reporting or not reporting a value for `LogicalSessionTimeoutMinutes`.

When some mongos instances report a `LogicalSessionTimeoutMinutes` and some don't the driver gets confused and retryable writes fail because:

  1. It determines sessions are not supported because some mongos instances are missing 'LogicalSessionTimeoutMinutes` and will not include an "lsid" in the command
  2. But if a write operation is the routed to a mongos that does report `LogicalSessionTimeoutMinutes` it will conclude that retryable writes are suported and will include a "txnNumber" in the command

This results in an error from the server:

Command insert failed: Transaction number requires a sessionId to be specified.

The C# driver needs to workaround this server anomaly by verifying that session Id has a value before attempting a retryable write.

 



 Comments   
Comment by Githook User [ 13/Apr/20 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-3048: RetryableWrites are only supported if session Id has a value.
Branch: v2.10.x
https://github.com/mongodb/mongo-csharp-driver/commit/933dae43271d458cfe0b518465d9b5811a1decb6

Comment by Githook User [ 13/Apr/20 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-3048: RetryableWrites are only supported if session Id has a value.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/92bdb716dfbd6448592d4b51e4171c767eedebbe

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