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
5 changes: 5 additions & 0 deletions docs/changelog/124931.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 124931
summary: This PR fixes a bug whereby partial snapshots of system datastreams could be used to restore system features.
area: "Snapshot/Restore"
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,6 @@ public void testNoneFeatureStateOnCreation() {
assertThat(snapshottedIndices, allOf(hasItem(regularIndex), not(hasItem(SystemIndexTestPlugin.SYSTEM_INDEX_NAME))));
}

// TODO, Do we need to test this for Datastreams?
/**
* Ensures that if we can only capture a partial snapshot of a system index, then the feature state associated with that index is
* not included in the snapshot, because it would not be safe to restore that feature state.
Expand Down Expand Up @@ -1202,7 +1201,7 @@ public Collection<SystemDataStreamDescriptor> getSystemDataStreamDescriptors() {

@Override
public String getFeatureName() {
return SystemDataStreamTestPlugin.class.getSimpleName();
return SystemDataStreamManyShardsTestPlugin.class.getSimpleName();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4127,7 +4127,15 @@ private SnapshotsInProgress createSnapshot(

if (featureSystemIndices.size() > 0 || featureAssociatedIndices.size() > 0 || featureDataStreamBackingIndices.size() > 0) {

featureStates.add(new SnapshotFeatureInfo(featureName, List.copyOf(featureSystemIndices)));
featureStates.add(
new SnapshotFeatureInfo(
featureName,
List.copyOf(
Stream.concat(featureSystemIndices.stream(), featureDataStreamBackingIndices.stream())
.collect(Collectors.toSet())
)
)
);
indexNames.addAll(featureSystemIndices);
indexNames.addAll(featureAssociatedIndices);
indexNames.addAll(featureDataStreamBackingIndices);
Expand Down