Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2168

Allow read only slaves to enter Secondary state even if Primary is unreachable

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • 1.7.3
    • Replication
    • None

    Description

      As per the summary, it would be good to optionally configure specific slaves to enter Secondary state even if they cannot contact Primary. In my particular scenario the nature of the data is such that it is safe to serve that data to clients without checking Primary on startup.

      My test setup is a 5 node layout: 3 with Priority 1, and 2 with Priority 0 (i.e. read-only always secondary). The secondary servers are on a separate physical machine from the primary ones. I pretend to have a power cut and reboot the primary machine. It starts up - but no mongod instances running. Likewise, I pretend the secondary also has power cut and reboot it. It starts up - and so does mongod (let's say someone slipped up to not configure primary to automatically start mongod). The secondary priority-0 instances now remain in STARTUP2 state until a Primary is reachable. Thus when I try to query (using mongo) I get:

      > db.getMongo().setSlaveOk()
      > use Example
      switched to db Example
      > db.Widget.find()
      error:

      { "$err" : "not master or secondary, can't read", "code" : 13436 }

      > Wed Dec 1 11:36:30 [conn4] assertion 13436 not master or secondary, can't read ns:Example.Widget query:{}

      This scenario is a very quirky one I admit. It's very unlikely but I'm just going through the corner cases.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mikec Mike Copley
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: