Skip to content

Commit

Permalink
Updated repair % in ic-summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Zemek committed Aug 10, 2018
1 parent d72ee89 commit 4ff7774
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ the largest column families and how much data has been repaired by incremental r
| SSTables | Number of sstables on this node for the column family |
| Disk Size | Compressed size on disk for this node |
| Data Size | Uncompressed size of the data for this node |
| Last Repaired | Time of the last incremental repair |
| Repair % | Percentage of data marked as repaired by incremental repair |
| Last Repaired | Maximum repair timestamp on sstables |
| Repair % | Percentage of data marked as repaired |

## ic-sstables ##
Print out sstable metadata for a column family. Useful in helping to tune compaction settings.
Expand Down
8 changes: 4 additions & 4 deletions src/com/instaclustr/sstabletools/SummaryCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public static void main(String[] args) {
long diskSize = 0;
long dataSize = 0;
long repairedAt = Long.MIN_VALUE;
boolean isRepaired = false;
long repaired = 0;
long repairedLength = 0;
for (SSTableMetadata metadata : metadataCollection) {
diskSize += metadata.diskLength;
dataSize += metadata.uncompressedLength;
if (metadata.isRepaired) {
isRepaired = true;
repaired++;
repairedAt = Math.max(repairedAt, metadata.repairedAt);
repairedLength += metadata.uncompressedLength;
}
Expand All @@ -71,8 +71,8 @@ public static void main(String[] args) {
Integer.toString(metadataCollection.size()),
Util.humanReadableByteCount(diskSize),
Util.humanReadableByteCount(dataSize),
isRepaired ? Util.UTC_DATE_FORMAT.format(new Date(repairedAt)) : "",
isRepaired ? String.format("%d%%", Math.round((repairedLength / (double) dataSize) * 100)) : ""
repaired > 0 ? Util.UTC_DATE_FORMAT.format(new Date(repairedAt)) : "",
repaired > 0 ? String.format("%d/%d %d%%", repaired, metadataCollection.size(), (int) Math.floor((repairedLength / (double) dataSize) * 100)) : ""
);
}
}
Expand Down

0 comments on commit 4ff7774

Please sign in to comment.