Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-4468

mongod in STARTUP2 can participate in elections

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • v1.3.15
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None

      Regarding:
      http://docs.mongodb.org/manual/reference/replica-states/

      TL;DR: mongod members in STARTUP2 can participate in elections soon after state transition.

      During the course of an initial sync, mongod is in a state of STARTUP2 for the duration. While it is true that at the time we transition to STARTUP2 mongod can't vote (as RS threads have not been started), we start the RS threads immediately after the transition (https://github.com/mongodb/mongo/blob/r2.6.5/src/mongo/db/repl/rs.cpp#L556) and are eligible to participate and receive elect commands.
      Our gate check code when we receive an elect command (https://github.com/mongodb/mongo/blob/r2.6.5/src/mongo/db/repl/consensus.cpp#L223) has no logic to prevent voting in STARTUP2 and only blocks participation for invalid replset name or if our rs config is stale.

      All of this makes sense as is beneficial for an initial-syncing node to vote in elections. This allows mongod to maintain primary, even in the case where a majority of members are performing an initial sync.

            Assignee:
            milkie@mongodb.com Eric Milkie
            Reporter:
            james.wahlin@mongodb.com James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              9 years, 20 weeks, 3 days ago