-
Notifications
You must be signed in to change notification settings - Fork 4
Add reroute command for shard allocation #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- 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.
7d87d9f to
0228195
Compare
| `P "Use -r to allocate replica shards (safe operation)."; | ||
| `P "Use -p to allocate empty primary shards (WARNING: causes data loss!)."; |
There was a problem hiding this comment.
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.
| let parse_allocation spec = | ||
| match String.split_on_char ':' spec with | ||
| | [index; shard_str; node] -> |
There was a problem hiding this comment.
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 -> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
| ?move : move_shard option; | ||
| ?cancel : cancel_shard option; |
There was a problem hiding this comment.
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.
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.