This is an automated email from the ASF dual-hosted git repository.
jmckenzie pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new d389620 Log time spent writing keys during compaction
d389620 is described below
commit d389620feebb6798f3269834f567d4b73bcee9f2
Author: Marcus Eriksson <[email protected]>
AuthorDate: Wed Oct 13 09:44:30 2021 -0400
Log time spent writing keys during compaction
Patch by Marcus Eriksson; reviewed by Sam Tunnicliffe for CASSANDRA-17037
Co-authored-by: Marcus Eriksson <[email protected]>
Co-authored-by: Josh McKenzie <[email protected]>
---
CHANGES.txt | 1 +
.../org/apache/cassandra/db/compaction/CompactionTask.java | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index b06d527..7dcdd60 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
4.1
+ * Log time spent writing keys during compaction (CASSANDRA-17037)
* Make nodetool compactionstats and sstable_tasks consistent (CASSANDRA-16976)
* Add metrics and logging around index summary redistribution
(CASSANDRA-17036)
* Add configuration options for minimum allowable replication factor and
default replication factor (CASSANDRA-14557)
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
b/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
index fe61ab6..a375f65 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
@@ -163,6 +163,7 @@ public class CompactionTask extends AbstractCompactionTask
long totalKeysWritten = 0;
long estimatedKeys = 0;
long inputSizeBytes;
+ long timeSpentWritingKeys;
Set<SSTableReader> actuallyCompact =
Sets.difference(transaction.originals(), fullyExpiredSSTables);
Collection<SSTableReader> newSStables;
@@ -201,10 +202,9 @@ public class CompactionTask extends AbstractCompactionTask
if (writer.append(ci.next()))
totalKeysWritten++;
-
long bytesScanned = scanners.getTotalBytesScanned();
- //Rate limit the scanners, and account for compression
+ // Rate limit the scanners, and account for compression
CompactionManager.compactionRateLimiterAcquire(limiter, bytesScanned,
lastBytesScanned, compressionRatio);
lastBytesScanned = bytesScanned;
@@ -215,6 +215,7 @@ public class CompactionTask extends AbstractCompactionTask
lastCheckObsoletion = nanoTime();
}
}
+ timeSpentWritingKeys =
TimeUnit.NANOSECONDS.toMillis(nanoTime() - start);
// point of no return
newSStables = writer.finish();
@@ -246,7 +247,7 @@ public class CompactionTask extends AbstractCompactionTask
String mergeSummary =
updateCompactionHistory(cfs.keyspace.getName(), cfs.getTableName(),
mergedRowCounts, startsize, endsize);
- logger.info(String.format("Compacted (%s) %d sstables to [%s] to
level=%d. %s to %s (~%d%% of original) in %,dms. Read Throughput = %s, Write
Throughput = %s, Row Throughput = ~%,d/s. %,d total partitions merged to %,d.
Partition merge counts were {%s}",
+ logger.info(String.format("Compacted (%s) %d sstables to [%s] to
level=%d. %s to %s (~%d%% of original) in %,dms. Read Throughput = %s, Write
Throughput = %s, Row Throughput = ~%,d/s. %,d total partitions merged to %,d.
Partition merge counts were {%s}. Time spent writing keys = %,dms",
taskId,
transaction.originals().size(),
newSSTableNames.toString(),
@@ -260,7 +261,8 @@ public class CompactionTask extends AbstractCompactionTask
(int) totalSourceCQLRows /
(TimeUnit.NANOSECONDS.toSeconds(durationInNano) + 1),
totalSourceRows,
totalKeysWritten,
- mergeSummary));
+ mergeSummary,
+ timeSpentWritingKeys));
if (logger.isTraceEnabled())
{
logger.trace("CF Total Bytes Compacted: {}",
FBUtilities.prettyPrintMemory(CompactionTask.addToTotalBytesCompacted(endsize)));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]