Skip to content

Commit 0786c12

Browse files
MutationTracking Metrics
2 parents e289904 + 883324f commit 0786c12

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/java/org/apache/cassandra/journal/Journal.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -845,16 +845,6 @@ public long getDiskSpaceUsed()
845845
totalSize += dataFile.length();
846846
}
847847
}
848-
849-
// Add current active segment
850-
ActiveSegment<K, V> active = currentSegment;
851-
if (active != null)
852-
{
853-
File activeFile = active.descriptor.fileFor(Component.DATA);
854-
if (activeFile.exists())
855-
totalSize += activeFile.length();
856-
}
857-
858848
return totalSize;
859849
}
860850

test/distributed/org/apache/cassandra/distributed/test/tracking/MutationTrackingMetricsTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,16 @@ public void testBroadcastOffsetsDiscoveredMetric() throws Throwable
149149
cluster.get(1).runOnInstance(() -> MutationTrackingService.instance.broadcastOffsetsForTesting());
150150

151151
// Wait for broadcasts to propagate to node 3
152+
long[] previousCount = {0};
152153
Awaitility.await()
153154
.atMost(Duration.ofSeconds(5))
154155
.pollInterval(Duration.ofMillis(100))
155156
.until(() -> {
156-
long node3Delta = cluster.get(3).callOnInstance(() -> MutationTrackingMetrics.instance.broadcastOffsetsDiscovered.getCount()) - initialNode3Count;
157-
return node3Delta > 0;
157+
long currentCount = cluster.get(3).callOnInstance(() -> MutationTrackingMetrics.instance.broadcastOffsetsDiscovered.getCount());
158+
boolean hasDiscoveredOffsets = currentCount > initialNode3Count;
159+
boolean isStable = hasDiscoveredOffsets && currentCount == previousCount[0];
160+
previousCount[0] = currentCount;
161+
return isStable;
158162
});
159163

160164
// Get the count after first broadcast

0 commit comments

Comments
 (0)