HDDS-12653. CLI command to list containers based on Health State - #8415
Conversation
aryangupta1998
left a comment
There was a problem hiding this comment.
Thanks for the patch @sreejasahithi, do you feel we should include enum for container states in SQLDBConstants?
public enum ContainerState { OPEN, CLOSED, DELETED, UNHEALTHY, QUASI_CLOSED }
| @CommandLine.Option(names = {"--issue"}, | ||
| required = true, | ||
| description = "Health state of the container.") | ||
| private ReplicationManagerReport.HealthState healthState; |
There was a problem hiding this comment.
issue is an unusual name for "health state"
| @CommandLine.Mixin | ||
| private ListOptions listOptions; |
There was a problem hiding this comment.
ListOptions has --start and --prefix options that are not supported (used) by this command. #8413 splits ListOptions, providing another mixin for commands that only want to use --length/--all. It also changes ListContainers to use the new ListLimitOptions.
Depending on which PR gets merged first, the other one will need to be updated.
There was a problem hiding this comment.
okay , thanks for letting me know about this.
| name = "list-health", | ||
| description = "Lists containers based on health state like UNDER_REPLICATED, " + | ||
| "OVER_REPLICATED , UNHEALTHY, QUASI_CLOSED stuck." | ||
| ) | ||
| public class ListContainersByHealth extends AbstractSubcommand implements Callable<Void> { |
There was a problem hiding this comment.
I think the existing ListContainers class should be updated to support filtering by HealthState, too, instead of introducing a new command.
ozone debug log container --db=<path> list --lifecycle ...
ozone debug log container --db=<path> list --health ...| Path dbPath = parent.resolveDbPath(); | ||
| if (dbPath == null) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
This is duplicated in subcommands. ContainerLogController should throw IllegalArgumentException if it cannot resolve DB path from any sources (option or property).
|
|
||
| while (rs.next()) { | ||
| if (limitProvided && count >= limit) { | ||
| out.println("Note: There might be more containers. Use -all option to list all entries."); |
There was a problem hiding this comment.
There is no -all option, it's --all. Also, information like this should be printed to stderr.
There was a problem hiding this comment.
This message just tells the user that there might be more containers so if they want to check they can use --all option. Hence it is not exactly and error.
There was a problem hiding this comment.
The reason for using stderr is to avoid mixing actual content and informational messages. This is especially important when using JSON or other machine-readable output format.
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @sreejasahithi for updating the patch, LGTM.
aryangupta1998
left a comment
There was a problem hiding this comment.
Thanks for the patch @sreejasahithi, LGTM!
|
Thanks @sreejasahithi for the patch, @aryangupta1998 for the review. |
|
@adoroszlai CI on master is broken. This patch seems to be the root cause. Should we revert this patch? |
|
@swamirishi no, this is not the root cause, it's just a coincidence. The same failures are observed even on feature branch HDDS-10685, which does not have this commit. https://github.com/apache/ozone/actions/runs/14978935639 |
What changes were proposed in this pull request?
This ozone debug CLI command lists all the containers which are either UNDER-REPLICATED , OVER-REPLICATED , UNHEALTHY or QUASI_CLOSED stuck.
the command provides the Container ID and count of replicas.
The command options used are:
List containers by health type:
ozone debug log container --db=<path to db> list --health=<type>List containers by health type with a specified row limit:
ozone debug log container --db=<path to db> list --health=<type> --length=<limit>List all containers by health type, overriding the row limit:
ozone debug log container --db=<path to db> list --health=<type> --allSample output for UNHEALTHY :
Sample output for UNDER-REPLICATED:
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-12653
How was this patch tested?
Below is the workflow link that passed successfully:
https://github.com/sreejasahithi/ozone/actions/runs/14909363332