-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Make active compaction remaining time reported by nodetool compaction… #4551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,21 @@ public void execute(NodeProbe probe) | |
| TableBuilder tableBuilder = new TableBuilder(); | ||
| pendingTasksAndConcurrentCompactorsStats(probe, tableBuilder); | ||
| compactionsStats(probe, tableBuilder); | ||
| reportCompactionTable(probe.getCompactionManagerProxy().getCompactions(), probe.getCompactionThroughputBytes(), humanReadable, vtableOutput, out, tableBuilder); | ||
| Map<String, String> currentCompactionThroughputMetricsMap = probe.getCurrentCompactionThroughputMiBPerSec(); | ||
| String currentThroughput1MinStr = currentCompactionThroughputMetricsMap.get("1minute"); | ||
| Double currentCompactionThroughputMiBPerSec = null; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would do |
||
| try | ||
| { | ||
| if (currentThroughput1MinStr != null && !currentThroughput1MinStr.isEmpty()) | ||
| { | ||
| currentCompactionThroughputMiBPerSec = Double.parseDouble(currentThroughput1MinStr); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| } | ||
| catch (NumberFormatException e) | ||
| { | ||
| // If parsing fails, currentCompactionThroughputMiBPerSec remains null and we'll fall back to configured throughput | ||
| } | ||
| reportCompactionTable(probe.getCompactionManagerProxy().getCompactions(), probe.getCompactionThroughputBytes(), currentCompactionThroughputMiBPerSec, humanReadable, vtableOutput, out, tableBuilder); | ||
| } | ||
|
|
||
| private void pendingTasksAndConcurrentCompactorsStats(NodeProbe probe, TableBuilder tableBuilder) | ||
|
|
@@ -118,10 +132,15 @@ private void compactionsStats(NodeProbe probe, TableBuilder tableBuilder) | |
|
|
||
| public static void reportCompactionTable(List<Map<String,String>> compactions, long compactionThroughputInBytes, boolean humanReadable, PrintStream out, TableBuilder table) | ||
| { | ||
| reportCompactionTable(compactions, compactionThroughputInBytes, humanReadable, false, out, table); | ||
| reportCompactionTable(compactions, compactionThroughputInBytes, null, humanReadable, false, out, table); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -1 |
||
| } | ||
|
|
||
| public static void reportCompactionTable(List<Map<String,String>> compactions, long compactionThroughputInBytes, boolean humanReadable, boolean vtableOutput, PrintStream out, TableBuilder table) | ||
| { | ||
| reportCompactionTable(compactions, compactionThroughputInBytes, null, humanReadable, vtableOutput, out, table); | ||
| } | ||
|
|
||
| public static void reportCompactionTable(List<Map<String,String>> compactions, long compactionThroughputInBytes, Double currentCompactionThroughputMiBPerSec, boolean humanReadable, boolean vtableOutput, PrintStream out, TableBuilder table) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would not it be nice if all number parameters are primitives for being consistent? (Double -> long) |
||
| { | ||
| if (compactions.isEmpty()) | ||
| { | ||
|
|
@@ -162,9 +181,22 @@ public static void reportCompactionTable(List<Map<String,String>> compactions, l | |
| } | ||
|
|
||
| String remainingTime = "n/a"; | ||
| if (compactionThroughputInBytes != 0) | ||
| long throughputInBytes = 0; | ||
|
|
||
| // Use current compaction throughput (1 minute) if available and > 0, otherwise fall back to configured throughput | ||
| if (currentCompactionThroughputMiBPerSec != null && currentCompactionThroughputMiBPerSec > 0) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| { | ||
| // Convert MiB/s to bytes/s (1 MiB = 1024 * 1024 bytes) | ||
| throughputInBytes = (long) (currentCompactionThroughputMiBPerSec * 1024 * 1024); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you avoid this casting to long by making |
||
| } | ||
| else if (compactionThroughputInBytes != 0) | ||
| { | ||
| throughputInBytes = compactionThroughputInBytes; | ||
| } | ||
|
|
||
| if (throughputInBytes > 0) | ||
| { | ||
| long remainingTimeInSecs = remainingBytes / compactionThroughputInBytes; | ||
| long remainingTimeInSecs = remainingBytes / throughputInBytes; | ||
| remainingTime = format("%dh%02dm%02ds", remainingTimeInSecs / 3600, (remainingTimeInSecs % 3600) / 60, (remainingTimeInSecs % 60)); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you "1minute" by default ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was my suggestion in the ticket, to use the most recent speed value, 5/15m stats may warm up too long, so you may get less accurate values at the beginning of compaction.