Skip to content

Commit 11c47c4

Browse files
Fix backing index pattern for system data streams to include a multiple migrated prefix (#125598)
There is a theoretical possibility of having an index backing a system data stream with a name starting with .migrated-migrated-. This currently results in an error when accessing the data stream. This commit fixes the issue.
1 parent b21ffe2 commit 11c47c4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

server/src/main/java/org/elasticsearch/indices/SystemDataStreamDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public String getBackingIndexPattern() {
163163
}
164164

165165
private static String backingIndexPatternForDataStream(String dataStream) {
166-
return ".(migrated-)?[fd]s-" + dataStream + "-*";
166+
return ".(migrated-){0,}[fd]s-" + dataStream + "-*";
167167
}
168168

169169
@Override

server/src/test/java/org/elasticsearch/indices/SystemIndicesTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ public void testSystemDataStreamPattern() {
320320
equalTo(true)
321321
);
322322
assertThat(systemIndices.isSystemIndexBackingDataStream(".migrated-ds-" + dataStreamName + "-2025.03.07-000001"), equalTo(true));
323+
assertThat(
324+
systemIndices.isSystemIndexBackingDataStream(".migrated-migrated-ds-" + dataStreamName + "-2025.03.07-000001"),
325+
equalTo(true)
326+
);
323327
assertThat(systemIndices.isSystemIndexBackingDataStream(".migrated-" + dataStreamName + "-2025.03.07-000001"), equalTo(false));
324328
assertThat(systemIndices.isSystemIndexBackingDataStream(dataStreamName), equalTo(false));
325329
assertThat(systemIndices.isSystemIndexBackingDataStream(dataStreamName + "-2025.03.07-000001"), equalTo(false));

0 commit comments

Comments
 (0)