mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-20 06:50:37 +00:00
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:
2
src/mito2/src/cache/index.rs
vendored
2
src/mito2/src/cache/index.rs
vendored
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user