You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/11/09 12:11:32 UTC
[GitHub] [ozone] siddhantsangwan opened a new pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
siddhantsangwan opened a new pull request #2816:
URL: https://github.com/apache/ozone/pull/2816
## What changes were proposed in this pull request?
Improved readability of `usageinfo` by showing sizes in appropriate units. Also added the `Total Used` field. Here's a description of the output:
- `Capacity`: Total capacity of the datanode, read from the SCM.
- `Ozone Used`: Space used by Ozone, read from the SCM.
- `Remaining`: Total remaining space, read from the SCM.
- `Total Used`: `Capacity` - `Remaining`, or the total used space.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-5870
## How was this patch tested?
Manual testing using docker-compose.
<img width="806" alt="usageinfo" src="https://user-images.githubusercontent.com/34305492/140921938-a156a901-5445-46f6-81c1-d15635426edb.png">
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] siddhantsangwan commented on a change in pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
siddhantsangwan commented on a change in pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#discussion_r751071486
##########
File path: hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java
##########
@@ -96,19 +97,37 @@ public void execute(ScmClient scmClient) throws IOException {
* @param info Information such as Capacity, SCMUsed etc.
*/
public void printInfo(HddsProtos.DatanodeUsageInfoProto info) {
- double capacity = (double) info.getCapacity();
- double usedRatio = info.getUsed() / capacity;
- double remainingRatio = info.getRemaining() / capacity;
+ long capacity = info.getCapacity();
+ long used = info.getUsed(), remaining = info.getRemaining();
+ long totalUsed = capacity - remaining;
+ double usedRatio = used / (double) capacity;
+ double remainingRatio = remaining / (double) capacity;
NumberFormat percentFormat = NumberFormat.getPercentInstance();
- percentFormat.setMinimumFractionDigits(5);
+ percentFormat.setMinimumFractionDigits(2);
+ percentFormat.setMaximumFractionDigits(2);
System.out.printf("Usage info for datanode with UUID %s:%n",
info.getNode().getUuid());
- System.out.printf("%-10s: %20sB %n", "Capacity", info.getCapacity());
- System.out.printf("%-10s: %20sB (%s) %n", "SCMUsed", info.getUsed(),
+ // print capacity in a readable format
+ System.out.printf("%-13s: %-21s (%s) %n", "Capacity", capacity + " B",
Review comment:
Sure. I'm only doing that to keep the information inside the brackets in one single column.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] siddhantsangwan commented on a change in pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
siddhantsangwan commented on a change in pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#discussion_r750965850
##########
File path: hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java
##########
@@ -96,19 +97,37 @@ public void execute(ScmClient scmClient) throws IOException {
* @param info Information such as Capacity, SCMUsed etc.
*/
public void printInfo(HddsProtos.DatanodeUsageInfoProto info) {
- double capacity = (double) info.getCapacity();
- double usedRatio = info.getUsed() / capacity;
- double remainingRatio = info.getRemaining() / capacity;
+ long capacity = info.getCapacity();
+ long used = info.getUsed(), remaining = info.getRemaining();
+ long totalUsed = capacity - remaining;
+ double usedRatio = used / (double) capacity;
+ double remainingRatio = remaining / (double) capacity;
NumberFormat percentFormat = NumberFormat.getPercentInstance();
- percentFormat.setMinimumFractionDigits(5);
+ percentFormat.setMinimumFractionDigits(2);
+ percentFormat.setMaximumFractionDigits(2);
System.out.printf("Usage info for datanode with UUID %s:%n",
info.getNode().getUuid());
- System.out.printf("%-10s: %20sB %n", "Capacity", info.getCapacity());
- System.out.printf("%-10s: %20sB (%s) %n", "SCMUsed", info.getUsed(),
+ // print capacity in a readable format
+ System.out.printf("%-13s: %-21s (%s) %n", "Capacity", capacity + " B",
Review comment:
Thanks for reviewing. Had a discussion with @mukul1987 regarding this in which we had decided to use both the units(like `hdfs dfsadmin -report`).
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] lokeshj1703 commented on pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#issuecomment-972721150
@siddhantsangwan Thanks for the contribution! @JacksonYao287 Thanks for the review! I have committed the PR to master branch.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] lokeshj1703 commented on a change in pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on a change in pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#discussion_r750965048
##########
File path: hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java
##########
@@ -96,19 +97,37 @@ public void execute(ScmClient scmClient) throws IOException {
* @param info Information such as Capacity, SCMUsed etc.
*/
public void printInfo(HddsProtos.DatanodeUsageInfoProto info) {
- double capacity = (double) info.getCapacity();
- double usedRatio = info.getUsed() / capacity;
- double remainingRatio = info.getRemaining() / capacity;
+ long capacity = info.getCapacity();
+ long used = info.getUsed(), remaining = info.getRemaining();
+ long totalUsed = capacity - remaining;
+ double usedRatio = used / (double) capacity;
+ double remainingRatio = remaining / (double) capacity;
NumberFormat percentFormat = NumberFormat.getPercentInstance();
- percentFormat.setMinimumFractionDigits(5);
+ percentFormat.setMinimumFractionDigits(2);
+ percentFormat.setMaximumFractionDigits(2);
System.out.printf("Usage info for datanode with UUID %s:%n",
Review comment:
Let's also see if it is better to print hostname and ip of the datanode.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] lokeshj1703 commented on a change in pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on a change in pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#discussion_r750962575
##########
File path: hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java
##########
@@ -96,19 +97,37 @@ public void execute(ScmClient scmClient) throws IOException {
* @param info Information such as Capacity, SCMUsed etc.
*/
public void printInfo(HddsProtos.DatanodeUsageInfoProto info) {
- double capacity = (double) info.getCapacity();
- double usedRatio = info.getUsed() / capacity;
- double remainingRatio = info.getRemaining() / capacity;
+ long capacity = info.getCapacity();
+ long used = info.getUsed(), remaining = info.getRemaining();
+ long totalUsed = capacity - remaining;
+ double usedRatio = used / (double) capacity;
+ double remainingRatio = remaining / (double) capacity;
NumberFormat percentFormat = NumberFormat.getPercentInstance();
- percentFormat.setMinimumFractionDigits(5);
+ percentFormat.setMinimumFractionDigits(2);
+ percentFormat.setMaximumFractionDigits(2);
System.out.printf("Usage info for datanode with UUID %s:%n",
info.getNode().getUuid());
- System.out.printf("%-10s: %20sB %n", "Capacity", info.getCapacity());
- System.out.printf("%-10s: %20sB (%s) %n", "SCMUsed", info.getUsed(),
+ // print capacity in a readable format
+ System.out.printf("%-13s: %-21s (%s) %n", "Capacity", capacity + " B",
Review comment:
Let's not print capacity and other data in bytes. Other unit is sufficient.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] lokeshj1703 commented on a change in pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on a change in pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#discussion_r750962575
##########
File path: hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java
##########
@@ -96,19 +97,37 @@ public void execute(ScmClient scmClient) throws IOException {
* @param info Information such as Capacity, SCMUsed etc.
*/
public void printInfo(HddsProtos.DatanodeUsageInfoProto info) {
- double capacity = (double) info.getCapacity();
- double usedRatio = info.getUsed() / capacity;
- double remainingRatio = info.getRemaining() / capacity;
+ long capacity = info.getCapacity();
+ long used = info.getUsed(), remaining = info.getRemaining();
+ long totalUsed = capacity - remaining;
+ double usedRatio = used / (double) capacity;
+ double remainingRatio = remaining / (double) capacity;
NumberFormat percentFormat = NumberFormat.getPercentInstance();
- percentFormat.setMinimumFractionDigits(5);
+ percentFormat.setMinimumFractionDigits(2);
+ percentFormat.setMaximumFractionDigits(2);
System.out.printf("Usage info for datanode with UUID %s:%n",
info.getNode().getUuid());
- System.out.printf("%-10s: %20sB %n", "Capacity", info.getCapacity());
- System.out.printf("%-10s: %20sB (%s) %n", "SCMUsed", info.getUsed(),
+ // print capacity in a readable format
+ System.out.printf("%-13s: %-21s (%s) %n", "Capacity", capacity + " B",
Review comment:
Let's not print capacity and other data in bytes. GB is sufficient.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] lokeshj1703 merged pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
lokeshj1703 merged pull request #2816:
URL: https://github.com/apache/ozone/pull/2816
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] lokeshj1703 commented on a change in pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on a change in pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#discussion_r750971059
##########
File path: hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java
##########
@@ -96,19 +97,37 @@ public void execute(ScmClient scmClient) throws IOException {
* @param info Information such as Capacity, SCMUsed etc.
*/
public void printInfo(HddsProtos.DatanodeUsageInfoProto info) {
- double capacity = (double) info.getCapacity();
- double usedRatio = info.getUsed() / capacity;
- double remainingRatio = info.getRemaining() / capacity;
+ long capacity = info.getCapacity();
+ long used = info.getUsed(), remaining = info.getRemaining();
+ long totalUsed = capacity - remaining;
+ double usedRatio = used / (double) capacity;
+ double remainingRatio = remaining / (double) capacity;
NumberFormat percentFormat = NumberFormat.getPercentInstance();
- percentFormat.setMinimumFractionDigits(5);
+ percentFormat.setMinimumFractionDigits(2);
+ percentFormat.setMaximumFractionDigits(2);
System.out.printf("Usage info for datanode with UUID %s:%n",
info.getNode().getUuid());
- System.out.printf("%-10s: %20sB %n", "Capacity", info.getCapacity());
- System.out.printf("%-10s: %20sB (%s) %n", "SCMUsed", info.getUsed(),
+ // print capacity in a readable format
+ System.out.printf("%-13s: %-21s (%s) %n", "Capacity", capacity + " B",
Review comment:
I see. Can we remove the space? I think removing -21 would make it more readable.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] siddhantsangwan commented on pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
siddhantsangwan commented on pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#issuecomment-966974357
@lokeshj1703 please take a look!
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] siddhantsangwan commented on pull request #2816: HDDS-5870. Make Datanode usageinfo command output more readable
Posted by GitBox <gi...@apache.org>.
siddhantsangwan commented on pull request #2816:
URL: https://github.com/apache/ozone/pull/2816#issuecomment-971808904
Updated look of the command:
<img width="790" alt="usage info" src="https://user-images.githubusercontent.com/34305492/142253190-22528cb2-7a54-41cf-a595-b8fd901dc1ed.png">
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org