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

Sharded $merge may fail with NotMaster or CursorNotFound if run immediately after a failover on one shard

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
    • Query Execution
    • Query 2019-12-30, Query 2020-01-13

      When shard A's Primary steps down and a new Primary is elected, there is a window of time during which the ReplicaSetMonitor on shards other than A still believe the original node is shard A's Primary. It is possible for a $merge to be issued during this window which is dispatched to shard B and will then fail with a NotMaster exception if it attempts to write to shard A, since the writes will be targeted towards a node which is now Secondary. It appears that it is also possible for a CursorNotFound exception to result due to a NotMasterNoSlaveOk exception on shard A if the $merge is dispatched to a shard as part of the latter half of a split pipeline.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            bernard.gorman@mongodb.com Bernard Gorman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: