Skip to content

Commit 85869dc

Browse files
committed
address comments
1 parent 0d87150 commit 85869dc

File tree

6 files changed

+43
-6
lines changed

6 files changed

+43
-6
lines changed

grafana/risingwave-dashboard.dashboard.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,6 +1698,23 @@ def section_hummock(panels):
16981698
),
16991699
],
17001700
),
1701+
panels.timeseries_latency(
1702+
"Read Duration - MayExist",
1703+
"",
1704+
[
1705+
*quantile(
1706+
lambda quantile, legend: panels.target(
1707+
f"histogram_quantile({quantile}, sum(rate({metric('state_store_may_exist_duration_bucket')}[$__rate_interval])) by (le, job, instance, table_id))",
1708+
f"p{legend}" + " - {{table_id}} @ {{job}} @ {{instance}}",
1709+
),
1710+
[50, 90, 99, "max"],
1711+
),
1712+
panels.target(
1713+
f"sum by(le, job, instance, table_id)(rate({metric('state_store_may_exist_duration_sum')}[$__rate_interval])) / sum by(le, job, instance, table_id) (rate({metric('state_store_may_exist_duration_count')}[$__rate_interval]))",
1714+
"avg - {{table_id}} {{job}} @ {{instance}}",
1715+
),
1716+
],
1717+
),
17011718
panels.timeseries_ops(
17021719
"Read Bloom Filter",
17031720
"",

grafana/risingwave-dashboard.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/storage/src/hummock/store/state_store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl LocalHummockStorage {
109109
.await
110110
}
111111

112-
pub async fn may_exist(
112+
pub async fn may_exist_inner(
113113
&self,
114114
key_range: (Bound<Vec<u8>>, Bound<Vec<u8>>),
115115
read_options: ReadOptions,
@@ -223,7 +223,7 @@ impl LocalStateStore for LocalHummockStorage {
223223
key_range: (Bound<Vec<u8>>, Bound<Vec<u8>>),
224224
read_options: ReadOptions,
225225
) -> Self::SurelyNotHaveFuture<'_> {
226-
self.core.may_exist(key_range, read_options)
226+
self.may_exist_inner(key_range, read_options)
227227
}
228228
}
229229

src/storage/src/hummock/store/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ impl HummockVersionReader {
831831
user_key_range.1.as_ref().map(UserKey::encode),
832832
);
833833
let bloom_filter_prefix_hash = if let Some(prefix_hint) = read_options.prefix_hint {
834-
Sstable::hash_for_bloom_filter(&prefix_hint)
834+
Sstable::hash_for_bloom_filter(&prefix_hint, table_id.table_id)
835835
} else {
836836
// only use `table_key_range` to see whether all SSTs are filtered out
837837
// without looking at bloom filter because prefix_hint is not provided

src/storage/src/monitor/monitored_storage_metrics.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub struct MonitoredStorageMetrics {
2929
pub iter_item: HistogramVec,
3030
pub iter_duration: HistogramVec,
3131
pub iter_scan_duration: HistogramVec,
32+
pub may_exist_duration: HistogramVec,
3233

3334
pub iter_in_process_counts: GenericCounterVec<AtomicU64>,
3435
pub write_batch_tuple_counts: GenericCounterVec<AtomicU64>,
@@ -100,7 +101,7 @@ impl MonitoredStorageMetrics {
100101
let opts = histogram_opts!(
101102
"state_store_iter_scan_duration",
102103
"Histogram of iterator scan time that have been issued to state store",
103-
buckets,
104+
buckets.clone(),
104105
);
105106
let iter_scan_duration =
106107
register_histogram_vec_with_registry!(opts, &["table_id"], registry).unwrap();
@@ -113,6 +114,14 @@ impl MonitoredStorageMetrics {
113114
)
114115
.unwrap();
115116

117+
let opts = histogram_opts!(
118+
"state_store_may_exist_duration",
119+
"Histogram of may exist time that have been issued to state store",
120+
buckets,
121+
);
122+
let may_exist_duration =
123+
register_histogram_vec_with_registry!(opts, &["table_id"], registry).unwrap();
124+
116125
// ----- write_batch -----
117126
let write_batch_tuple_counts = register_int_counter_vec_with_registry!(
118127
"state_store_write_batch_tuple_counts",
@@ -160,6 +169,7 @@ impl MonitoredStorageMetrics {
160169
iter_item,
161170
iter_duration,
162171
iter_scan_duration,
172+
may_exist_duration,
163173
iter_in_process_counts,
164174
write_batch_tuple_counts,
165175
write_batch_duration,

src/storage/src/monitor/monitored_store.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,17 @@ impl<S: LocalStateStore> LocalStateStore for MonitoredStateStore<S> {
196196
key_range: (Bound<Vec<u8>>, Bound<Vec<u8>>),
197197
read_options: ReadOptions,
198198
) -> Self::SurelyNotHaveFuture<'_> {
199-
self.inner.may_exist(key_range, read_options)
199+
async move {
200+
let table_id_label = read_options.table_id.to_string();
201+
let timer = self
202+
.storage_metrics
203+
.write_batch_duration
204+
.with_label_values(&[table_id_label.as_str()])
205+
.start_timer();
206+
let res = self.inner.may_exist(key_range, read_options).await;
207+
timer.observe_duration();
208+
res
209+
}
200210
}
201211
}
202212

0 commit comments

Comments
 (0)