Skip to content
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

[8.x] Fix NPE in ReindexDataStreamTransportAction (#123262) #123265

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix NPE in ReindexDataStreamTransportAction (#123262)
In the multi-project branch, we're making some changes to persistent
tasks and those changes can cause the persistent tasks custom to still
be `null`. This resulted in an NPE here, so I'm fixing the check here.
  • Loading branch information
nielsbauman committed Feb 24, 2025
commit d29b8a443e3779f107d14069cc9bad3ea963d319
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ protected void doExecute(Task task, ReindexDataStreamRequest request, ActionList
ClientHelper.getPersistableSafeSecurityHeaders(transportService.getThreadPool().getThreadContext(), clusterService.state())
);
String persistentTaskId = getPersistentTaskId(sourceDataStreamName);

PersistentTasksCustomMetadata persistentTasksCustomMetadata = clusterService.state()
.getMetadata()
.custom(PersistentTasksCustomMetadata.TYPE);
PersistentTasksCustomMetadata.PersistentTask<?> persistentTask = persistentTasksCustomMetadata.getTask(persistentTaskId);
final var persistentTask = PersistentTasksCustomMetadata.getTaskWithId(clusterService.state(), persistentTaskId);

if (persistentTask == null) {
startTask(listener, persistentTaskId, params);
Expand Down