mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-19 22:44:18 +00:00
rust volume: only update max_file_key on live entries in idx metric rebuild
metrics_from_idx called maybe_set_max_file_key on every entry including tombstones, but the live on_put path only calls it for puts and on_delete never does. A tombstone always has a preceding put for the same key that already set max_file_key, so the result is the same today; restricting it to live entries makes the parity with the live path exact and self-evident. Co-Authored-By: Chris Lu <chris.lu@gmail.com>
This commit is contained in:
@@ -98,13 +98,13 @@ pub(super) fn metrics_from_idx<R: Read + Seek>(
|
||||
for i in (0..batch).rev() {
|
||||
let entry = &buf[i * NEEDLE_MAP_ENTRY_SIZE..(i + 1) * NEEDLE_MAP_ENTRY_SIZE];
|
||||
let (key, offset, size) = idx_entry_from_bytes(entry);
|
||||
metric.maybe_set_max_file_key(key);
|
||||
metric.maybe_set_max_needle_end(offset, size, version);
|
||||
let superseded = seen.test_and_add(key.into());
|
||||
if offset.is_zero() || size.is_deleted() {
|
||||
// Tombstone: reserves no bytes, only marks the key as seen.
|
||||
continue;
|
||||
}
|
||||
metric.maybe_set_max_file_key(key);
|
||||
metric.file_count.fetch_add(1, Ordering::Relaxed);
|
||||
metric
|
||||
.file_byte_count
|
||||
|
||||
Reference in New Issue
Block a user