Skip to content

Runbook: Stuck Migration

This runbook is for migrations that appear not to progress for longer than expected. Expected timing depends on index size, shard count, write rate, target health, and cluster load.

First Checks

bash
curl -s 'http://localhost:9200/_plugins/_aosc/my-index-v1/_status' | jq '{phase, error_message}'
curl -s 'http://localhost:9200/_cluster/health' | jq '.'
curl -s 'http://localhost:9200/_cat/shards?v'
curl -s 'http://localhost:9200/_cat/plugins?v'

Then inspect shard phases:

bash
curl -s 'http://localhost:9200/_plugins/_aosc/my-index-v1/_status'   | jq '.shards | to_entries[] | {shard: .key, phase: .value.phase, error: .value.error}'

Decision Tree

graph TD
    A[Migration stuck] --> B{Coordinator phase}
    B -->|ACTIVE| C[Find shards not CONVERGED]
    B -->|PREPARING_TARGET| D[Check target allocation]
    B -->|CUTTING_OVER| E[Check source write block and flush]
    B -->|CATCHING_UP| F[Check final replay gap]
    B -->|COMPLETING| G[Check alias, validation, cleanup]
    B -->|FAILING| H[Read error and cleanup state]

Common Causes

SymptomChecksPossible action
Shards remain PENDINGaosc.backfill.max_concurrent_per_node, other active workersWait, increase permit limit, or set it back above 0.
Stuck in ACQUIRING_LEASESource primary health, retention lease errors in data-node logsFix source shard health or retry after cluster stabilizes.
Stuck in BACKFILLINGTarget indexing pressure, bulk rejections, heap, disk, batch sizeReduce backfill concurrency or batch size.
Stuck in CONVERGINGcurrent_gap, rounds, source write rate, global checkpoint movementReduce write pressure, tune replay/backfill, or adjust convergence settings after review.
Stuck in PREPARING_TARGETTarget shard allocation and healthFix target allocation, disk, or replica settings.
Stuck in CATCHING_UPSource write block state, final replay errorsCheck logs for replay failures and target write pressure.
Stuck in COMPLETINGAlias state, doc count validation, source write block policyInspect coordinator logs and alias state. On success, AOSC leaves the old source index write-blocked unless remove_source_write_block_on_success or aosc.defaults.remove_source_write_block_on_success is true.
Many AOSC retention leases remain after failure_nodes/stats retention leases, active migrationsUse _admin/_cleanup_leases only after confirming no active migration needs them.

Tuning Examples

Slow new backfill work:

bash
curl -X PUT 'http://localhost:9200/_cluster/settings' \
  -H 'Content-Type: application/json' \
  -d '{"transient":{"aosc.backfill.max_concurrent_per_node":2}}'

Reduce fixed backfill batch size:

bash
curl -X PUT 'http://localhost:9200/_cluster/settings' \
  -H 'Content-Type: application/json' \
  -d '{"transient":{"aosc.backfill.controller.batch.size":1000}}'

Increase convergence rounds for future or active option resolution where applicable:

bash
curl -X PUT 'http://localhost:9200/_cluster/settings' \
  -H 'Content-Type: application/json' \
  -d '{"transient":{"aosc.defaults.max_convergence_rounds":2000}}'

Cleanup APIs

Preview lease cleanup:

bash
curl -X POST 'http://localhost:9200/_plugins/_aosc/_admin/_cleanup_leases'

Remove AOSC-owned leases after confirming they are orphaned:

bash
curl -X POST 'http://localhost:9200/_plugins/_aosc/_admin/_cleanup_leases?dry_run=false'

Preview cluster-state cleanup:

bash
curl -X POST 'http://localhost:9200/_plugins/_aosc/_admin/_clear_state'

Clear cluster state only after normal cancellation/failure cleanup cannot resolve the state:

bash
curl -X POST 'http://localhost:9200/_plugins/_aosc/_admin/_clear_state?dry_run=false'

Escalate or Stop

Cancel or pause investigation before making destructive changes if:

  • Multiple shards are failing with different errors.
  • The source write block is present and the coordinator is not making progress.
  • Alias state does not match the expected source or target.
  • You cannot determine whether retention leases are still needed by an active migration.

Released under the Apache 2.0 License.