Tolerate interior fs_events seq holes in EventBus gap detection#754
Tolerate interior fs_events seq holes in EventBus gap detection#754mornyx wants to merge 1 commit into
Conversation
EventsSince previously reset the client whenever since+1 < first returned seq, treating any hole as pruned events. That assumption breaks on a shared-schema fs_events table, where other tenants' interleaved seqs make interior holes the norm and would cause a continuous reset storm; rolled back inserts also burn AUTO_INCREMENT ids and create the same benign holes on standalone tables. Pruning only ever happens at the left edge of the retained window, so a gap now triggers a reset only when the cursor falls behind the oldest retained seq (since+1 < oldest). Interior holes are delivered through.
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
EventBus.EventsSincepreviously treated any seq hole between the client cursor and the first returned event as "events were pruned" and forced a client reset:That assumption is wrong in two cases:
fs_eventstables (one table serving many tenants): other tenants' interleaved seqs make per-tenant holes the norm — every poll would detect a "gap" and reset continuously (reset storm).Pruning only ever happens at the left edge of the retained window, so a gap is now a reset condition only when the cursor falls behind the oldest retained seq (
since+1 < oldest) — identical semantics as before for actual pruning, and interior holes are delivered through. The no-rows branch already used exactly this comparison; this PR makes the got-rows branch consistent with it and updates the doc comment.This is a prerequisite for moving
fs_eventsonto shared (fs_id-keyed) tables.Test plan
go test ./pkg/server/ -run 'TestEventBus' -count=1 -v— all passTestEventBusEventsSinceInteriorGapDelivers: burned middle seq → delivered, no reset (previously would have reset)TestEventBusEventsSincePrunedGapResets: left-edge pruning past the cursor → still resetsbin/golangci-lint run ./pkg/server/...— 0 issues