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

Multi updates can throw shard version errors resulting in writes applied multiple times

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: 2.6.11, 3.0.6, 3.1.7
    • Fix Version/s: Backlog
    • Component/s: Sharding, Write Ops
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Sharding 9 (09/18/15), Sharding 10 (02/19/16)

      Description

      Multi-updates set the OperationShardVersion to IGNORED (the ShardedConnectionInfo in 3.0 and prior), but they also call checkShardVersion, which checks against the version in the command sent, not the version attached to the operation/connection.

      Setting the OperationShardVersion to IGNORED prevents us from throwing a StaleVersionException in the middle of executing the update (via logOpForSharding), but we can still throw one at the very beginning of executing the update due to the checkShardVersion call. If this causes one shard to throw a version error but not another shard, the mongos will refresh its metadata and retry, potentially causing the update to execute twice on the shard that didn't encounter the version error.

      This is technically also an issue for multi-remove, but remove is idempotent so retrying it shouldn't cause any practical problems.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated: