Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,7 @@ public static Metadata readFrom(StreamInput in) throws IOException {
}

private static void readBwcCustoms(StreamInput in, Builder builder) throws IOException {
final ProjectMetadata.Builder projectBuilder = builder.getProject(ProjectId.DEFAULT);
final Set<String> clusterScopedNames = in.namedWriteableRegistry().getReaders(ClusterCustom.class).keySet();
final Set<String> projectScopedNames = in.namedWriteableRegistry().getReaders(ProjectCustom.class).keySet();
final int count = in.readVInt();
Expand All @@ -1245,9 +1246,9 @@ private static void readBwcCustoms(StreamInput in, Builder builder) throws IOExc
if (custom instanceof PersistentTasksCustomMetadata persistentTasksCustomMetadata) {
final var tuple = persistentTasksCustomMetadata.split();
builder.putCustom(tuple.v1().getWriteableName(), tuple.v1());
builder.putProjectCustom(tuple.v2().getWriteableName(), tuple.v2());
projectBuilder.putCustom(tuple.v2().getWriteableName(), tuple.v2());
} else {
builder.putProjectCustom(custom.getWriteableName(), custom);
projectBuilder.putCustom(custom.getWriteableName(), custom);
}
} else {
throw new IllegalArgumentException("Unknown custom name [" + name + "]");
Expand Down Expand Up @@ -1552,7 +1553,8 @@ public Builder putCustom(String type, ClusterCustom custom) {

@Deprecated(forRemoval = true)
public Builder putCustom(String type, ProjectCustom custom) {
return putProjectCustom(type, custom);
getSingleProject().putCustom(type, Objects.requireNonNull(custom, type));
return this;
}

public ClusterCustom getCustom(String type) {
Expand All @@ -1575,12 +1577,6 @@ public Builder customs(Map<String, ClusterCustom> clusterCustoms) {
return this;
}

@Deprecated(forRemoval = true)
public Builder putProjectCustom(String type, ProjectCustom custom) {
getSingleProject().putCustom(type, Objects.requireNonNull(custom, type));
return this;
}

@Deprecated(forRemoval = true)
public Builder projectCustoms(Map<String, ProjectCustom> projectCustoms) {
projectCustoms.forEach((key, value) -> Objects.requireNonNull(value, key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,16 @@ private Tuple<Metadata, Metadata> randomMetadataAndUpdate() {
ClusterPersistentTasksCustomMetadata::new
)
)
.putProjectCustom(
PersistentTasksCustomMetadata.TYPE,
mutatePersistentTasks(
PersistentTasksCustomMetadata.get(before.getProject(Metadata.DEFAULT_PROJECT_ID)),
MetadataPersistentTasksTests::oneProjectPersistentTask,
PersistentTasksCustomMetadata::new
)
.put(
ProjectMetadata.builder(before.getProject(Metadata.DEFAULT_PROJECT_ID))
.putCustom(
PersistentTasksCustomMetadata.TYPE,
mutatePersistentTasks(
PersistentTasksCustomMetadata.get(before.getProject(Metadata.DEFAULT_PROJECT_ID)),
MetadataPersistentTasksTests::oneProjectPersistentTask,
PersistentTasksCustomMetadata::new
)
)
)
.build();
return new Tuple<>(before, after);
Expand Down