rakeshadr commented on code in PR #10938:
URL: https://github.com/apache/ozone/pull/10938#discussion_r3841216010
##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerBalancerStatusSubcommand.java:
##########
@@ -256,9 +261,38 @@ private String
getPrettyIterationStatusInfo(ContainerBalancerTaskIterationStatus
"Already moved containers", containerMovesCompleted,
"Failed to move containers", containerMovesFailed,
"Failed to move containers by timeout", containerMovesTimeout,
+ failures,
"Entered data to nodes", enteringDataNodeList,
"Exited data from nodes", leavingDataNodeList);
}
+ private String formatFailures(List<ContainerMoveFailureDetailProto>
failures) {
+ if (failures.isEmpty()) {
Review Comment:
Case: Failures exist but breakdown is missing (containerMovesFailed > 0,
failures empty)
User now knows failures happened but the per-reason tracking didn't capture
them, actionable signal to check SCM logs.
```
if (containerMovesFailed > 0 && failures.isEmpty()) {
return String.format("%-50s %s%n", "Failed container moves", "(no
breakdown available)");
}
```
Output:
```
Failed to move containers 3
Failed to move containers by timeout 0
Failed container moves (no breakdown available)
```
##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerBalancerStatusSubcommand.java:
##########
@@ -256,9 +261,38 @@ private String
getPrettyIterationStatusInfo(ContainerBalancerTaskIterationStatus
"Already moved containers", containerMovesCompleted,
"Failed to move containers", containerMovesFailed,
"Failed to move containers by timeout", containerMovesTimeout,
+ failures,
"Entered data to nodes", enteringDataNodeList,
"Exited data from nodes", leavingDataNodeList);
}
+ private String formatFailures(List<ContainerMoveFailureDetailProto>
failures) {
+ if (failures.isEmpty()) {
+ return "";
+ }
+ List<ContainerMoveFailureDetailProto> sorted = failures.stream()
+
.sorted(Comparator.comparingLong(ContainerMoveFailureDetailProto::getCount).reversed()
+ .thenComparing(ContainerMoveFailureDetailProto::getReason))
+ .collect(Collectors.toList());
+ StringBuilder builder = new StringBuilder();
+ builder.append(String.format("%-50s %n", "Failed container moves"));
+ for (ContainerMoveFailureDetailProto failure : sorted) {
+ builder.append(String.format(" %-48s %d%n", failure.getReason(),
failure.getCount()));
+ if (!failure.getSourceFailureCountsList().isEmpty()) {
+ builder.append(String.format(" %-46s %n", "Source datanodes"));
+ for (NodeFailureCountProto src : failure.getSourceFailureCountsList())
{
+ builder.append(String.format(" %-44s %d%n",
src.getDatanodeUuid(), src.getCount()));
Review Comment:
Can you append hostname as well.
```
String label = src.hasHostname()
? src.getHostname() + " (" + src.getDatanodeUuid() + ")"
: src.getDatanodeUuid();
builder.append(String.format(" %-44s %d%n", label, src.getCount()));
```
Output:
```
Failed container moves
REPLICATION_FAIL_TIME_OUT 2
Source datanodes
datanode1.example.com (b994d7e1-1394-4764-ac80-95ac89269baf) 1
datanode2.example.com (a7aa68a9-47c5-4c23-9a94-e8d0fb1fb3b1) 1
Target datanodes
datanode3.example.com (d90d5e66-767e-4e24-9250-21ce9de426a5) 1
datanode4.example.com (d6898173-c204-4363-b841-48a130976c13) 1
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]