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

E11000 duplicate key error index while stopping the Balancer

    • Type: Icon: Bug Bug
    • Resolution: Incomplete
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.8
    • Component/s: Sharding
    • Environment:
      Linux 64-bit
      2 shards of 3 servers each ( Primary/Secondary/Arbiter )
    • ALL

      Our MongoDB Backup script (python) disables the balancer using:

      self.config_db.set_lasterror_options(fsync=True)
      self.config_db.settings.update(

      { '_id' : "balancer" }

      , { '$set' :

      { 'stopped' : True}

      }, True, False, True)

      About 30% of the time, the following exception is thrown:

      06:41:18 Traceback (most recent call last):
      06:41:18 File "/opt/XXXX/bin/mongo.backup.py", line 398, in <module>
      06:41:18 balancer.disableBalancer()
      06:41:18 File "/opt/XXXX/bin/mongo.backup.py", line 47, in disableBalancer
      06:41:18 self.__setBalancer (True)
      06:41:18 File "/opt/XXXX/bin/mongo.backup.py", line 43, in __setBalancer
      06:41:18 self.config_db.settings.update(

      { '_id' : "balancer" }

      , { '$set' :

      { 'stopped' : bol }

      }, True, False, True)
      06:41:18 File "/usr/lib64/python2.6/site-packages/pymongo/collection.py", line 411, in update
      06:41:18 check_keys, self._uuid_subtype), safe)
      06:41:18 File "/usr/lib64/python2.6/site-packages/pymongo/connection.py", line 831, in _send_message
      06:41:18 rv = self.__check_response_to_last_error(response)
      06:41:18 File "/usr/lib64/python2.6/site-packages/pymongo/connection.py", line 778, in __check_response_to_last_error
      06:41:18 raise DuplicateKeyError(details["err"])
      06:41:18 pymongo.errors.DuplicateKeyError: E11000 duplicate key error index: XXXX.m_generics.$id dup key: { : "11f1952c-55b0-474b-950e-f03c54d538b5" }

      After a few attempts, the script succeeds in disabling the balancer.
      Any ideas of how to handle this? Does this point to a bigger issue (are there really duplicate keys somehow?)

            Assignee:
            david.hows David Hows
            Reporter:
            tewner Michael Tewner
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: