Skip to content

Commit 69024e0

Browse files
committed
Fix project creation
1 parent 585095c commit 69024e0

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

server/src/main/java/org/elasticsearch/snapshots/RestoreService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ private void startRestore(
486486
@FixForMultiProject
487487
final ProjectId projectId = ProjectId.DEFAULT;
488488
ProjectMetadata.Builder projectBuilder = metadataBuilder.getProject(projectId);
489+
if (projectBuilder == null) {
490+
projectBuilder = ProjectMetadata.builder(projectId);
491+
metadataBuilder.put(projectBuilder);
492+
}
489493
for (IndexId indexId : repositoryData.resolveIndices(requestedIndicesIncludingSystem).values()) {
490494
IndexMetadata snapshotIndexMetaData = repository.getSnapshotIndexMetaData(repositoryData, snapshotId, indexId);
491495
if (snapshotIndexMetaData.isSystem()) {

x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageDeciderService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,12 @@ public void applyRouting(RoutingTable.Builder routing) {
718718
public void applyMetadata(Metadata.Builder metadataBuilder) {
719719
@FixForMultiProject
720720
final ProjectId projectId = ProjectId.DEFAULT;
721-
applyProjectMetadata(metadataBuilder.getProject(projectId));
721+
ProjectMetadata.Builder projectBuilder = metadataBuilder.getProject(projectId);
722+
if (projectBuilder == null) {
723+
projectBuilder = ProjectMetadata.builder(projectId);
724+
metadataBuilder.put(projectBuilder);
725+
}
726+
applyProjectMetadata(projectBuilder);
722727
}
723728

724729
public void applyProjectMetadata(ProjectMetadata.Builder projectBuilder) {

0 commit comments

Comments
 (0)