[CSHARP-2123] Driver should ensure maxTimeMS value sent to server is valid Created: 10/Dec/17  Updated: 28/Oct/23  Resolved: 08/Jan/18

Status: Closed
Project: C# Driver
Component/s: Read Operations
Affects Version/s: 2.4.4
Fix Version/s: 2.7.0

Type: Bug Priority: Minor - P4
Reporter: Andrey Kondratyev [X] Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File MongoError.png    
Backwards Compatibility: Fully Compatible

 Description   

The .NET driver currently sends the maxTimeMS parameter to the server as a BSON double. The server requires that the value for maxTimeMS be an integral number of milliseconds. When the driver converts a MaxTime TimeSpan value to a maxTimeMS to send to the server it should map values that contain fractional milliseconds to an appropriate integral value.

Fractional milliseconds should always be adjusted to the next highest integral value.

We don't want to round down because:

1. That could result in the server aborting the operation sooner than the application specified
2. Rounding values smaller than 1.0 down to 0.0 would result in unexpected behavior because the server interprets 0 as meaning no maxTimeMS



 Comments   
Comment by Githook User [ 08/Jan/18 ]

Author:

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

Message: CSHARP-2123: Make MaxTimeHelper internal.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/4b727f6a693aa7f13c6bf0a9b49b988b5402480b

Comment by Githook User [ 08/Jan/18 ]

Author:

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

Message: CSHARP-2123: Round up to the next highest integral maxTimeMS instead of truncating.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/50c119f6c1a5718e45412874ca46bf8d7aa5a688

Comment by Githook User [ 08/Jan/18 ]

Author:

{'name': 'Andrey Kondratyev', 'username': 'byTimo', 'email': 'race.timo@gmail.com'}

Message: CSHARP-2123 Change maxTimeMS set from double to int
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/ef9872aab393568ca5a12e167d06c0c5188c78b7

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