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 <realevenyag@gmail.com>

* chore: fix warnings

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
This commit is contained in:
Yingwen
2025-11-16 01:52:32 +08:00
committed by GitHub
parent acfd674332
commit df954b47d5

View File

@@ -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());