Description
Today almost every task executed by the master implements ClusterStateTaskListener
, but this isn't required by the API and there are a few tasks which pass in a separate listener instead. It'd open the door to some simplifications if we could change the API to remove the ability to pass a separate listener. This issue tracks the tasks that need changing for this refactoring:
-
JoinTaskExecutor#Task
andJoinHelper#JoinTaskListener
(Combine join task and listener #82645) -
NodeRemovalClusterStateTaskExecutor#Task
(node removal task listener #82663) -
PutMappingClusterStateUpdateRequest
(Combine put-mapping task and listener #82646) -
ShardSnapshotUpdate
(Combine ShardSnapshotUpdate and ClusterStateTaskListener #82672) -
ShardStateAction#FailedShardEntry
(FailedShardEntry task listener #82795) -
ShardStateAction#StartedShardEntry
(StartedShardUpdateTask task listener #82854) - all the usages in
MasterServiceTests
that today useObject
(ClusterStateTaskListener usage refactoring in MasterServiceTests #82869) - Update the signature of
submitStateUpdateTask
(Update the signature of thesubmitStateUpdateTask
across the codebase. #82942) - Finally, change the type parameter of
ClusterStateTaskExecutor
to one whichextends ClusterStateTaskListener
. (restrict generic parameter type in ClusterStateTaskExecutor #83024)
In each case the goal is to change a call to MasterService#submitStateUpdateTask
to take the same object for task
and listener
parameters. I believe we can just add a ActionListener<Void>
field to JoinTaskExecutor#Task
and NodeRemovalClusterStateTaskExecutor#Task
, but the other ones are used in other contexts so I think it makes sense to wrap each one in a separate task object which pairs the existing object with a new listener, and adjust the executor to match.
IMO it seems wise to do these steps as separate PRs since most of these cases trigger quite a few knock-on changes in tests etc. and it'll be easier to review each step in isolation.
These are all the ones I can see from a quick look through the code but the last step may identify other tasks that need the same treatment.