[SERVER-19537] Allow replSetInitiate on nodes not started with --replSet Created: 23/Jul/15  Updated: 25/Jan/17  Resolved: 08/Aug/15

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.1.7

Type: New Feature Priority: Major - P3
Reporter: Andy Schwerin Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DOCS-6009 document replSetInitiate behavior whe... Closed
is depended on by SERVER-1448 Host sharding config data on a replic... Closed
Related
related to SERVER-22731 give correct error message when runni... Closed
related to SERVER-19524 Support for configServer labeling of ... Closed
is related to SERVER-23698 Remove ability to run replSetInitiate... Closed
Backwards Compatibility: Fully Compatible
Sprint: RPL 7 08/10/15, RPL 8 08/31/15
Participants:

 Description   

If a node is started without --replSet, and it has neither an oplog nor a local replica set config document, the operator should be able to run replSetInitiate to create a single-node replica set configuration and to prime the oplog. Then, on restart if the operator adds --replSet to the startup configuration directives, the node can immediately transition into PRIMARY rather than waiting in STARTUP for the operator to run replSetInitiate. This should only be allowed for single-node replica set configurations.



 Comments   
Comment by Githook User [ 08/Aug/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-19537 allow replSetInitiate on nodes not started with --replSet
Branch: master
https://github.com/mongodb/mongo/commit/3a30ae195c62b0ae9bdb78e5733a90ae163eeadf

Comment by Githook User [ 08/Aug/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-19537 replication coordinator processReplSetInitiate() validates config and initializes oplog even when replication is disabled
Branch: master
https://github.com/mongodb/mongo/commit/d1484927405b1ab581bcdf380837bfe9fc00b1fb

Comment by Githook User [ 08/Aug/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-19537 replication coordinator external state initiateOplog() should bypass OpObserver and invoke _logOp() directly when replication is disabled
Branch: master
https://github.com/mongodb/mongo/commit/7e5a88c5ebb543c44df144951ab3daf535600df8

Comment by Githook User [ 08/Aug/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-19537 added updateReplOpTime to ReplicationCoordinatorExternalState::initiateOplog()
Branch: master
https://github.com/mongodb/mongo/commit/644e5ed34012780de090f2c8b0dcffd334af166c

Comment by Githook User [ 08/Aug/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-19537 extended _logOp and createOplog to accept optional collection name and replication settings.

This supports creating the oplog collection and appending oplog entries when replication is disabled.
Branch: master
https://github.com/mongodb/mongo/commit/8800fe3529cfea045c49d065b4b2694ed334cc07

Comment by Githook User [ 08/Aug/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-19537 assert.commandFailedWithCode should return command result
Branch: master
https://github.com/mongodb/mongo/commit/ac92a2b394003895360d83b0eb9fa55ea382b274

Comment by Kevin Pulo [ 24/Jul/15 ]

Given that initiate normally adds a

{ ..., "op" : "n", "ns" : "", "o" : { "msg" : "initiating set" } }

entry to the oplog, I think maybe we need to prime the oplog here?

Comment by Scott Hernandez (Inactive) [ 23/Jul/15 ]

We may also want to ensure that the config contains a single voting+electable member which is the node running the command – members.size() == 1 && member[0] is self and non-prio-0 with a vote.

Comment by Eric Milkie [ 23/Jul/15 ]

Mini-spec:
If replSetInitiate command is run on a node that has not been started with "-master" nor "slave" nor "-replSet", instead of returning an error, it shall:

  1. Return an error if no config document was explicitly passed in to the command, since we have no way of determining the rs name.
  2. Do no config state changes, since this command will never leave the config state in an incomplete state.
  3. Return an error if a config already exists in local.system.replset.
  4. Continue to validate the syntax and settings of the config object in the same way as replset initiate.
  5. Return an error if the members array is not size 1, or if the element in the members array is not self.
  6. Skip the quorum check.
  7. Store the initial config document.
  8. Prime the oplog

The goal is to leave the node in such a state that when you restart the process with --replSet, it loads the stored config and immediately proceeds regular replica set startup and eventually ends up in PRIMARY state with no further user interaction.

Generated at Thu Feb 08 03:51:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.