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

XMLWordPrintableJSON

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

      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:
              [DO NOT USE] Backlog - Query Execution
              Reporter:
              Bernard Gorman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: