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

ReplicaSet Intial Sync gives replSet syncTail: 11000 E11000 duplicate key error index

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.1.1
    • Affects Version/s: 2.0.1
    • Component/s: Replication
    • Environment:
      Linux 2.6.32-35-server, Ubuntu 10.04, MongoDB 2.0.1, Replicaset with 3 Nodes, NUMA, 2x XEON E5620 , 24 GB RAM
    • Linux

      What we want to do:
      We have a 3 Node replicaset and we want to add another node which should be dedicated for backups. This backup machine is not as powerful as the productive nodes.

      What error do we get:
      After we added the clean backup node to the set, it does the initial sync and after some time we get an duplicate error:
      Wed Nov 16 11:02:49 [rsSync] replSet syncTail: 11000 E11000 duplicate key error index: keywords.keywordAccountMappings.$accountId_1 dup key: { : 1323880 }, syncing: { ts: Timestamp 1321392524000|36, h: -5191181626474352236, op: "i", ns: "keywords.keywordAccountMappings", o: { _id: ObjectId('4ec2d98c1820b45cca0fe5dc'), accountId: 1323880, keywords: [

      { keyword: ObjectId('4e70b0e118a39bb918001631'), createdAt: new Date(1321392524000) }

      ] } }

      Differences between old nodes and the new node:
      the new node has a slower IO system, just 12 GB ram, a slight slower cpu and there is a 2nd mongod shard instance running, which backups another replicaset.
      On the old nodes we have the mongodb index version 0 (1.8) and the new backup node has the latest index version 1 (2.0).

      What we suspect that the use of $addToSet in combination with upsert might cause the replication errors:
      This code creates a new keyword to the keywordAccountMappings:
      $keywordAccountMappingBeanCollection->update(
      array(
      'accountId' => $accountId
      ),
      array(
      '$addToSet' => array(
      'keywords' => array(
      'keyword' => new \MongoId($keywordId),
      'createdAt' => new \MongoDate(time())
      )
      )
      ),
      array(
      'upsert' => true,
      'safe' => true
      )
      };

      we also have an mms account assigned with my user account.

        1. secondary.log.zip
          16 kB
        2. primary.log.zip
          138 kB

            Assignee:
            kristina Kristina Chodorow (Inactive)
            Reporter:
            steffen Steffen
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: