Skip to content

Conversation

@bosconi
Copy link
Member

@bosconi bosconi commented Jan 14, 2026

Summary

  • Add time-based yielding to the Consolidator chunk() method to prevent long-running synchronous work from blocking the runtime
  • New config compaction_yield_after_ms (default 10ms) controls the time threshold
  • chunk() checks elapsed time periodically and returns early if threshold exceeded
  • Outer loop continues processing with yield points between calls

Motivation

The chunk() method can run for a long time when processing large numbers of updates (up to compaction_yield_after_n_updates, default 100,000). Even with the count-based limit, processing many updates synchronously can block the runtime and prevent heartbeat tasks from running.

Test plan

  • cargo check -p mz-persist-client passes
  • cargo test -p mz-persist-client --lib passes (121/121 tests)

Generated with Claude Code

The chunk() method in the Consolidator can run for a long time when
processing large numbers of updates, blocking the runtime and preventing
heartbeat tasks from running.

This change adds time-based yielding to the chunk iteration:
- New config `compaction_yield_after_ms` (default 10ms)
- chunk() now checks elapsed time periodically (every 1000 iterations)
- Returns early if time threshold exceeded, allowing the outer loop to yield

The caller can continue calling next_chunk() to process remaining data,
with yield points between calls.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@bosconi bosconi requested a review from a team as a code owner January 14, 2026 12:08
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