You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2020/05/27 13:32:53 UTC

[GitHub] [bookkeeper] lamber-ken commented on a change in pull request #2348: [BUG] Fix redundant statistics

lamber-ken commented on a change in pull request #2348:
URL: https://github.com/apache/bookkeeper/pull/2348#discussion_r431133474



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/bookies/InfoCommand.java
##########
@@ -80,14 +82,27 @@ public boolean apply(ServerConfiguration conf, CliFlags cmdFlags) {
 
             System.out.println("Free disk space info:");
             long totalFree = 0, total = 0;
-            for (Map.Entry<BookieSocketAddress, BookieInfo> e : map.entrySet()) {
-                BookieInfo bInfo = e.getValue();
-                BookieSocketAddress bookieId = e.getKey();
-                System.out.println(CommandHelpers.getBookieSocketAddrStringRepresentation(bookieId)
-                    + ":\tFree: " + bInfo.getFreeDiskSpace() + getReadable(bInfo.getFreeDiskSpace())
-                    + "\tTotal: " + bInfo.getTotalDiskSpace() + getReadable(bInfo.getTotalDiskSpace()));
-                totalFree += bInfo.getFreeDiskSpace();
-                total += bInfo.getTotalDiskSpace();
+
+            Map<String, BookieInfoReader.BookieInfo> dedupedMap = map.entrySet()
+                    .stream()
+                    .map(e -> {
+                        BookieInfoReader.BookieInfo bInfo = e.getValue();
+                        BookieSocketAddress bookieId = e.getKey();
+                        System.out.println(CommandHelpers.getBookieSocketAddrStringRepresentation(bookieId)

Review comment:
       @eolivelli Got, done.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org