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

Upsert fails with "cannot modify shard key" when not modifying shard key

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.4
    • Affects Version/s: 2.4.0
    • Component/s: Sharding
    • None
    • Environment:
      Debian Wheezy amd64
    • ALL

      After upgrading to 2.4.0, updates stopped working. All of my updates are upserts, and they fail with the message "cannot modify shard key for collection tripquest.persistentlistings, found new value for q.md", both through the Perl MongoDB module and in the mongo shell.

      I've checked and double-checked, and the shard key is not being modified. It even happens when there is NO existing document. A straight insert does work.

      It also works if I run a 2.2.3 mongos and connect to the same configdb, with the same mongod's (all 2.4) behind it. With a 2.4.0 mongos, it doesn't work.

      Also, it complains that it found a new value for the first entry in "q". If I put "de" first, it complains that "de" is the new value. Likewise for "gw".

      The shard key is a composite:

      { "q.de" : 1, "q.gw" : 1, "q.md" : 1 }

            Assignee:
            scotthernandez Scott Hernandez (Inactive)
            Reporter:
            cmdrwalrus Chad Wallace
            Votes:
            6 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved: