Skip to content

Filter out non-local updates in shard positions update event handler#6613

Open
guilload wants to merge 1 commit into
mainfrom
guilload/improve-ingester-shard-position-updates-gossip-handler
Open

Filter out non-local updates in shard positions update event handler#6613
guilload wants to merge 1 commit into
mainfrom
guilload/improve-ingester-shard-position-updates-gossip-handler

Conversation

@guilload

Copy link
Copy Markdown
Member

Description

ShardPositionsUpdate carry all the updates for a source. Most shards contained in the update are probably not relevant to the ingester so:

  1. Filter out irrelevant position updates under partial lock
  2. Yield to other tasks
  3. Apply updates under full lock

I actually don't expect this PR to solve the issue mentioned in #6598 but I'm hoping that the new spans and logging statement will help us gain a better understanding of what's going on.

How was this PR tested?

  1. Added unit test
  2. c t --manifest-path quickwit/Cargo.toml -p quickwit-ingest

@guilload
guilload requested a review from a team as a code owner July 17, 2026 18:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aebe071e92

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +1312 to +1316
let Some(shard) = state_guard.shards.get(queue_id) else {
return false;
};
if shard_position.is_eof() {
state_guard.delete_shard(&queue_id, "indexer gossip").await;
} else if !shard_position.is_beginning() {
state_guard
.truncate_shard(&queue_id, shard_position, "indexer gossip")
.await;
return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve EOF cleanup for dangling WAL queues

When a WAL queue exists without an in-memory shard, this early filter drops the update before delete_shard can run. That matters because delete_shard deletes the WAL queue before checking shards.remove, and init_primary_shard can leave such a dangling queue if it creates the queue and then fails before inserting the shard (the code even has a TODO for that cleanup). For EOF gossip on that local dangling queue, the previous handler would remove the WAL queue, but this path now treats it as non-local and leaves it consuming disk/capacity.

Useful? React with 👍 / 👎.

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.

1 participant