[SERVER-25238] Change initialization of ShardingState::_rangeDeleterTaskExecutor to make the NetworkInterface externally settable for testing. Created: 22/Jul/16  Updated: 06/Dec/22  Resolved: 26/Jul/16

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

Type: Task Priority: Major - P3
Reporter: Dianna Hohensee (Inactive) Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Gantt Dependency
has to be done before SERVER-24367 Implement CollectionRangeDeleter task... Closed
Assigned Teams:
Sharding
Sprint: Sharding 18 (08/05/16)
Participants:

 Description   

_rangeDeleterTaskExecutor is currently initialized by ShardingState::_initializeRangeDeleterTaskExecutor().

We want to make this a public function, and have it take "NetworkInterface* netPtr" as a parameter with which to initialize the task executor.

This shiny new public function will get called above this code: https://github.com/mongodb/mongo/blob/master/src/mongo/db/db.cpp#L712-L738, which calls the regular sharding initialization code.

Now in testing we can set up a task executor with a mock network interface. In ShardingStateTest::setUp, we want to call our shiny new function above this code https://github.com/mongodb/mongo/blob/master/src/mongo/db/s/sharding_state_test.cpp#L135-L139

And finally we want to test the task executor, so make a test to give it a silly task – e.g. pass in a variable by reference that gets set to some value --, wait for it to finish, check it did what you wanted.



 Comments   
Comment by Kaloian Manassiev [ 26/Jul/16 ]

I don't see any use in making this TaskExecutor testable. It won't be used for any networking activity and it will only run the cleanup tasks, so there is nothing to test about it.

Let's close this ticket for now and if in the future we expand the usage of this TaskExecutor, we we will open a new one with the specific testing we plan to do.

Comment by Dianna Hohensee (Inactive) [ 26/Jul/16 ]

No, we don't need it in order to continue work on the ColelctionRangeDeleter. As far as whether it should be done – make the task executor testable, and test it in ShardingStateTest – is something I'm not sure how to evaluate.

Comment by Kaloian Manassiev [ 26/Jul/16 ]

Like we discussed yesterday, there is a better way to test the CollectionRangeDeleter by directly invoking the cleanup logic. Given that, do we still need to be able to mock the NetworkInterface?

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