[SERVER-29519] Get rid of getGlobalReplicationCoordinator Created: 08/Jun/17  Updated: 30/Oct/23  Resolved: 02/Mar/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.5.9
Fix Version/s: 3.7.3

Type: Improvement Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Henrik Edin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-33286 Provide service context in Command::s... Closed
depends on SERVER-33460 Provide ServiceContext* when setting ... Closed
Related
is related to SERVER-31219 Get rid of getGlobalServiceContext Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2017-06-19, Sharding 2017-07-10, Platforms 2018-01-15, Platforms 2018-01-29, Platforms 2018-02-12, Platforms 2018-02-26, Platforms 2018-03-12
Participants:

 Description   
  • Instead all callers should be using repl::ReplicationCoordinator::get.


 Comments   
Comment by Githook User [ 02/Mar/18 ]

Author:

{'email': 'nicholas.zolnierz@mongodb.com', 'name': 'Nick Zolnierz', 'username': 'nzolnierzmdb'}

Message: SERVER-29519 Remove getGlobalReplicationCoordinator. Replace when getting decoration through service context (global if needed).

This reverts commit a8fddd07a740e959646995ef93139887b3b3eb5c.
Branch: master
https://github.com/mongodb/mongo/commit/fb3390f096192598f1bde7d3445e2580ccf0557e

Comment by Githook User [ 02/Mar/18 ]

Author:

{'email': 'nicholas.zolnierz@mongodb.com', 'name': 'Nick Zolnierz', 'username': 'nzolnierzmdb'}

Message: Revert "SERVER-29519 Remove getGlobalReplicationCoordinator. Replace when getting decoration through service context (global if needed)."

This reverts commit 7d37a75df3f6035a7afcb51123b88f0e99308fc8.
Branch: master
https://github.com/mongodb/mongo/commit/a8fddd07a740e959646995ef93139887b3b3eb5c

Comment by Githook User [ 02/Mar/18 ]

Author:

{'email': 'henrik.edin@mongodb.com', 'name': 'Henrik Edin', 'username': 'henrikedin'}

Message: SERVER-29519 Remove getGlobalReplicationCoordinator. Replace when getting decoration through service context (global if needed).
Branch: master
https://github.com/mongodb/mongo/commit/7d37a75df3f6035a7afcb51123b88f0e99308fc8

Comment by Githook User [ 02/Mar/18 ]

Author:

{'email': 'henrik.edin@mongodb.com', 'name': 'Henrik Edin', 'username': 'henrikedin'}

Message: SERVER-29519 Remove getGlobalReplicationCoordinator.
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/3896d0e793f01a173d1a67da8044ce3ebfc675d1

Comment by Henrik Edin [ 02/Feb/18 ]

Still work to do, returning to backlog.

Comment by Githook User [ 22/Jan/18 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-29519 Removed many usages of getGlobalReplicationCoordinator
Branch: master
https://github.com/mongodb/mongo/commit/c376f4b80d26028b6a8746f8545a35e390b59bf2

Comment by Kaloian Manassiev [ 18/Dec/17 ]

It shouldn't be a problem - the number of shards is fairly small.

Comment by Henrik Edin [ 18/Dec/17 ]

The commands doesn't use MONGO_INITIALIZER right now, but if we change that then passing the ServiceContext like you suggest would work. We also might not want to initialize commands once per ServiceContext, I don't know if they have any instance specific data they need to store. Even if we run several instances they could share command registry?

For the local shards, yeah it just felt silly to have the same pointer to a ServiceContext all over the place. But perhaps that's not a problem.

Comment by Kaloian Manassiev [ 18/Dec/17 ]

Command registration is global and their virtual functions need to pass a ServiceContext

I was thinking about that at the time when I filed this ticket. How about we just start passing the ServiceContext as part of the initializers? That way we can deliver it to the commands by making them be created in initializer blocks?

We might have lots of shards so a back pointer might not be the most efficient way of doing it, but passing a ServiceContext to the (all) interface(s) is not very elegant either.

What do you mean by that - are you concerned about the memory usage?

Comment by Henrik Edin [ 18/Dec/17 ]

Most of the places are easy to swap out for repl::ReplicationCoordinator::get but there are some exceptions:

Command registration is global and their virtual functions need to pass a ServiceContext (or ReplicationCoordinator). Now they just grab whatever globals they might need.

ExportedServerParameter is also registered globally, they probably need to be registered in a ServiceContext so different instances can have their separate parameters.

LocalShard is also getting the global replication coordinator to access some config. Need to figure how this mechanism should look like. We might have lots of shards so a back pointer might not be the most efficient way of doing it, but passing a ServiceContext to the (all) interface(s) is not very elegant either.

Generated at Thu Feb 08 04:21:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.