aryangupta1998 commented on code in PR #8415:
URL: https://github.com/apache/ozone/pull/8415#discussion_r2081030562
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/logs/container/utils/ContainerDatanodeDatabase.java:
##########
@@ -609,5 +615,179 @@ private List<DatanodeContainerInfo>
getContainerLogDataForOpenContainers(Long co
return logEntries;
}
+
+ /**
+ * Lists container replicas with key details such as Container ID, Datanode
ID, State, BCSID for over-
+ * or under-replicated containers.
+ */
+
+ public void listReplicatedContainers(String overOrUnder, Integer limit)
throws SQLException {
+ String operator;
+ if ("OVER_REPLICATED".equalsIgnoreCase(overOrUnder)) {
+ operator = ">";
+ } else if ("UNDER_REPLICATED".equalsIgnoreCase(overOrUnder)) {
+ operator = "<";
+ } else {
+ out.println("Invalid type. Use OVER_REPLICATED or UNDER_REPLICATED.");
+ return;
+ }
+
+ String rawQuery = SQLDBConstants.SELECT_REPLICATED_CONTAINERS;
+
+ if (!rawQuery.contains("{operator}")) {
+ out.println("Query not defined correctly.");
+ return;
+ }
+
+ String finalQuery = rawQuery.replace("{operator}", operator);
+
+ boolean limitProvided = limit != Integer.MAX_VALUE;
Review Comment:
We can shift this check(limit != Integer.MAX_VALUE) in ListOptions.
--
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]