bdeggleston commented on code in PR #4445:
URL: https://github.com/apache/cassandra/pull/4445#discussion_r2488152350
##########
src/java/org/apache/cassandra/replication/CoordinatorLog.java:
##########
@@ -220,6 +227,9 @@ private void updateWitnessedReplicatedOffsets(Offsets
offsets, int onNodeId)
}
}
});
+
+ // Record metric for newly witnessed offsets only
+
MutationTrackingMetrics.instance.broadcastOffsetsDiscovered.inc(newlyWitnessedCount[0]);
Review Comment:
I'm on the fence about whether it's better to allocate the array and call
this once, or just call increment for each range in the range consumer. WDYT?
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -832,6 +832,32 @@ private void shutDown() throws InterruptedException
}
}
+ public long getDiskSpaceUsed()
+ {
+ long totalSize = 0;
+
+ try (ReferencedSegments<K, V> refs = selectAndReference(s -> true))
+ {
+ for (Segment<K, V> segment : refs.all())
+ {
+ File dataFile = segment.descriptor.fileFor(Component.DATA);
+ if (dataFile.exists())
+ totalSize += dataFile.length();
+ }
+ }
+
+ // Add current active segment
+ ActiveSegment<K, V> active = currentSegment;
Review Comment:
I _think_ that segments will reference all segments, including the active
segment, so we'd be double counting here. I'm only like 95% sure that's the
case though, so definitely dig into this and make sure.
--
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]