Skip to content

Commit 47ed531

Browse files
[7.16] System index deprecation warning is not critical (#79633) (#80370)
* 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 22cdad7 commit 47ed531

File tree

4 files changed

+58
-21
lines changed

4 files changed

+58
-21
lines changed

server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private static void checkSystemIndexAccess(
183183
}
184184
});
185185
if (systemIndicesNames.isEmpty() == false) {
186-
deprecationLogger.critical(
186+
deprecationLogger.warn(
187187
DeprecationCategory.API,
188188
"open_system_index_access",
189189
"this request accesses system indices: {}, but in a future major version, direct access to system "

server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ private void checkSystemIndexAccess(Context context, Set<Index> concreteIndices,
427427

428428
if (resolvedSystemIndices.isEmpty() == false) {
429429
Collections.sort(resolvedSystemIndices);
430-
deprecationLogger.critical(
430+
deprecationLogger.warn(
431431
DeprecationCategory.API,
432432
"open_system_index_access",
433433
"this request accesses system indices: {}, but in a future major version, direct access to system "

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;
@@ -122,8 +123,12 @@ public void testDeprecationWarningEmittedForTotalWildcard() {
122123
assertThat(result.get(".b").size(), equalTo(1));
123124
assertThat(result.get("c").size(), equalTo(1));
124125
assertWarnings(
125-
"this request accesses system indices: [.b], but in a future major version, direct access to system "
126-
+ "indices will be prevented by default"
126+
true,
127+
new DeprecationWarning(
128+
Level.WARN,
129+
"this request accesses system indices: [.b], "
130+
+ "but in a future major version, direct access to system indices will be prevented by default"
131+
)
127132
);
128133
}
129134

@@ -149,8 +154,12 @@ public void testDeprecationWarningEmittedWhenSystemIndexIsRequested() {
149154
assertThat(result.size(), equalTo(1));
150155
assertThat(result.get(".b").size(), equalTo(1));
151156
assertWarnings(
152-
"this request accesses system indices: [.b], but in a future major version, direct access to system "
153-
+ "indices will be prevented by default"
157+
true,
158+
new DeprecationWarning(
159+
Level.WARN,
160+
"this request accesses system indices: [.b], "
161+
+ "but in a future major version, direct access to system indices will be prevented by default"
162+
)
154163
);
155164
}
156165

@@ -175,8 +184,12 @@ public void testDeprecationWarningEmittedWhenSystemIndexIsRequestedByAlias() {
175184
assertThat(result.size(), equalTo(1));
176185
assertThat(result.get(".b").size(), equalTo(1));
177186
assertWarnings(
178-
"this request accesses system indices: [.b], but in a future major version, direct access to system "
179-
+ "indices will be prevented by default"
187+
true,
188+
new DeprecationWarning(
189+
Level.WARN,
190+
"this request accesses system indices: [.b], "
191+
+ "but in a future major version, direct access to system indices will be prevented by default"
192+
)
180193
);
181194
}
182195

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;
@@ -2308,8 +2309,12 @@ public void testFullWildcardSystemIndexResolutionDeprecated() {
23082309
List<String> indexNames = resolveConcreteIndexNameList(state, request);
23092310
assertThat(indexNames, containsInAnyOrder("some-other-index", ".ml-stuff", ".ml-meta", ".watches"));
23102311
assertWarnings(
2311-
"this request accesses system indices: [.ml-meta, .ml-stuff, .watches], but in a future major version, "
2312-
+ "direct access to system indices will be prevented by default"
2312+
true,
2313+
new DeprecationWarning(
2314+
Level.WARN,
2315+
"this request accesses system indices: [.ml-meta, .ml-stuff, .watches], "
2316+
+ "but in a future major version, direct access to system indices will be prevented by default"
2317+
)
23132318
);
23142319

23152320
}
@@ -2322,10 +2327,13 @@ public void testSingleSystemIndexResolutionDeprecated() {
23222327
List<String> indexNames = resolveConcreteIndexNameList(state, request);
23232328
assertThat(indexNames, containsInAnyOrder(".ml-meta"));
23242329
assertWarnings(
2325-
"this request accesses system indices: [.ml-meta], but in a future major version, direct access "
2326-
+ "to system indices will be prevented by default"
2330+
true,
2331+
new DeprecationWarning(
2332+
Level.WARN,
2333+
"this request accesses system indices: [.ml-meta], "
2334+
+ "but in a future major version, direct access to system indices will be prevented by default"
2335+
)
23272336
);
2328-
23292337
}
23302338

23312339
public void testWildcardSystemIndexReslutionSingleMatchDeprecated() {
@@ -2336,8 +2344,12 @@ public void testWildcardSystemIndexReslutionSingleMatchDeprecated() {
23362344
List<String> indexNames = resolveConcreteIndexNameList(state, request);
23372345
assertThat(indexNames, containsInAnyOrder(".watches"));
23382346
assertWarnings(
2339-
"this request accesses system indices: [.watches], but in a future major version, direct access "
2340-
+ "to system indices will be prevented by default"
2347+
true,
2348+
new DeprecationWarning(
2349+
Level.WARN,
2350+
"this request accesses system indices: [.watches], "
2351+
+ "but in a future major version, direct access to system indices will be prevented by default"
2352+
)
23412353
);
23422354

23432355
}
@@ -2350,8 +2362,12 @@ public void testWildcardSystemIndexResolutionMultipleMatchesDeprecated() {
23502362
List<String> indexNames = resolveConcreteIndexNameList(state, request);
23512363
assertThat(indexNames, containsInAnyOrder(".ml-meta", ".ml-stuff"));
23522364
assertWarnings(
2353-
"this request accesses system indices: [.ml-meta, .ml-stuff], but in a future major version, direct access "
2354-
+ "to system indices will be prevented by default"
2365+
true,
2366+
new DeprecationWarning(
2367+
Level.WARN,
2368+
"this request accesses system indices: [.ml-meta, .ml-stuff], "
2369+
+ "but in a future major version, direct access to system indices will be prevented by default"
2370+
)
23552371
);
23562372

23572373
}
@@ -2405,8 +2421,12 @@ public void testExternalSystemIndexAccess() {
24052421
List<String> indexNames = resolveConcreteIndexNameList(state, request);
24062422
assertThat(indexNames, contains(".external-sys-idx"));
24072423
assertWarnings(
2408-
"this request accesses system indices: [.external-sys-idx], but in a future major version, direct access "
2409-
+ "to system indices will be prevented by default"
2424+
true,
2425+
new DeprecationWarning(
2426+
Level.WARN,
2427+
"this request accesses system indices: [.external-sys-idx], "
2428+
+ "but in a future major version, direct access to system indices will be prevented by default"
2429+
)
24102430
);
24112431
}
24122432
}
@@ -2418,8 +2438,12 @@ public void testExternalSystemIndexAccess() {
24182438
List<String> indexNames = resolveConcreteIndexNameList(state, request);
24192439
assertThat(indexNames, contains(".external-sys-idx"));
24202440
assertWarnings(
2421-
"this request accesses system indices: [.external-sys-idx], but in a future major version, direct access "
2422-
+ "to system indices will be prevented by default"
2441+
true,
2442+
new DeprecationWarning(
2443+
Level.WARN,
2444+
"this request accesses system indices: [.external-sys-idx], "
2445+
+ "but in a future major version, direct access to system indices will be prevented by default"
2446+
)
24232447
);
24242448
}
24252449
}

0 commit comments

Comments
 (0)