-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Component/s: None
-
None
In DRIVERS-335 we rename maxStalenessMS to maxStalenessSeconds and change the smallest value for it. In this ticket, we change the behaviors for maxStalenessSeconds=0 and maxStalenessSeconds=-1.
The spec originally specified 0 for "no max", but that value is confusing. Users will expect 0 to mean "no lag". The spec has been updated to use -1 instead (0 is now illegal).
A MongoClient with this connection string has no max staleness, the same as if "maxStalenessSeconds" were omitted from the connection string:
mongodb://host/?readPreference=secondary&maxStalenessSeconds=-1
This connection string with mode "primary" is valid and does not raise an error:
mongodb://host/?readPreference=primary&maxStalenessSeconds=-1
Same with this implicit mode "primary", this is valid too:
mongodb://host/?maxStalenessSeconds=-1
In code, -1 is an acceptable value meaning "no max staleness". E.g. in PyMongo:
MongoClient(readPreference="secondary", maxStalenessSeconds=-1)
You MAY accept null in code, too: up to you.
These are no longer valid:
mongodb://host/?readPreference=secondary&maxStalenessSeconds=0
mongodb://host/?readPreference=primary&maxStalenessSeconds=0
You can choose whether to explicitly prohibit 0 and raise an error as soon as the URI is parsed, or later when you're in server selection you could raise an error since maxStalenessSeconds=0 is too small: maxStalenessSeconds must be at least heartbeatFrequencyMS + idleWriteFrequencyMS (DRIVERS-335).
- depends on
-
JAVA-2383 Java driver IllegalStateException: state should be: elapsed time is positive
- Closed
-
CSHARP-1833 Change "no maxStalenessSeconds" value from 0 to -1
- Closed
-
CXX-1139 Change "no maxStalenessSeconds" value from 0 to -1
- Closed
-
NODE-858 Change "no maxStalenessSeconds" value from 0 to -1
- Closed
-
PHPC-840 Change "no maxStalenessSeconds" value from 0 to -1
- Closed
-
RUBY-1177 Change "no maxStalenessSeconds" value from 0 to -1
- Closed
-
PYTHON-1169 Change maxStalenessMS default to -1 (No max)
- Closed
-
CDRIVER-1908 Change "no maxStalenessMS" value from 0 to -1
- Closed
- is related to
-
DRIVERS-335 Update Max Staleness implementation
- Closed
-
DRIVERS-293 Allow users to set a limit on acceptable staleness
- Closed
-
DRIVERS-340 Make minimum value of maxStalenessSeconds 90 seconds
- Closed