[SERVER-54803] StreamableReplicaSetMonitor registers a new topology listener per call to getHostsOrRefresh Created: 25/Feb/21  Updated: 29/Oct/23  Resolved: 08/Jun/21

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: 4.4.4
Fix Version/s: 4.4.5, 5.0.0-rc1, 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Matthew Saltz (Inactive) Assignee: Lamont Nelson
Resolution: Fixed Votes: 0
Labels: bkp, sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0, v4.4
Sprint: Service Arch 2021-03-22
Participants:
Case:
Story Points: 4

 Description   

Whenever StreamableReplicaSetMonitor::getHostsOrRefresh is called (which happens on every query), if the result isn't immediately available, we enqueue a query object for that host, to be resolved when the host becomes available. As part of enqueuing a query, we unconditionally register the query processor as an event listener for topology changes. We only remove that listener when all outstanding queries are satisfied, but that won't happen as long as the node the RSM is targeting is down or unable to be contacted. Registering a listener does not do any deduplication to check whether the passed-in pointer is the same, which means the list of listeners will continue to grow as long as there are new queries. It also means that every time there's a topology change event, ALL of those listeners will then call requestImmediateCheck.

 

We should change it so that the RSM _queryProcessor topology listener is only registered at most once.



 Comments   
Comment by Githook User [ 08/Jun/21 ]

Author:

{'name': 'Matthew Saltz', 'email': 'matthew.saltz@mongodb.com', 'username': 'saltzm'}

Message: SERVER-54803 Only register _queryProcessor once in StreamableRSM

(cherry picked from commit d6394bb39aae0ae99cfeeb9569203de2ff98e11a)
Branch: v5.0
https://github.com/mongodb/mongo/commit/2a98238a5a51521cd022a68ebfd79b5a39796b8d

Comment by Githook User [ 07/Jun/21 ]

Author:

{'name': 'Matthew Saltz', 'email': 'matthew.saltz@mongodb.com', 'username': 'saltzm'}

Message: SERVER-54803 Only register _queryProcessor once in StreamableRSM
Branch: master
https://github.com/mongodb/mongo/commit/d6394bb39aae0ae99cfeeb9569203de2ff98e11a

Comment by Lamont Nelson [ 26/May/21 ]

This shouldn't conflict with SERVER-56854 since that is for the 4.0 & 4.2 branches. It looks like this one just needs to be ported to 5.0 and master.

Comment by Matthew Saltz (Inactive) [ 18/Mar/21 ]

Re-opening and opening a 4.4 Backport ticket, which I'll then immediately close since the commit went straight to the 4.4 branch

Comment by Githook User [ 18/Mar/21 ]

Author:

{'name': 'Matthew Saltz', 'email': 'matthew.saltz@mongodb.com', 'username': 'saltzm'}

Message: SERVER-54803 Only register _queryProcessor once in StreamableRSM
Branch: v4.4
https://github.com/mongodb/mongo/commit/80250fc73deb1d300473b8d2e9e98b5385da90c7

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