Skip to content

Instantly share code, notes, and snippets.

@stefnestor
Last active November 2, 2024 17:29
Show Gist options
  • Save stefnestor/9dc1b28fa86ccc6a9a54c3f4041a0cb6 to your computer and use it in GitHub Desktop.
Save stefnestor/9dc1b28fa86ccc6a9a54c3f4041a0cb6 to your computer and use it in GitHub Desktop.

Phases+Actions

ILM phases+actions proceed sequentially. This implies if ILM gets stuck on a preceeding step it will never finish its sequence. A tabular format of the linked doc

actions\phase hot warm cold frozen delete
set-priority TRUE TRUE TRUE f f
unfollow TRUE TRUE TRUE TRUE f
rollover TRUE f f f f
read-only TRUE TRUE TRUE f f
(searchable snapshot) f f TRUE f f
allocate f TRUE TRUE f f
migrate f TRUE TRUE f f
shrink TRUE TRUE f f f
force-merge TRUE TRUE f f f
freeze f f TRUE f f
searchable snapshots TRUE f TRUE TRUE f
wait for snapshot f f f f TRUE
delete f f f f TRUE

Kindly note

  • Searchable Snapshot shows twice because it sequentially orders differently uniquely for cold (and I don't know how to sohw that better).
  • A common misconception which this table highlights: indices enter their target phase before performing the migrate action which means ILM is functioning as expected when shards are still on hot but index is in cold/unfollow.
  • There are some backpressure sub-action settings, e.g. cold/searchable_snapshot may flag force_merge_index which performs that as if it had been flagged under hot/force_merge. This means the intended sequence would be on hot > force merge on hot > take searchable snapshot > allocate searchable snapshot onto cold. Note the index went into snapshot from hot and surfaced as searchable snapshot index on cold, but it did not go through the cold/migrate process directly.

Steps

👻 THIS IS ADVANCED. This is purposely not documented in the official Elasticsearch Docs by the Dev team. Proceed at your own risk.

These generally the progressive steps/action that are taken, but they are not the guaranteed order. Steps may invoke any other step causing backtracking/jumping.

action/ordered_steps step
setPriority set_priority
unfollow branch-check-unfollow-prerequisites
... wait-for-indexing-complete
... wait-for-shard-tasks
... pause-follower-index
... close-follower-index
... unfollow-follower-index
... open-follower-index
... wait-for-index-color
rollover check-rollover-ready
... attempt-rollover
... wait-for-active-shards
... update-rollover-lifecycle-data
... set-indexing-complete
readonly check-not-write-index
... readonly
allocate allocate
... check-allocator
migrate branch-check-skip-action
... migrate
... check-migration
shrink check-not-write-index
... wait-for-shard-history-leases
... readonly
... cleanup-shrink-index
... generate-index-name
... set-single-node-allocation
... check-strink-allocation
... shrink
... shrunk-shards-allocated
... copy-execution-state
... isDataStreamBranchingStep
... aliases
... is-shrunken-index
... replace-datastream-backing-index
... delete
forceMerge check-not-write-index
... readonly
... if codecChange == CodecService.BEST_COMPRESSION_CODEC
- close-index
- update-settings
- open-index
... wait-for-index-color
... forcemerge
... segment-count
freeze check-not-write-index
... freeze
searchablesnapshots check-not-write-index
... wait-for-shard-history-leases
... if forceMergeIndex:
- forcemerge
- segment-count
... generate-snapshot-name
... cleanup-snapshot
... create-snapshot
... mount-snapshot
... wait-for-index-color
... copy-execution-state
... copy-settings
... isDataStreamBranchingStep
... replace-datastream-backing-index
... delete
... swap-aliases
waitForSnapshot wait-for-snapshot
delete wait-for-shard-history-leases
... delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment