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 @@ -222,9 +222,7 @@ private void updateSettingsOnIndices(
Map<String, Object> settingsToApply = new HashMap<>();
List<String> appliedToDataStreamOnly = new ArrayList<>();
List<String> appliedToDataStreamAndBackingIndices = new ArrayList<>();
Settings effectiveSettings = dataStream.getEffectiveSettings(
clusterService.state().projectState(projectResolver.getProjectId()).metadata()
);
Settings effectiveSettings = dataStream.getEffectiveSettings(projectResolver.getProjectMetadata(clusterService.state()));
for (String settingName : requestSettings.keySet()) {
if (APPLY_TO_BACKING_INDICES.contains(settingName)) {
settingsToApply.put(settingName, effectiveSettings.get(settingName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void writeTo(StreamOutput out) throws IOException {
@FixForMultiProject(description = "Replace ProjectId.DEFAULT")
static EnterpriseGeoIpTaskState getEnterpriseGeoIpTaskState(ClusterState state) {
PersistentTasksCustomMetadata.PersistentTask<?> task = getTaskWithId(
state.projectState(ProjectId.DEFAULT).metadata(),
state.metadata().getProject(ProjectId.DEFAULT),
EnterpriseGeoIpTask.ENTERPRISE_GEOIP_DOWNLOADER
);
return (task == null) ? null : (EnterpriseGeoIpTaskState) task.getState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected void masterOperation(
ActionListener<AcknowledgedResponse> listener
) throws Exception {
ProjectId projectId = projectResolver.getProjectId();
StreamsMetadata streamsState = state.projectState(projectId).metadata().custom(StreamsMetadata.TYPE, StreamsMetadata.EMPTY);
StreamsMetadata streamsState = state.metadata().getProject(projectId).custom(StreamsMetadata.TYPE, StreamsMetadata.EMPTY);
boolean currentlyEnabled = streamsState.isLogsEnabled();
boolean shouldEnable = request.shouldEnable();
if (shouldEnable != currentlyEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public Index[] concreteIndices(ProjectMetadata projectMetadata, IndicesRequest r
* indices options in the context don't allow such a case; if a remote index is requested.
*/
public String[] concreteIndexNames(ClusterState state, IndicesOptions options, String... indexExpressions) {
return concreteIndexNames(state.metadata().getProject(projectResolver.getProjectId()), options, indexExpressions);
return concreteIndexNames(projectResolver.getProjectMetadata(state), options, indexExpressions);
}

/**
Expand Down Expand Up @@ -243,12 +243,7 @@ public String[] concreteIndexNames(ProjectMetadata project, IndicesOptions optio
}

public String[] concreteIndexNames(ClusterState state, IndicesOptions options, boolean includeDataStreams, String... indexExpressions) {
return concreteIndexNames(
state.metadata().getProject(projectResolver.getProjectId()),
options,
includeDataStreams,
indexExpressions
);
return concreteIndexNames(projectResolver.getProjectMetadata(state), options, includeDataStreams, indexExpressions);
}

public String[] concreteIndexNames(
Expand All @@ -271,7 +266,7 @@ public String[] concreteIndexNames(
}

public String[] concreteIndexNames(ClusterState state, IndicesOptions options, IndicesRequest request) {
return concreteIndexNames(state.metadata().getProject(projectResolver.getProjectId()), options, request);
return concreteIndexNames(projectResolver.getProjectMetadata(state), options, request);
}

public String[] concreteIndexNames(ProjectMetadata project, IndicesOptions options, IndicesRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public Tuple<ClusterState, ClusterStateAckListener> executeTask(
ClusterState.builder(clusterState)
.putProjectMetadata(
updateDataStreamOptions(
clusterState.projectState(modifyOptionsTask.projectId).metadata(),
clusterState.metadata().getProject(modifyOptionsTask.projectId),
modifyOptionsTask.getDataStreamNames(),
modifyOptionsTask.getOptions()
)
Expand Down Expand Up @@ -739,7 +739,7 @@ static class UpdateSettingsTask extends AckedBatchedClusterStateUpdateTask {
) {
super(ackTimeout, listener.safeMap(response -> {
if (response.isAcknowledged()) {
return clusterService.state().projectState(projectId).metadata().dataStreams().get(dataStreamName);
return clusterService.state().metadata().getProject(projectId).dataStreams().get(dataStreamName);
} else {
throw new ElasticsearchException("Updating settings not accepted for unknown reasons");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,12 @@ public void testRolloverClusterStateForDataStream() throws Exception {
);
long after = testThreadPool.absoluteTimeInMillis();
Settings rolledOverIndexSettings = rolloverResult.clusterState()
.projectState(projectId)
.metadata()
.getProject(projectId)
.index(rolloverResult.rolloverIndexName())
.getSettings();
Set<String> rolledOverIndexSettingNames = rolledOverIndexSettings.keySet();
for (String settingName : dataStream.getEffectiveSettings(clusterState.projectState(projectId).metadata()).keySet()) {
for (String settingName : dataStream.getEffectiveSettings(clusterState.metadata().getProject(projectId)).keySet()) {
assertTrue(rolledOverIndexSettingNames.contains(settingName));
}
String newIndexName = rolloverResult.rolloverIndexName();
Expand Down