Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ void getAllRetainableSnapshots(Collection<String> repositories,
// don't time out on this request to not produce failed SLM runs in case of a temporarily slow master node
.setMasterNodeTimeout(TimeValue.MAX_VALUE)
.setIgnoreUnavailable(true)
.setPolicies(policies.toArray(Strings.EMPTY_ARRAY))
.execute(ActionListener.wrap(resp -> {
if (logger.isTraceEnabled()) {
logger.trace("retrieved snapshots: {}",
Expand All @@ -252,10 +253,7 @@ void getAllRetainableSnapshots(Collection<String> repositories,
Map<String, List<SnapshotInfo>> snapshots = new HashMap<>();
for (SnapshotInfo info : resp.getSnapshots()) {
if (RETAINABLE_STATES.contains(info.state()) && info.userMetadata() != null) {
final Object policy = info.userMetadata().get(POLICY_ID_METADATA_FIELD);
if (policy instanceof String && policies.contains(policy)) {
snapshots.computeIfAbsent(info.repository(), repo -> new ArrayList<>()).add(info);
}
snapshots.computeIfAbsent(info.repository(), repo -> new ArrayList<>()).add(info);
}
}
listener.onResponse(snapshots);
Expand Down