Repository navigation
fix: race conditions while counting initial pending events can cause wrong counting - #7292
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7292 +/- ##
==========================================
+ Coverage 79.73% 80.15% +0.41%
==========================================
Files 601 601
Lines 67308 67336 +28
==========================================
+ Hits 53671 53972 +301
+ Misses 10464 10183 -281
- Partials 3173 3181 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
atzoum
force-pushed
the
fix.pendingEventsRace
branch
from
August 19, 2026 13:58
645957d to
2d34aa3
Compare
ktgowtham
approved these changes
Aug 24, 2026
atzoum
force-pushed
the
fix.pendingEventsRace
branch
from
August 24, 2026 08:18
2d34aa3 to
7e59d0f
Compare
Contributor
|
@mihir20 could you review this one |
atzoum
force-pushed
the
fix.pendingEventsRace
branch
from
August 24, 2026 14:08
7e59d0f to
51fd481
Compare
mihir20
pushed a commit
that referenced
this pull request
Aug 31, 2026
…wrong counting (#7292) # Description Pending event counts can drift at startup, since the pileup count and the live counters don't agree on a single boundary: - Jobs stored by the processor while the count is running are counted twice: the cutoff is applied to statuses (`exec_time`) but not to jobs, so the query counts them, and so does the jobsdb wrapper's increase. - The registry is reset after the cutoff is captured and once more on every retry attempt, discarding whatever the running processor has registered in the meantime. - Pausing compaction is advisory - it only keeps new rounds from starting - so a compaction already in flight keeps moving datasets while the count queries them. Key changes: - The cutoff and the registry reset move ahead of the processor's loops. The processor is the only writer of rt/batch_rt jobs and always starts before router & batch router, so nothing can be written below the cutoff once it is captured, and everything above it is accounted for by the pending events jobsdb wrappers. - `GetPileUpCounts` applies the cutoff to both sides, `created_at` for jobs and `exec_time` for statuses. - Retries no longer reset the registry: counts are accumulated per attempt and applied only after every query has succeeded. - The compaction pause becomes a lock - taken exclusively by compaction, which skips the round if it can't get it, and for reading by the count, which waits for an in-flight compaction and keeps the next ones out. ## Linear Ticket resolves 3299 ## Security - [x] The code changed/added as part of this pull request won't create any security issues with how the software is being used.
This was referenced Aug 31, 2026
Merged
itsmihir
pushed a commit
that referenced
this pull request
Aug 31, 2026
🤖 I have created a release *beep* *boop* --- ## [1.85.0-rc.1](v1.84.0...v1.85.0-rc.1) (2026-08-31) ### Features * backend config v2 resolver with stub mapper ([#7275](#7275)) ([267b973](267b973)) * **warehouse:** clickhouse v2 connection and schema ([#7301](#7301)) ([2eb1fa6](2eb1fa6)) * **warehouse:** clickhouse v2 ddl operations ([#7302](#7302)) ([f2887c5](f2887c5)) * **warehouse:** clickhouse v2 loading ([#7303](#7303)) ([3e48618](3e48618)) * **warehouse:** enable the clickhouse v2 driver behind a flag ([#7311](#7311)) ([3ce1da5](3ce1da5)) ### Bug Fixes * race conditions while counting initial pending events can cause wrong counting ([#7292](#7292)) ([3efa718](3efa718)) * replay destinations not using the config corresponding to their connected source type ([#7307](#7307)) ([ee7aa93](ee7aa93)) * **router:** abort router-transform on proactive invalid_grant instead of retrying (INT-6779) ([#7175](#7175)) ([4d7348d](4d7348d)) * tracking plan merged config is cached without its event type ([#7314](#7314)) ([624dd5c](624dd5c)) ### Miscellaneous * setattr/delattr hardening ([#7291](#7291)) ([2855af4](2855af4)) * sync release v1.84.0 to main branch ([#7306](#7306)) ([fa102b7](fa102b7)) * webhook reasons ([#7294](#7294)) ([c298d59](c298d59)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
itsmihir
pushed a commit
that referenced
this pull request
Sep 1, 2026
🤖 I have created a release *beep* *boop* --- ## [1.85.0](v1.84.0...v1.85.0) (2026-08-31) ### Features * backend config v2 resolver with stub mapper ([#7275](#7275)) ([267b973](267b973)) * **warehouse:** clickhouse v2 connection and schema ([#7301](#7301)) ([2eb1fa6](2eb1fa6)) * **warehouse:** clickhouse v2 ddl operations ([#7302](#7302)) ([f2887c5](f2887c5)) * **warehouse:** clickhouse v2 loading ([#7303](#7303)) ([3e48618](3e48618)) * **warehouse:** enable the clickhouse v2 driver behind a flag ([#7311](#7311)) ([3ce1da5](3ce1da5)) ### Bug Fixes * race conditions while counting initial pending events can cause wrong counting ([#7292](#7292)) ([3efa718](3efa718)) * replay destinations not using the config corresponding to their connected source type ([#7307](#7307)) ([ee7aa93](ee7aa93)) * **router:** abort router-transform on proactive invalid_grant instead of retrying (INT-6779) ([#7175](#7175)) ([4d7348d](4d7348d)) * tracking plan merged config is cached without its event type ([#7314](#7314)) ([624dd5c](624dd5c)) ### Miscellaneous * setattr/delattr hardening ([#7291](#7291)) ([2855af4](2855af4)) * sync release v1.84.0 to main branch ([#7306](#7306)) ([fa102b7](fa102b7)) * webhook reasons ([#7294](#7294)) ([c298d59](c298d59)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Pending event counts can drift at startup, since the pileup count and the live counters don't agree on a single boundary:
exec_time) but not to jobs, so the query counts them, and so does the jobsdb wrapper's increase.Key changes:
GetPileUpCountsapplies the cutoff to both sides,created_atfor jobs andexec_timefor statuses.Linear Ticket
resolves 3299
Security