[DRIVERS-228] Use electionId to detect stale primaries. Created: 05/May/15  Updated: 15/Apr/19  Resolved: 04/Oct/16

Status: Closed
Project: Drivers
Component/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Barrie Segal Assignee: Barrie Segal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CXX-597 Use electionId to detect stale primar... Closed
depends on CXX-598 Use electionId to detect stale primar... Closed
depends on PHPC-297 Use electionId to detect stale primar... Closed
depends on CDRIVER-636 Use electionId to detect stale primar... Closed
depends on NODE-455 Update SDAM specification support to ... Closed
depends on PYTHON-924 Use electionId to detect stale primar... Closed
depends on CSHARP-1274 Use electionId reported by ismaster t... Closed
depends on JAVA-1799 Use electionId reported by ismaster t... Closed
depends on RUBY-912 Use electionId to detect stale primar... Closed
Related
related to SERVER-21744 Clients may fail to discover new prim... Closed
is related to SERVER-17975 Stale reads with WriteConcern Majorit... Closed
is related to SERVER-19979 Detect replset clock skew from electi... Backlog
Driver Compliance:
Key Status/Resolution FixVersion
JAVA-1799 Done 2.13.2, 3.0.2, 3.1.0, 2.14.0
PYTHON-924 Done 3.0.2
CDRIVER-636 Done 1.3.0-rc0
CSHARP-1274 Done 2.0.1, 2.1
PERL-526 Done 1.0.2
RUBY-912 Done 2.1.0
CXX-597 Done legacy-1.0.4
CXX-598 Done
PHPC-297 Done 1.1.0
NODE-455 Done

 Description   

Drivers should remember greatest electionId seen, and disbelieve primaries with electionIds that aren't greater.

electionId (in isMaster response) will be backported to 2.6.x.

Justification: only one election per 30 secs, servers must have clocks synced within 30 sec and run 3.0+ (or the 2.6.x mongod with the backport) for read-your-writes consistency with w: "majority" and primary reads.

Set false primaries to state "Unknown", will be re-checked by next periodic monitoring

Justification: will step down and roll back soon, remains a primary with obsolete electionId until then



 Comments   
Comment by Bernie Hackett [ 11/May/15 ]

See the spec changes in this commit for a full explanation:

https://github.com/mongodb/specifications/commit/becdb2e18e1bd67c5bdaadb04f719d5cd1a03867

Comment by A. Jesse Jiryu Davis [ 06/May/15 ]

Updated YAML tests are now tagged "server-discovery-tests-2015-05-11":

https://github.com/mongodb/specifications/tree/server-discovery-tests-2015-05-11/source/server-discovery-and-monitoring/tests

In the new tests, server descriptions include an "electionId" field; its format is an extended-JSON ObjectId:

"servers": {
    "a:27017": {
        "electionId": {
            "$oid": "000000000000000000000001"
        }, 
        "setName": "rs", 
        "type": "RSPrimary"
    }
}

Or if the server doesn't report one:

"servers": {
    "a:27017": {
        "electionId": null,
        "setName": "rs",
        "type": "RSPrimary"
    }
}

Generated at Thu Feb 08 08:21:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.