Skip to content

Commit

Permalink
Merge commit '920290a' into add_isolated_test_logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Brooks committed May 14, 2024
2 parents b42f014 + 920290a commit 968ede8
Show file tree
Hide file tree
Showing 74 changed files with 1,236 additions and 1,508 deletions.
2 changes: 2 additions & 0 deletions .buildkite/pipelines/periodic.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ steps:
- openjdk17
- openjdk21
- openjdk22
- openjdk23
GRADLE_TASK:
- checkPart1
- checkPart2
Expand All @@ -113,6 +114,7 @@ steps:
- openjdk17
- openjdk21
- openjdk22
- openjdk23
BWC_VERSION: $BWC_LIST
agents:
provider: gcp
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/pipelines/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ steps:
- openjdk17
- openjdk21
- openjdk22
- openjdk23
GRADLE_TASK:
- checkPart1
- checkPart2
Expand All @@ -760,6 +761,7 @@ steps:
- openjdk17
- openjdk21
- openjdk22
- openjdk23
BWC_VERSION: ["7.17.22", "8.13.5", "8.14.0", "8.15.0"]
agents:
provider: gcp
Expand Down
1 change: 1 addition & 0 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,7 @@ setups['setup-snapshots'] = setups['setup-repository'] + '''
name: "my_admin_role"
body: >
{
"description": "Grants full access to all management features within the cluster.",
"cluster": ["all"],
"indices": [
{"names": ["index1", "index2" ], "privileges": ["all"], "field_security" : {"grant" : [ "title", "body" ]}}
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog/107886.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 107886
summary: Cluster state role mapper file settings service
area: Authorization
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ stream's oldest backing index.
// TESTRESPONSE[s/"index_uuid": "_eEfRrFHS9OyhqWntkgHAQ"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
// TESTRESPONSE[s/"index_name": ".ds-my-data-stream-2099.03.07-000001"/"index_name": $body.data_streams.0.indices.0.index_name/]
// TESTRESPONSE[s/"index_name": ".ds-my-data-stream-2099.03.08-000002"/"index_name": $body.data_streams.0.indices.1.index_name/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_indices":[],"failure_store":false/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_store":{"enabled": false, "indices": [], "rollover_on_write": false}/]

<1> First item in the `indices` array for `my-data-stream`. This item contains
information about the stream's oldest backing index,
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/data-streams/downsampling-manual.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ This returns:
// TESTRESPONSE[s/"ltOJGmqgTVm4T-Buoe7Acg"/$body.data_streams.0.indices.0.index_uuid/]
// TESTRESPONSE[s/"2023-07-26T09:26:42.000Z"/$body.data_streams.0.time_series.temporal_ranges.0.start/]
// TESTRESPONSE[s/"2023-07-26T13:26:42.000Z"/$body.data_streams.0.time_series.temporal_ranges.0.end/]
// TESTRESPONSE[s/"replicated": false/"replicated": false,"failure_indices":[],"failure_store":false/]
// TESTRESPONSE[s/"replicated": false/"replicated": false,"failure_store":{"enabled": false, "indices": [], "rollover_on_write": false}/]
<1> The backing index for this data stream.

Before a backing index can be downsampled, the TSDS needs to be rolled over and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ and that the next generation index will also be managed by {ilm-init}:
// TESTRESPONSE[s/"index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"/"index_uuid": $body.data_streams.0.indices.0.index_uuid/]
// TESTRESPONSE[s/"index_name": ".ds-dsl-data-stream-2023.10.19-000002"/"index_name": $body.data_streams.0.indices.1.index_name/]
// TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_indices":[],"failure_store":false/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_store":{"enabled": false, "indices": [], "rollover_on_write": false}/]

<1> The name of the backing index.
<2> For each backing index we display the value of the <<index-lifecycle-prefer-ilm, prefer_ilm>>
Expand Down Expand Up @@ -284,7 +284,7 @@ GET _data_stream/dsl-data-stream
// TESTRESPONSE[s/"index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"/"index_uuid": $body.data_streams.0.indices.0.index_uuid/]
// TESTRESPONSE[s/"index_name": ".ds-dsl-data-stream-2023.10.19-000002"/"index_name": $body.data_streams.0.indices.1.index_name/]
// TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_indices":[],"failure_store":false/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_store":{"enabled": false, "indices": [], "rollover_on_write": false}/]

<1> The existing backing index will continue to be managed by {ilm-init}
<2> The existing backing index will continue to be managed by {ilm-init}
Expand Down Expand Up @@ -364,7 +364,7 @@ GET _data_stream/dsl-data-stream
// TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
// TESTRESPONSE[s/"index_name": ".ds-dsl-data-stream-2023.10.19-000003"/"index_name": $body.data_streams.0.indices.2.index_name/]
// TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8abcd1"/"index_uuid": $body.data_streams.0.indices.2.index_uuid/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_indices":[],"failure_store":false/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_store":{"enabled": false, "indices": [], "rollover_on_write": false}/]

<1> The backing indices that existed before rollover will continue to be managed by {ilm-init}
<2> The backing indices that existed before rollover will continue to be managed by {ilm-init}
Expand Down Expand Up @@ -462,7 +462,7 @@ GET _data_stream/dsl-data-stream
// TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
// TESTRESPONSE[s/"index_name": ".ds-dsl-data-stream-2023.10.19-000003"/"index_name": $body.data_streams.0.indices.2.index_name/]
// TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8abcd1"/"index_uuid": $body.data_streams.0.indices.2.index_uuid/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_indices":[],"failure_store":false/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW","failure_store":{"enabled": false, "indices": [], "rollover_on_write": false}/]
<1> The write index is now managed by {ilm-init}
<2> The `lifecycle` configured on the data stream is now disabled.
<3> The next write index will be managed by {ilm-init}
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/indices/get-data-stream.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,4 @@ The API returns the following response:
// TESTRESPONSE[s/"index_name": ".ds-my-data-stream-two-2099.03.08-000001"/"index_name": $body.data_streams.1.indices.0.index_name/]
// TESTRESPONSE[s/"index_uuid": "3liBu2SYS5axasRt6fUIpA"/"index_uuid": $body.data_streams.1.indices.0.index_uuid/]
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW"/]
// TESTRESPONSE[s/"replicated": false/"replicated": false,"failure_indices":[],"failure_store":false/]
// TESTRESPONSE[s/"replicated": false/"replicated": false,"failure_store":{"enabled": false, "indices": [], "rollover_on_write": false}/]
4 changes: 4 additions & 0 deletions docs/reference/rest-api/security/create-roles.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ privilege or action.
`cluster`:: (list) A list of cluster privileges. These privileges define the
cluster level actions that users with this role are able to execute.

`description`:: (string) A description of the role.
The maximum length is `1000` chars.

`global`:: (object) An object defining global privileges. A global privilege is
a form of cluster privilege that is request-aware. Support for global privileges
is currently limited to the management of application privileges.
Expand Down Expand Up @@ -104,6 +107,7 @@ The following example adds a role called `my_admin_role`:
--------------------------------------------------
POST /_security/role/my_admin_role
{
"description": "Grants full access to all management features within the cluster.",
"cluster": ["all"],
"indices": [
{
Expand Down
1 change: 1 addition & 0 deletions docs/reference/rest-api/security/get-roles.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ GET /_security/role/my_admin_role
--------------------------------------------------
{
"my_admin_role": {
"description": "Grants full access to all management features within the cluster.",
"cluster" : [ "all" ],
"indices" : [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,14 @@ public void testRemoveGhostReference() throws Exception {
public ClusterState execute(ClusterState currentState) throws Exception {
DataStream original = currentState.getMetadata().dataStreams().get(dataStreamName);
DataStream broken = original.copy()
.setIndices(List.of(new Index(original.getIndices().get(0).getName(), "broken"), original.getIndices().get(1)))
.setBackingIndices(
original.getBackingIndices()
.copy()
.setIndices(
List.of(new Index(original.getIndices().get(0).getName(), "broken"), original.getIndices().get(1))
)
.build()
)
.build();
brokenDataStreamHolder.set(broken);
return ClusterState.builder(currentState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void setup() throws IOException {
assertThat(dataStreams.size(), is(1));
Map<String, Object> dataStream = (Map<String, Object>) dataStreams.get(0);
assertThat(dataStream.get("name"), equalTo(DATA_STREAM_NAME));
List<String> backingIndices = getBackingIndices(dataStream);
List<String> backingIndices = getIndices(dataStream);
assertThat(backingIndices.size(), is(1));
List<String> failureStore = getFailureStore(dataStream);
assertThat(failureStore.size(), is(1));
Expand Down Expand Up @@ -199,18 +199,16 @@ public void testPutIndexMappingApi() throws IOException {
}
}

private List<String> getBackingIndices(Map<String, Object> response) {
return getIndices(response, "indices");
}

@SuppressWarnings("unchecked")
private List<String> getFailureStore(Map<String, Object> response) {
return getIndices(response, "failure_indices");
var failureStore = (Map<String, Object>) response.get("failure_store");
return getIndices(failureStore);

}

@SuppressWarnings("unchecked")
private List<String> getIndices(Map<String, Object> response, String fieldName) {
List<Map<String, String>> indices = (List<Map<String, String>>) response.get(fieldName);
private List<String> getIndices(Map<String, Object> response) {
List<Map<String, String>> indices = (List<Map<String, String>>) response.get("indices");
return indices.stream().map(index -> index.get("index_name")).toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Set<NodeFeature> getFeatures() {
DataStreamLifecycleHealthInfoPublisher.DSL_HEALTH_INFO_FEATURE, // Added in 8.12
LazyRolloverAction.DATA_STREAM_LAZY_ROLLOVER, // Added in 8.13
DataStreamAutoShardingService.DATA_STREAM_AUTO_SHARDING_FEATURE,
DataStreamGlobalRetention.GLOBAL_RETENTION // Added in 8.14
DataStreamGlobalRetention.GLOBAL_RETENTION // Added in 8.14
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static ClusterState removeDataStream(
DataStream dataStream = currentState.metadata().dataStreams().get(dataStreamName);
assert dataStream != null;
backingIndicesToRemove.addAll(dataStream.getIndices());
backingIndicesToRemove.addAll(dataStream.getFailureIndices());
backingIndicesToRemove.addAll(dataStream.getFailureIndices().getIndices());
}

// first delete the data streams and then the indices:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ static GetDataStreamAction.Response innerOperation(
Map<Index, IndexProperties> backingIndicesSettingsValues = new HashMap<>();
Metadata metadata = state.getMetadata();
collectIndexSettingsValues(dataStream, backingIndicesSettingsValues, metadata, dataStream.getIndices());
if (DataStream.isFailureStoreFeatureFlagEnabled() && dataStream.getFailureIndices().isEmpty() == false) {
collectIndexSettingsValues(dataStream, backingIndicesSettingsValues, metadata, dataStream.getFailureIndices());
if (DataStream.isFailureStoreFeatureFlagEnabled() && dataStream.getFailureIndices().getIndices().isEmpty() == false) {
collectIndexSettingsValues(dataStream, backingIndicesSettingsValues, metadata, dataStream.getFailureIndices().getIndices());
}

GetDataStreamAction.Response.TimeSeries timeSeries = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ public void testUpdateTimeSeriesTemporalRange_NoUpdateBecauseReplicated() {
List.of(new Tuple<>(start.minus(4, ChronoUnit.HOURS), start), new Tuple<>(start, end))
).getMetadata();
DataStream d = metadata.dataStreams().get(dataStreamName);
metadata = Metadata.builder(metadata).put(d.copy().setReplicated(true).setRolloverOnWrite(false).build()).build();
metadata = Metadata.builder(metadata)
.put(d.copy().setReplicated(true).setBackingIndices(d.getBackingIndices().copy().setRolloverOnWrite(false).build()).build())
.build();

now = now.plus(1, ChronoUnit.HOURS);
ClusterState in = ClusterState.builder(ClusterState.EMPTY_STATE).metadata(metadata).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testResponseIlmAndDataStreamLifecycleRepresentation() throws Excepti
.setIndexMode(IndexMode.STANDARD)
.setLifecycle(new DataStreamLifecycle())
.setFailureStoreEnabled(true)
.setFailureIndices(failureStores)
.setFailureIndices(DataStream.DataStreamIndices.failureIndicesBuilder(failureStores).build())
.build();

String ilmPolicyName = "rollover-30days";
Expand Down Expand Up @@ -159,9 +159,8 @@ public void testResponseIlmAndDataStreamLifecycleRepresentation() throws Excepti
);

if (DataStream.isFailureStoreFeatureFlagEnabled()) {
List<Object> failureStoresRepresentation = (List<Object>) dataStreamMap.get(
DataStream.FAILURE_INDICES_FIELD.getPreferredName()
);
var failureStore = (Map<String, Object>) dataStreamMap.get(DataStream.FAILURE_STORE_FIELD.getPreferredName());
List<Object> failureStoresRepresentation = (List<Object>) failureStore.get(DataStream.INDICES_FIELD.getPreferredName());
Map<String, Object> failureStoreRepresentation = (Map<String, Object>) failureStoresRepresentation.get(0);
assertThat(failureStoreRepresentation.get("index_name"), is(failureStoreIndex.getName()));
assertThat(failureStoreRepresentation.get(Response.DataStreamInfo.PREFER_ILM.getPreferredName()), is(false));
Expand All @@ -185,7 +184,7 @@ public void testResponseIlmAndDataStreamLifecycleRepresentation() throws Excepti
.setIndexMode(IndexMode.STANDARD)
.setLifecycle(new DataStreamLifecycle(null, null, false))
.setFailureStoreEnabled(true)
.setFailureIndices(failureStores)
.setFailureIndices(DataStream.DataStreamIndices.failureIndicesBuilder(failureStores).build())
.build();

String ilmPolicyName = "rollover-30days";
Expand Down Expand Up @@ -251,9 +250,8 @@ public void testResponseIlmAndDataStreamLifecycleRepresentation() throws Excepti
);

if (DataStream.isFailureStoreFeatureFlagEnabled()) {
List<Object> failureStoresRepresentation = (List<Object>) dataStreamMap.get(
DataStream.FAILURE_INDICES_FIELD.getPreferredName()
);
var failureStore = (Map<String, Object>) dataStreamMap.get(DataStream.FAILURE_STORE_FIELD.getPreferredName());
List<Object> failureStoresRepresentation = (List<Object>) failureStore.get(DataStream.INDICES_FIELD.getPreferredName());
Map<String, Object> failureStoreRepresentation = (Map<String, Object>) failureStoresRepresentation.get(0);
assertThat(failureStoreRepresentation.get("index_name"), is(failureStoreIndex.getName()));
assertThat(failureStoreRepresentation.get(Response.DataStreamInfo.PREFER_ILM.getPreferredName()), is(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private static DataStream newDataStreamInstance(
.setReplicated(replicated)
.setLifecycle(lifecycle)
.setFailureStoreEnabled(failureStores.isEmpty() == false)
.setFailureIndices(failureStores);
.setFailureIndices(DataStream.DataStreamIndices.failureIndicesBuilder(failureStores).build());
if (randomBoolean()) {
builder.setSystem(true);
builder.setHidden(true);
Expand Down
Loading

0 comments on commit 968ede8

Please sign in to comment.