-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Create a utility class for static SnapshotsService methods #127419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Create a utility class for static SnapshotsService methods #127419
Conversation
d0a8866
to
1268eee
Compare
This moves the static methods out of the SnapshotsService to make the stateful code more visible. This is one step towards refactoring the SnapshotsService.
1268eee
to
76b71c6
Compare
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
DiscoveryNodes nodes, | ||
Predicate<String> nodeIdRemovalPredicate, | ||
Map<RepositoryShardId, SnapshotsInProgress.ShardSnapshotStatus> knownFailures, | ||
Logger logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, and a couple other methods I've marked, are the only slight changes I made to the methods: passing in the SnapshotService's logger.
The rest of the changes in this file are purely IDE move operations out of the SnapshotsService file into this one, with a little method ordering done by me.
} | ||
} | ||
|
||
static <T> void failListenersIgnoringException(@Nullable List<ActionListener<T>> listeners, Exception failure, Logger logger) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the other change to add the logger
from SnapshotsService
, along with completeListenersIgnoringException()
below.
This moves the static methods out of the SnapshotsService to
make the stateful code more visible. This is one step towards
refactoring the SnapshotsService.
I'd like to eventually get the SnapshotsService into a state where it manages MasterService task queues, and submitting work to them, but the executor logic moved out to other files. Classes like SnapshotTaskExecutor (and related code, like SnapshotShardsUpdateContext) and UpdateNodeIdsForRemovalTask would get moved out.
Another future refactor target would be the logic stuffed into SnapshotsService#cloneSnapshot(): there's an anonymous class extension here and here. I'm guessing that can be made easier to follow.
Also can easily boot out UpdateSnapshotStatusAction into its own Transport* file just to get it out of there. Like TransportCloneSnapshotAction already is.
Let me know what you think of ^ @DaveCTurner