Skip to content

Return num bytes on truncation - #80

Open
nadav-govari wants to merge 3 commits into
mainfrom
nadav/truncate
Open

nadav-govari wants to merge 3 commits into
mainfrom
nadav/truncate

Conversation

@nadav-govari

@nadav-govari nadav-govari commented Sep 30, 2026 •

Copy link
Copy Markdown

We want the number of bytes truncated for upcoming Quickwit work. Doing it here is O(1) whereas other approaches are O(N) as they have to walk the queue. We're already walking it here, so it's a natural place to put it.

Also adds queue size to truncate and append outcomes, and puts it on the queue summary. Adds tests.

I went struct instead of tuple because personally I find tuples of the same type confusing (it's easy to mix up which one is first and which is second).

Comment thread src/mem/queue.rs Outdated
self.start_position = truncate_up_to_pos + 1;
let num_bytes = self.concatenated_records.len();
self.concatenated_records.clear();
let record_count = self.record_metas.len();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let record_count = self.record_metas.len();
let num_records = self.record_metas.len();

Comment thread src/mem/queue.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants