Skip to content

Commit

Permalink
fix(storage): include change log sst in object size map (#16561)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenym1 authored May 6, 2024
1 parent abcf9ca commit 4fe1894
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/meta/src/hummock/manager/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
}),
),
);
}

Expand All @@ -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::<u64>();
stale_objects.insert(
current_version.id,
Expand Down

0 comments on commit 4fe1894

Please sign in to comment.