Skip to content

Commit f1e8479

Browse files
[8.0] System index deprecation warning is not critical (#79633) (#80369)
* System index deprecation warning is not critical (#79633) When we planned to fully cut off access to system indices in 8.0, we needed our system index deprecation warning to be critical. Now that we are merely hiding system indices, avoiding system index access is no longer critical, and there is very little that users can do to change their access patterns. Therefore, we should log the warning at WARN level, rather than at CRITICAL. * Restore production code changes
1 parent 082b7ca commit f1e8479

File tree

2 files changed

+56
-19
lines changed

2 files changed

+56
-19
lines changed

server/src/test/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesActionTests.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
package org.elasticsearch.action.admin.indices.alias.get;
99

10+
import org.apache.logging.log4j.Level;
1011
import org.elasticsearch.Version;
1112
import org.elasticsearch.cluster.ClusterState;
1213
import org.elasticsearch.cluster.metadata.AliasMetadata;
@@ -120,8 +121,12 @@ public void testDeprecationWarningEmittedForTotalWildcard() {
120121
assertThat(result.get(".b").size(), equalTo(1));
121122
assertThat(result.get("c").size(), equalTo(1));
122123
assertWarnings(
123-
"this request accesses system indices: [.b], but in a future major version, direct access to system "
124-
+ "indices will be prevented by default"
124+
true,
125+
new DeprecationWarning(
126+
Level.WARN,
127+
"this request accesses system indices: [.b], "
128+
+ "but in a future major version, direct access to system indices will be prevented by default"
129+
)
125130
);
126131
}
127132

@@ -147,8 +152,12 @@ public void testDeprecationWarningEmittedWhenSystemIndexIsRequested() {
147152
assertThat(result.size(), equalTo(1));
148153
assertThat(result.get(".b").size(), equalTo(1));
149154
assertWarnings(
150-
"this request accesses system indices: [.b], but in a future major version, direct access to system "
151-
+ "indices will be prevented by default"
155+
true,
156+
new DeprecationWarning(
157+
Level.WARN,
158+
"this request accesses system indices: [.b], "
159+
+ "but in a future major version, direct access to system indices will be prevented by default"
160+
)
152161
);
153162
}
154163

@@ -173,8 +182,12 @@ public void testDeprecationWarningEmittedWhenSystemIndexIsRequestedByAlias() {
173182
assertThat(result.size(), equalTo(1));
174183
assertThat(result.get(".b").size(), equalTo(1));
175184
assertWarnings(
176-
"this request accesses system indices: [.b], but in a future major version, direct access to system "
177-
+ "indices will be prevented by default"
185+
true,
186+
new DeprecationWarning(
187+
Level.WARN,
188+
"this request accesses system indices: [.b], "
189+
+ "but in a future major version, direct access to system indices will be prevented by default"
190+
)
178191
);
179192
}
180193

server/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package org.elasticsearch.cluster.metadata;
1010

11+
import org.apache.logging.log4j.Level;
1112
import org.elasticsearch.Version;
1213
import org.elasticsearch.action.DocWriteRequest;
1314
import org.elasticsearch.action.IndicesRequest;
@@ -2306,8 +2307,12 @@ public void testFullWildcardSystemIndexResolutionDeprecated() {
23062307
List<String> indexNames = resolveConcreteIndexNameList(state, request);
23072308
assertThat(indexNames, containsInAnyOrder("some-other-index", ".ml-stuff", ".ml-meta", ".watches"));
23082309
assertWarnings(
2309-
"this request accesses system indices: [.ml-meta, .ml-stuff, .watches], but in a future major version, "
2310-
+ "direct access to system indices will be prevented by default"
2310+
true,
2311+
new DeprecationWarning(
2312+
Level.WARN,
2313+
"this request accesses system indices: [.ml-meta, .ml-stuff, .watches], "
2314+
+ "but in a future major version, direct access to system indices will be prevented by default"
2315+
)
23112316
);
23122317

23132318
}
@@ -2320,10 +2325,13 @@ public void testSingleSystemIndexResolutionDeprecated() {
23202325
List<String> indexNames = resolveConcreteIndexNameList(state, request);
23212326
assertThat(indexNames, containsInAnyOrder(".ml-meta"));
23222327
assertWarnings(
2323-
"this request accesses system indices: [.ml-meta], but in a future major version, direct access "
2324-
+ "to system indices will be prevented by default"
2328+
true,
2329+
new DeprecationWarning(
2330+
Level.WARN,
2331+
"this request accesses system indices: [.ml-meta], "
2332+
+ "but in a future major version, direct access to system indices will be prevented by default"
2333+
)
23252334
);
2326-
23272335
}
23282336

23292337
public void testWildcardSystemIndexReslutionSingleMatchDeprecated() {
@@ -2334,8 +2342,12 @@ public void testWildcardSystemIndexReslutionSingleMatchDeprecated() {
23342342
List<String> indexNames = resolveConcreteIndexNameList(state, request);
23352343
assertThat(indexNames, containsInAnyOrder(".watches"));
23362344
assertWarnings(
2337-
"this request accesses system indices: [.watches], but in a future major version, direct access "
2338-
+ "to system indices will be prevented by default"
2345+
true,
2346+
new DeprecationWarning(
2347+
Level.WARN,
2348+
"this request accesses system indices: [.watches], "
2349+
+ "but in a future major version, direct access to system indices will be prevented by default"
2350+
)
23392351
);
23402352

23412353
}
@@ -2348,8 +2360,12 @@ public void testWildcardSystemIndexResolutionMultipleMatchesDeprecated() {
23482360
List<String> indexNames = resolveConcreteIndexNameList(state, request);
23492361
assertThat(indexNames, containsInAnyOrder(".ml-meta", ".ml-stuff"));
23502362
assertWarnings(
2351-
"this request accesses system indices: [.ml-meta, .ml-stuff], but in a future major version, direct access "
2352-
+ "to system indices will be prevented by default"
2363+
true,
2364+
new DeprecationWarning(
2365+
Level.WARN,
2366+
"this request accesses system indices: [.ml-meta, .ml-stuff], "
2367+
+ "but in a future major version, direct access to system indices will be prevented by default"
2368+
)
23532369
);
23542370

23552371
}
@@ -2396,8 +2412,12 @@ public void testExternalSystemIndexAccess() {
23962412
List<String> indexNames = resolveConcreteIndexNameList(state, request);
23972413
assertThat(indexNames, contains(".external-sys-idx"));
23982414
assertWarnings(
2399-
"this request accesses system indices: [.external-sys-idx], but in a future major version, direct access "
2400-
+ "to system indices will be prevented by default"
2415+
true,
2416+
new DeprecationWarning(
2417+
Level.WARN,
2418+
"this request accesses system indices: [.external-sys-idx], "
2419+
+ "but in a future major version, direct access to system indices will be prevented by default"
2420+
)
24012421
);
24022422
}
24032423
}
@@ -2409,8 +2429,12 @@ public void testExternalSystemIndexAccess() {
24092429
List<String> indexNames = resolveConcreteIndexNameList(state, request);
24102430
assertThat(indexNames, contains(".external-sys-idx"));
24112431
assertWarnings(
2412-
"this request accesses system indices: [.external-sys-idx], but in a future major version, direct access "
2413-
+ "to system indices will be prevented by default"
2432+
true,
2433+
new DeprecationWarning(
2434+
Level.WARN,
2435+
"this request accesses system indices: [.external-sys-idx], "
2436+
+ "but in a future major version, direct access to system indices will be prevented by default"
2437+
)
24142438
);
24152439
}
24162440
}

0 commit comments

Comments
 (0)