Skip to content

Commit ea82b9d

Browse files
authored
Document dataflow in TransportGetSnapshotsAction (#142777)
Adds an ASCII-art diagram showing how the snapshots are processed (filtered-out and enriched) as they flow through the execution of `TransportGetSnapshotsAction`.
1 parent b211b03 commit ea82b9d

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/TransportGetSnapshotsAction.java

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
import java.util.function.ToLongFunction;
7373

7474
/**
75-
* Transport Action for get snapshots operation
75+
* Transport action for get-snapshots API
7676
*/
7777
public class TransportGetSnapshotsAction extends TransportMasterNodeAction<GetSnapshotsRequest, GetSnapshotsResponse> {
7878

@@ -183,6 +183,73 @@ protected void masterOperation(
183183
* results.
184184
*/
185185
private class GetSnapshotsOperation {
186+
/*
187+
* Overall (conceptual) dataflow:
188+
*
189+
* All snapshots (in requested repositories)
190+
* |
191+
* +----------------------------------X ?from_sort_value (when ?sort = repo)
192+
* |
193+
* +--> In-progress snapshots
194+
* | |
195+
* | +------------------------X snapshotNamePredicate (requested names/wildcards)
196+
* | |
197+
* | +--> Synthesize SnapshotInfos for in-progress snapshots --------------------------+
198+
* | |
199+
* +--> Completed snapshots |
200+
* | |
201+
* +---------------------X Skipped as also in-progress |
202+
* +---------------------X snapshotNamePredicate (requested names/wildcards) |
203+
* +---------------------X ?from_sort_value (when ?sort = name) |
204+
* | |
205+
* +--> Look up SnapshotDetails |
206+
* | |
207+
* | Preflight filtering (may be incomplete) |
208+
* +---------------X ?from_sort_value (when ?sort = start/duration/indices) |
209+
* +---------------X ?state |
210+
* +---------------X ?slm_policy_filter |
211+
* | |
212+
* | |
213+
* | |
214+
* | We might be able to tell here if it'll pass real filtering |
215+
* | but be skipped due to ?after, so we could add it to total |
216+
* | and then skip loading its SnapshotInfo (TODO). |
217+
* | |
218+
* | We might be able to tell here if it'll pass real filtering |
219+
* | and ?after but there will be ≥offset+size earlier-sorting |
220+
* | snapshots so we could add it to total & remaining and skip |
221+
* | loading its SnapshotInfo (TODO). |
222+
* | |
223+
* | Harder: we might even be able to tell here if it'll pass |
224+
* | real filtering and ?after but there will be <offset |
225+
* | earlier-sorting snapshots so we could add it to total and |
226+
* | then skip loading its SnapshotInfo (TODO). |
227+
* | |
228+
* | |
229+
* | |
230+
* +--> Load SnapshotInfos for completed snapshots -------------------------+
231+
* |
232+
* SnapshotInfos (merged) <-------------------------------------------------------------------------+
233+
* |
234+
* | Real filtering (for when SnapshotDetails incomplete/insufficient)
235+
* +----------------------------------X ?from_sort_value
236+
* +----------------------------------X ?state
237+
* +----------------------------------X ?slm_policy_filter
238+
* |
239+
* +--> Counted in total
240+
* |
241+
* +----------------------------X Skipped due to ?after
242+
* |
243+
* +---> Not already returned - added to SnapshotInfoCollector
244+
* |
245+
* +----------------------X Skipped due to ?offset
246+
* +--------------------------------------------------------------------------------+
247+
* +----------------------X Omitted due to ?size (counted in remaining) |
248+
* |
249+
* |
250+
* RESULTS <-------------------------------------------+
251+
*/
252+
186253
private final CancellableTask cancellableTask;
187254

188255
private final ProjectId projectId;

0 commit comments

Comments
 (0)