File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
main/java/org/apache/pulsar/compaction
test/java/org/apache/pulsar/compaction Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ public long[] getCompactionLatencyBuckets() {
111
111
}
112
112
113
113
public StatsBuckets getCompactionLatencyStats () {
114
+ writeLatencyStats .refresh ();
114
115
return writeLatencyStats ;
115
116
}
116
117
Original file line number Diff line number Diff line change 20
20
21
21
import static org .testng .Assert .assertEquals ;
22
22
import static org .testng .Assert .assertTrue ;
23
+ import org .apache .bookkeeper .mledger .util .StatsBuckets ;
23
24
import org .testng .annotations .Test ;
24
25
25
26
import java .util .concurrent .TimeUnit ;
@@ -61,4 +62,17 @@ public void testSimple() throws Exception {
61
62
assertTrue (compaction .getCompactionLatencyBuckets ()[0 ] > 0L );
62
63
}
63
64
65
+ @ Test
66
+ public void testCompactionLatencyStatsAddAll () {
67
+ CompactorMXBeanImpl mxBean = new CompactorMXBeanImpl ();
68
+ String topic = "topic2" ;
69
+ mxBean .addCompactionStartOp (topic );
70
+ CompactionRecord compaction = mxBean .getCompactionRecordForTopic (topic ).get ();
71
+ StatsBuckets compactionLatencyBuckets = new StatsBuckets (CompactionRecord .WRITE_LATENCY_BUCKETS_USEC );
72
+ mxBean .addCompactionLatencyOp (topic , 10 , TimeUnit .NANOSECONDS );
73
+ compactionLatencyBuckets .addAll (compaction .getCompactionLatencyStats ());
74
+ compactionLatencyBuckets .refresh ();
75
+ assertTrue (compactionLatencyBuckets .getBuckets ()[0 ] > 0L );
76
+ }
77
+
64
78
}
You can’t perform that action at this time.
0 commit comments