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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1.1
    • Component/s: Replication
    • Labels:
    • 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
    • Operating System:
      Linux

      Description

      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.

        Attachments

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

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: