[DRIVERS-336] Change "no maxStalenessSeconds" value from 0 to -1 Created: 09/Nov/16 Updated: 15/Apr/19 Resolved: 08/Dec/16 |
|
| Status: | Closed |
| Project: | Drivers |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Rathi Gnanasekaran | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Driver Compliance: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
In 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 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 ( |
| Comments |
| Comment by Rathi Gnanasekaran [ 08/Dec/16 ] |
|
Closing ticket as all linked tickets are resolved. |