jrwest commented on code in PR #3628:
URL: https://github.com/apache/cassandra/pull/3628#discussion_r1815722298
##########
src/java/org/apache/cassandra/tools/nodetool/stats/CompactionHistoryHolder.java:
##########
@@ -82,12 +85,17 @@ private HashMap<String, Object> getAllAsMap()
Instant instant = Instant.ofEpochMilli(this.compactedAt);
LocalDateTime ldt = LocalDateTime.ofInstant(instant,
ZoneId.systemDefault());
compaction.put("compacted_at", ldt.toString());
- compaction.put("bytes_in", this.bytesIn);
- compaction.put("bytes_out", this.bytesOut);
+ compaction.put("bytes_in", format(this.bytesIn, humanReadable));
+ compaction.put("bytes_out", format(this.bytesOut, humanReadable));
compaction.put("rows_merged", this.rowMerged);
compaction.put("compaction_properties", this.compactionProperties);
return compaction;
}
+
+ private String format(long bytes, boolean humanReadable)
Review Comment:
I agree it should be static and should be given we take `humanReadable` as
an argument. Not sure I love it in `FileUtils` unless we moved the logic into
`stringifyFileSize` (e.g. pass `humanReadable` to it)
##########
src/java/org/apache/cassandra/tools/nodetool/stats/CompactionHistoryHolder.java:
##########
@@ -82,12 +85,17 @@ private HashMap<String, Object> getAllAsMap()
Instant instant = Instant.ofEpochMilli(this.compactedAt);
LocalDateTime ldt = LocalDateTime.ofInstant(instant,
ZoneId.systemDefault());
compaction.put("compacted_at", ldt.toString());
- compaction.put("bytes_in", this.bytesIn);
- compaction.put("bytes_out", this.bytesOut);
+ compaction.put("bytes_in", format(this.bytesIn, humanReadable));
+ compaction.put("bytes_out", format(this.bytesOut, humanReadable));
compaction.put("rows_merged", this.rowMerged);
compaction.put("compaction_properties", this.compactionProperties);
return compaction;
}
+
+ private String format(long bytes, boolean humanReadable)
Review Comment:
I agree it should be static given we take `humanReadable` as an argument.
Not sure I love it in `FileUtils` unless we moved the logic into
`stringifyFileSize` (e.g. pass `humanReadable` to it)
--
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]