From 4fe18944bf3a9edb580cf927fbe4a5cc4ee9cfc7 Mon Sep 17 00:00:00 2001 From: William Wen <44139337+wenym1@users.noreply.github.com> Date: Mon, 6 May 2024 12:30:37 +0800 Subject: [PATCH] fix(storage): include change log sst in object size map (#16561) --- src/meta/src/hummock/manager/checkpoint.rs | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/meta/src/hummock/manager/checkpoint.rs b/src/meta/src/hummock/manager/checkpoint.rs index 67ab7ebcf047..773ca9e6ba53 100644 --- a/src/meta/src/hummock/manager/checkpoint.rs +++ b/src/meta/src/hummock/manager/checkpoint.rs @@ -28,6 +28,7 @@ use risingwave_pb::hummock::hummock_version_checkpoint::{ }; use risingwave_pb::hummock::{PbHummockVersionArchive, PbHummockVersionCheckpoint}; use thiserror_ext::AsReport; +use tracing::warn; use crate::hummock::error::Result; use crate::hummock::manager::versioning::Versioning; @@ -159,7 +160,20 @@ impl HummockManager { summary .insert_table_infos .iter() - .map(|t| (t.object_id, t.file_size)), + .map(|t| (t.object_id, t.file_size)) + .chain( + version_delta + .change_log_delta + .values() + .flat_map(|change_log| { + let new_log = change_log.new_log.as_ref().unwrap(); + new_log + .new_value + .iter() + .chain(new_log.old_value.iter()) + .map(|t| (t.object_id, t.file_size)) + }), + ), ); } @@ -171,7 +185,12 @@ impl HummockManager { let total_file_size = removed_object_ids .iter() - .map(|t| object_sizes.get(t).copied().unwrap()) + .map(|t| { + object_sizes.get(t).copied().unwrap_or_else(|| { + warn!(object_id = t, "unable to get size of removed object id"); + 0 + }) + }) .sum::(); stale_objects.insert( current_version.id,