Skip to content

Optimize stale key iteration when digest is up to date#189

Open
Stool233 wants to merge 1 commit into
quickwit-oss:mainfrom
Stool233:optimize-stale-key-values
Open

Optimize stale key iteration when digest is up to date#189
Stool233 wants to merge 1 commit into
quickwit-oss:mainfrom
Stool233:optimize-stale-key-values

Conversation

@Stool233

Copy link
Copy Markdown

Closes #73.

What

This updates NodeState::stale_key_values to return an empty iterator immediately when floor_version is greater than or equal to the node state's max_version.

Why

No key-value in a NodeState can have a version greater than max_version, so when floor_version >= max_version, there cannot be any stale key-value with version > floor_version.

The main delta computation path already skips nodes whose max_version is not greater than the digest's max_version before calling this helper. This change applies the same fast path inside NodeState::stale_key_values itself, removes the existing TODO, and keeps the helper efficient for direct or future call sites.

This does not change the public API, gossip semantics, delta contents, or wire format.

Validation

  • cargo test -p chitchat --lib stale_key_values
  • cargo test -p chitchat test_sorted_stale_nodes_offer
  • cargo test -p chitchat --lib

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.

Optimize iter_stale_key_values by checking the max version

1 participant