[SERVER-47029] Fix race when streamable RSM updates the shard registry after topology change Created: 20/Mar/20  Updated: 29/Oct/23  Resolved: 23/Mar/20

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.4.0-rc0

Type: Bug Priority: Major - P3
Reporter: Janna Golden Assignee: Lamont Nelson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Problem/Incident
causes SERVER-47169 Sharding initialization contacts conf... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Sharding 2020-03-23, Sharding 2020-04-06
Participants:
Linked BF Score: 21

 Description   

From BF description:
There is a race when updating the ShardRegistry/config.shards on mongos. Mongos gets an isMaster response from two different nodes (node0, node1) in the same replica set after node0 was removed. Node0 sends its response first and includes itself in the response with type 'ghost' and node1 does not include this node in the response at all. Mongos updates the topology description with the response from node0 and then does the same with the second response from node1, then calls onConfirmedSet on the ReplicaSetChangeNotifier. This causes the shard registry to update its info for this repl set and write to config.shards, but the second notifier event (triggered by the response from node1) reaches the shard registry first and then the event triggered by node0. This means we first write that the replica set only has two nodes, and then overwrite it and include the removed node.

A possible fix is to not include nodes that are not primaries/secondaries in the connection string passed to the shard registry.



 Comments   
Comment by Githook User [ 23/Mar/20 ]

Author:

{'email': 'lamont.nelson@mongodb.com', 'name': 'Lamont Nelson', 'username': 'lamontnelson'}

Message: SERVER-47029: add only confirmed nodes when publishing onConfirmedSet; include best effort guess when nothing has been confirmed yet.
Branch: v4.4
https://github.com/mongodb/mongo/commit/55549b3383e36b6b5646354c3e0a7519add48e5d

Comment by Githook User [ 23/Mar/20 ]

Author:

{'name': 'Lamont Nelson', 'username': 'lamontnelson', 'email': 'lamont.nelson@mongodb.com'}

Message: SERVER-47029: add only confirmed nodes when publishing onConfirmedSet; include best effort guess when nothing has been confirmed yet.
Branch: master
https://github.com/mongodb/mongo/commit/44564015b0a8c4ae65b876dbb06e0a95f5a6d876

Generated at Thu Feb 08 05:13:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.