Skip to content

Conversation

@szabolcsf
Copy link

  • Add new 'reroute' command to support manual shard allocation
  • Support for allocating replica shards (safe operation)
  • Support for allocating empty primary shards with data loss confirmation
  • Interactive confirmation dialog for dangerous primary shard operations
  • Additional options: --explain and --retry-failed
  • Proper ATD type definitions for reroute operations
  • JSON serialization and HTTP request handling
  • Comprehensive help documentation with examples

Usage:
es reroute -r :: # allocate replica es reroute -p :: # allocate empty primary

The command follows the same patterns as existing elasticsearch-cli commands and integrates seamlessly with the existing codebase.

- Add new 'reroute' command to support manual shard allocation
- Support for allocating replica shards (safe operation)
- Support for allocating empty primary shards with data loss confirmation
- Interactive confirmation dialog for dangerous primary shard operations
- Additional options: --explain and --retry-failed
- Proper ATD type definitions for reroute operations
- JSON serialization and HTTP request handling
- Comprehensive help documentation with examples
- Updated README.md with anonymized usage examples

Usage:
  es reroute <cluster> -r <index>:<shard>:<node>  # allocate replica
  es reroute <cluster> -p <index>:<shard>:<node>  # allocate empty primary

The command follows the same patterns as existing elasticsearch-cli
commands and integrates seamlessly with the existing codebase.
@szabolcsf szabolcsf force-pushed the add-shard-allocation-command branch from 7d87d9f to 0228195 Compare August 12, 2025 08:09
Comment on lines +2086 to +2087
`P "Use -r to allocate replica shards (safe operation).";
`P "Use -p to allocate empty primary shards (WARNING: causes data loss!).";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should not be needed as it just repeats the args' documentation.

Comment on lines +2049 to +2051
let parse_allocation spec =
match String.split_on_char ':' spec with
| [index; shard_str; node] ->
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this kind of options, need to create a converter using Arg.conv (I think there are also a few ready-made converters under Arg.Conv).

| _ -> None
in
let replica_actions =
List.filter_map (fun spec ->
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter_map and the only valid return is Some ...
LLM is drunk

move = None; cancel = None; } in
Lwt.return (Some cmd)
else
let%lwt () = Lwt_io.eprintl "Operation cancelled." in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should fail the whole operation. That is, all-or-nothing semantics.

Comment on lines +241 to +242
?move : move_shard option;
?cancel : cancel_shard option;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are in ATD but not available as commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants