This is an automated email from the ASF dual-hosted git repository.

jiacai2050 pushed a commit to branch memtable-poc
in repository https://gitbox.apache.org/repos/asf/incubator-horaedb.git


The following commit(s) were added to refs/heads/memtable-poc by this push:
     new 75f20c77 fix: isolate object store get ranges
75f20c77 is described below

commit 75f20c77948df81dbad753d48deb9ff75cd6bf5e
Author: jiacai2050 <[email protected]>
AuthorDate: Thu Jan 4 17:21:21 2024 +0800

    fix: isolate object store get ranges
---
 components/object_store/src/metrics.rs | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/components/object_store/src/metrics.rs 
b/components/object_store/src/metrics.rs
index 98fd6bdc..3cd1a27c 100644
--- a/components/object_store/src/metrics.rs
+++ b/components/object_store/src/metrics.rs
@@ -225,11 +225,22 @@ impl ObjectStore for StoreWithMetrics {
 
     async fn get_ranges(&self, location: &Path, ranges: &[Range<usize>]) -> 
Result<Vec<Bytes>> {
         let _timer = OBJECT_STORE_DURATION_HISTOGRAM.get_ranges.start_timer();
-        let result = self.store.get_ranges(location, ranges).await?;
+        let store = self.store.clone();
+        let loc = location.clone();
+        let ranges = ranges.to_vec();
+        let result = self
+            .runtime
+            .spawn(async move { store.get_ranges(&loc, &ranges).await })
+            .await
+            .map_err(|e| StoreError::Generic {
+                store: METRICS,
+                source: Box::new(e),
+            })??;
         let len: usize = result.iter().map(|v| v.len()).sum();
         OBJECT_STORE_THROUGHPUT_HISTOGRAM
             .get_ranges
             .observe(len as f64);
+
         Ok(result)
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to