From df954b47d5b70e590bd85194af1d27ebd992364a Mon Sep 17 00:00:00 2001 From: Yingwen Date: Sun, 16 Nov 2025 01:52:32 +0800 Subject: [PATCH] fix: clone the page before putting into the index cache (#7229) * fix: clone the page before putting into the index cache Signed-off-by: evenyag * chore: fix warnings Signed-off-by: evenyag --------- Signed-off-by: evenyag --- src/mito2/src/cache/index.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mito2/src/cache/index.rs b/src/mito2/src/cache/index.rs index cf24772994..350ef34b2a 100644 --- a/src/mito2/src/cache/index.rs +++ b/src/mito2/src/cache/index.rs @@ -216,6 +216,8 @@ where } fn put_page(&self, key: K, page_key: PageKey, value: Bytes) { + // Clones the value to ensure it doesn't reference a larger buffer. + let value = Bytes::from(value.to_vec()); CACHE_BYTES .with_label_values(&[INDEX_CONTENT_TYPE]) .add((self.weight_of_content)(&(key, page_key), &value).into());