[SERVER-40363] Change type of "_id" field of replica set config to be different from that of the member index Created: 27/Mar/19 Updated: 29/Oct/23 Resolved: 25/Jun/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | 4.2.0-rc2, 4.3.1 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | A. Jesse Jiryu Davis | Assignee: | Allison Easton |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | former-quick-wins, neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Backport Requested: |
v4.2
|
||||||||||||
| Sprint: | Repl 2019-06-03, Repl 2019-06-17, Repl 2019-07-01 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Original Description: Replica set config documents look like:
The "_id" field in member subdocuments isn't useful in any way I know, but requires extra typing and it must be chosen to obey certain rules (it must be unique and between 0 and 255 inclusive). If we handle it incorrectly it can cause bugs ( Let's consider deprecating _id, and eventually ignoring it completely. New Description: |
| Comments |
| Comment by Githook User [ 03/Jul/19 ] |
|
Author: {'name': 'Allison Easton', 'email': 'allison.easton@mongodb.com'}Message: (cherry picked from commit f79258d26879f22cd407d1ce1bf90f365dfc78fe) |
| Comment by Githook User [ 25/Jun/19 ] |
|
Author: {'name': 'Allison Easton', 'email': 'allison.easton@mongodb.com'}Message: |
| Comment by Samyukta Lanka [ 30/May/19 ] |
|
We suggest creating a new class called MemberId and changing the type of _id as well as _memberId to be MemberId. This new class would have one variable for its value, so that we will still be able to store the id as an int, but we will no longer confuse the id and the node's index in the member's array (and we'd be able to catch such a mistake at compile time). |
| Comment by Judah Schvimer [ 28/Mar/19 ] |
|
schwerin recommended making the _id a different type in the cpp code so that bugs like |
| Comment by Bruce Lucas (Inactive) [ 28/Mar/19 ] |
|
I think there's some diagnostic value to having an _id as a "short name" for a member that doesn't change as members are added to or removed from the replica set - it makes it easier to talk about the members. |
| Comment by Kevin Pulo [ 27/Mar/19 ] |
|
Based on getMemberId() and setMemberId() in repl::MemberData, the main place that these ids seem to be used is in replSetUpdatePosition and heartbeats. Likely both can be converted to using index position/hostname as appropriate, but upgrade/downgrade means we'll need a transition period where both are accepted. There may be other places in the server which parse the members subdocs and use _id, I'm not sure. |