[SERVER-52901] Make PrimaryOnlyService::_executor to be immutable and available for the entire POS object instance lifetime. Created: 16/Nov/20  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Suganthi Mani Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 1
Labels: sa-remove-fv-backlog-22
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-62221 Complete TODO listed in SERVER-52901 Closed
is related to SERVER-52695 Tenant Migration recipient Instance s... Closed
Assigned Teams:
Service Arch
Participants:
Story Points: 5

 Description   

Make PrimaryOnlyService::_executor to be immutable (initialize it in the POS constructor) and available for the entire POS object instance lifetime. So, by which POS methods can read PrimaryOnlyService::_executor without any synchronization rules.



 Comments   
Comment by Lauren Lewis (Inactive) [ 21/Dec/21 ]

We haven’t heard back from you in at least 1 year, so I'm going to close this ticket. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Comment by Suganthi Mani [ 17/Nov/20 ]

Notes: Initializing the PrimaryOnlyService::_executor in the POS constructor is not straight forward as it access derived class override methods getServiceName() and getThreadPoolLimits(). To make this possible we should make those methods as Static override using Curiously Recursive Template Pattern (CRTP) or using alternative solution suggested by Ben during offline discussion

Reposting Ben's idea.

Well, the simplest alternative looks like this:

class PrimaryOnlyService::Options {
public:
  ThreadPool::Limits getThreadPoolLimits() const;
  ...
};
PrimaryOnlyService::PrimaryOnlyService(ServiceContext *, PrimaryOnlyServiceOptions);

PrimaryOnlyService::PrimaryOnlyService(ServiceContext *, PrimaryOnlyServiceOptions);
Options could be pure virtual or plain old data. The former is probably more flexible?
It is just about the same amount of work as making it CRTP though.

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