From 10aba174c999c795eb3b2170cfca5597530a7eab Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Tue, 4 Jul 2023 17:40:51 +0300 Subject: [PATCH] metrics: Remove comments regarding upgradeable rwlocks (#4622) Closes #4001 by removing the comments alluding towards upgradeable/downgradeable RwLocks. --- pageserver/src/metrics.rs | 5 ----- pageserver/src/virtual_file.rs | 9 --------- 2 files changed, 14 deletions(-) diff --git a/pageserver/src/metrics.rs b/pageserver/src/metrics.rs index 8765aa6aff..8f85488aec 100644 --- a/pageserver/src/metrics.rs +++ b/pageserver/src/metrics.rs @@ -968,7 +968,6 @@ impl RemoteTimelineClientMetrics { op_kind: &RemoteOpKind, status: &'static str, ) -> Histogram { - // XXX would be nice to have an upgradable RwLock let mut guard = self.remote_operation_time.lock().unwrap(); let key = (file_kind.as_str(), op_kind.as_str(), status); let metric = guard.entry(key).or_insert_with(move || { @@ -990,7 +989,6 @@ impl RemoteTimelineClientMetrics { file_kind: &RemoteOpFileKind, op_kind: &RemoteOpKind, ) -> IntGauge { - // XXX would be nice to have an upgradable RwLock let mut guard = self.calls_unfinished_gauge.lock().unwrap(); let key = (file_kind.as_str(), op_kind.as_str()); let metric = guard.entry(key).or_insert_with(move || { @@ -1011,7 +1009,6 @@ impl RemoteTimelineClientMetrics { file_kind: &RemoteOpFileKind, op_kind: &RemoteOpKind, ) -> Histogram { - // XXX would be nice to have an upgradable RwLock let mut guard = self.calls_started_hist.lock().unwrap(); let key = (file_kind.as_str(), op_kind.as_str()); let metric = guard.entry(key).or_insert_with(move || { @@ -1032,7 +1029,6 @@ impl RemoteTimelineClientMetrics { file_kind: &RemoteOpFileKind, op_kind: &RemoteOpKind, ) -> IntCounter { - // XXX would be nice to have an upgradable RwLock let mut guard = self.bytes_started_counter.lock().unwrap(); let key = (file_kind.as_str(), op_kind.as_str()); let metric = guard.entry(key).or_insert_with(move || { @@ -1053,7 +1049,6 @@ impl RemoteTimelineClientMetrics { file_kind: &RemoteOpFileKind, op_kind: &RemoteOpKind, ) -> IntCounter { - // XXX would be nice to have an upgradable RwLock let mut guard = self.bytes_finished_counter.lock().unwrap(); let key = (file_kind.as_str(), op_kind.as_str()); let metric = guard.entry(key).or_insert_with(move || { diff --git a/pageserver/src/virtual_file.rs b/pageserver/src/virtual_file.rs index fb216123c1..b86d14f158 100644 --- a/pageserver/src/virtual_file.rs +++ b/pageserver/src/virtual_file.rs @@ -302,15 +302,6 @@ impl VirtualFile { .observe_closure_duration(|| self.open_options.open(&self.path))?; // Perform the requested operation on it - // - // TODO: We could downgrade the locks to read mode before calling - // 'func', to allow a little bit more concurrency, but the standard - // library RwLock doesn't allow downgrading without releasing the lock, - // and that doesn't seem worth the trouble. - // - // XXX: `parking_lot::RwLock` can enable such downgrades, yet its implementation is fair and - // may deadlock on subsequent read calls. - // Simply replacing all `RwLock` in project causes deadlocks, so use it sparingly. let result = STORAGE_IO_TIME .with_label_values(&[op, &self.tenant_id, &self.timeline_id]) .observe_closure_duration(|| func(&file));