From f5b2eee23d2629338351084936017beba09e96e2 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Wed, 22 Jan 2025 19:07:00 +0100 Subject: [PATCH] prototype IoConcurrency propagation --- pageserver/src/context.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pageserver/src/context.rs b/pageserver/src/context.rs index 33b4c98cd4..24672ad3b1 100644 --- a/pageserver/src/context.rs +++ b/pageserver/src/context.rs @@ -95,6 +95,7 @@ use crate::task_mgr::TaskKind; #[derive(Debug, Default)] pub struct RequestContext { latency_recording: Option, + io_concurrency: Option, } trait Propagatable: Default { @@ -136,12 +137,26 @@ mod latency_recording { } impl Propagatable for LatencyRecording { - fn propagate(&self, other: &Self) { + fn propagate(&self, other: &mut Self) { let mut inner = self.inner.lock().unwrap(); - let other_inner = other.inner.lock().unwrap(); + let other_inner = other.get_mut(); for (k, v) in other_inner.current.iter() { inner.current.insert(*k, *v); } } } } + +mod io_concurrency_propagation { + + struct IoConcurrencyPropagation { + inner: IoConcurrency, + } + + impl Propagatable for IoConcurrencyPropagation { + fn propagate(&self, other: &mut Self) { + other.inner = self.inner.clone(); + } + } + +}