Skip to content

feat(jobsdb): improve migration compaction - #6844

Merged
atzoum merged 4 commits into
masterfrom
chore.jobsdbSecondLastDs
Apr 19, 2026
Merged

atzoum merged 4 commits into
masterfrom
chore.jobsdbSecondLastDs

Conversation

@atzoum

@atzoum atzoum commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Writers only write to the last dataset, so shrinking their datasetList to only the last one (instead of last two) is sufficient.
  • Migration now exempts only the last (currently-written) dataset from migration for both Read and ReadWrite owner types, removing the special-case exemption of the second-to-last dataset for readers.
  • Added two guards to getMigrationList needsPair branch to ensure the destination dataset never exceeds maxDSSize pending jobs, enabling safe use of jobMinRowsLeftMigrateThreshold > 0.5 (e.g. being able to compact one dataset with 70K rows with another one with 30K rows):
    • When accumulating datasets into an existing batch (pendingJobsCount > 0), break before adding one that would push the total over maxDSSize.
    • When combining a waiting dataset with its pair, discard both if their combined pending count exceeds maxDSSize and continue probing.
  • firstEligible is now derived from migrateFrom[0] at the end of the loop instead of being set eagerly, ensuring it always points to the actual first migrated dataset rather than a dataset from a discarded pair.

@atzoum
atzoum force-pushed the chore.jobsdbSecondLastDs branch from bdcf2d1 to 5d7fe53 Compare April 3, 2026 08:36
@atzoum atzoum changed the title chore(jobsdb): keep only last dataset for writers instead of last two chore(jobsdb): keep only last dataset for writers; guard migration against oversized destination datasets Apr 3, 2026
@atzoum atzoum changed the title chore(jobsdb): keep only last dataset for writers; guard migration against oversized destination datasets chore(jobsdb): improve migration compaction Apr 3, 2026
@atzoum
atzoum force-pushed the chore.jobsdbSecondLastDs branch from 09b2fb3 to 3836f90 Compare April 3, 2026 11:09
@atzoum atzoum changed the title chore(jobsdb): improve migration compaction feat(jobsdb): improve migration compaction Apr 3, 2026
@codecov

codecov Bot commented Apr 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.67%. Comparing base (8089953) to head (ecc4a51).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6844      +/-   ##
==========================================
- Coverage   79.70%   79.67%   -0.04%     
==========================================
  Files         565      565              
  Lines       63308    63317       +9     
==========================================
- Hits        50461    50449      -12     
- Misses       9860     9873      +13     
- Partials     2987     2995       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@atzoum
atzoum force-pushed the chore.jobsdbSecondLastDs branch 3 times, most recently from ff79c0d to a39f749 Compare April 6, 2026 07:16

@mihir20 mihir20 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@atzoum
atzoum marked this pull request as draft April 7, 2026 12:56
@atzoum
atzoum force-pushed the chore.jobsdbSecondLastDs branch 3 times, most recently from dbd2425 to 8e69970 Compare April 9, 2026 19:31
@atzoum
atzoum marked this pull request as ready for review April 19, 2026 17:36
atzoum added 4 commits April 19, 2026 20:37
Writers only write to the last dataset, so shrinking the datasetList
to only the last one is sufficient. Similarly, migration now exempts
only the last (currently-written) dataset instead of the last two.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
…er than maxDSSize

With jobMinRowsLeftMigrateThreshold > 0.5, combining two needsPair datasets
can exceed maxDSSize. Two guards are added to getMigrationList:
- When accumulating additional datasets into an existing batch, break if adding
  the next one would push pendingJobsCount over maxDSSize.
- When combining a waiting dataset with its pair, discard both if their combined
  pending count exceeds maxDSSize, and continue probing for a smaller pair.

firstEligible is now derived from migrateFrom[0] at the end of the loop
instead of being set eagerly, ensuring it always reflects the actual first
dataset that will be migrated rather than a dataset from a discarded pair.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.30.1
🔒 Scanned for secrets using gitleaks 8.30.1
🔒 Scanned for secrets using gitleaks 8.30.1
@atzoum
atzoum force-pushed the chore.jobsdbSecondLastDs branch from 1341b40 to ecc4a51 Compare April 19, 2026 17:37
@atzoum
atzoum enabled auto-merge (squash) April 19, 2026 17:37
@atzoum
atzoum disabled auto-merge April 19, 2026 18:13
@atzoum
atzoum merged commit b7f2b9f into master Apr 19, 2026
56 checks passed
@atzoum
atzoum deleted the chore.jobsdbSecondLastDs branch April 19, 2026 18:13
mihir20 pushed a commit that referenced this pull request Apr 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.74.0-rc.1](v1.73.0...v1.74.0-rc.1)
(2026-04-27)


### Features

* add configurable batch size for bulk inserting failed rsources records
([#6873](#6873))
([d8f6ea0](d8f6ea0))
* add native deletion support for identity removal in gzip files
([#6896](#6896))
([c1e27d0](c1e27d0))
* deep job pickups when no results cache is cold
([#6850](#6850))
([03e9d88](03e9d88))
* **jobsdb:** improve migration compaction
([#6844](#6844))
([b7f2b9f](b7f2b9f))


### Bug Fixes

* add correct host for salesforceBU destination
([#6906](#6906))
([2430cb4](2430cb4))
* batch router drained events metrics
([#6898](#6898))
([c5b2927](c5b2927))
* build action failing
([#6899](#6899))
([691a812](691a812))
* snowpipe struck scenarios
([#6895](#6895))
([35b07a8](35b07a8))
* use tid instead of vid
([#6908](#6908))
([954dcf7](954dcf7))


### Miscellaneous

* avoid marshalling proc error job payloads
([#6872](#6872))
([145826b](145826b))
* bump build-scan-push-action from v2.1.0 to v2.2.0
([#6903](#6903))
([e917f9b](e917f9b))
* contract tests for dns regressions and overrides
([#6864](#6864))
([b105678](b105678))
* pin and bump action refs (SEC-171)
([#6863](#6863))
([8089953](8089953))
* pytransformer pooling contract tests
([#6883](#6883))
([0530c8c](0530c8c))
* scope workflow permissions to least privilege (SEC-167)
([#6911](#6911))
([5600dbe](5600dbe))
* update Slack notification method in scheduled release workflow
([#6879](#6879))
([3b67dcb](3b67dcb))
* **vuln:** zizmor --fix=all findings (SEC-199)
([#6905](#6905))
([d8cc34f](d8cc34f))

---
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>
mihir20 pushed a commit that referenced this pull request Apr 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.74.0](v1.73.0...v1.74.0)
(2026-04-27)


### Features

* add configurable batch size for bulk inserting failed rsources records
([#6873](#6873))
([d8f6ea0](d8f6ea0))
* add native deletion support for identity removal in gzip files
([#6896](#6896))
([c1e27d0](c1e27d0))
* deep job pickups when no results cache is cold
([#6850](#6850))
([03e9d88](03e9d88))
* **jobsdb:** improve migration compaction
([#6844](#6844))
([b7f2b9f](b7f2b9f))


### Bug Fixes

* add correct host for salesforceBU destination
([#6906](#6906))
([2430cb4](2430cb4))
* batch router drained events metrics
([#6898](#6898))
([c5b2927](c5b2927))
* build action failing
([#6899](#6899))
([691a812](691a812))
* snowpipe struck scenarios
([#6895](#6895))
([35b07a8](35b07a8))
* use tid instead of vid
([#6908](#6908))
([954dcf7](954dcf7))


### Miscellaneous

* avoid marshalling proc error job payloads
([#6872](#6872))
([145826b](145826b))
* bump build-scan-push-action from v2.1.0 to v2.2.0
([#6903](#6903))
([e917f9b](e917f9b))
* contract tests for dns regressions and overrides
([#6864](#6864))
([b105678](b105678))
* pin and bump action refs (SEC-171)
([#6863](#6863))
([8089953](8089953))
* pytransformer pooling contract tests
([#6883](#6883))
([0530c8c](0530c8c))
* scope workflow permissions to least privilege (SEC-167)
([#6911](#6911))
([5600dbe](5600dbe))
* update Slack notification method in scheduled release workflow
([#6879](#6879))
([3b67dcb](3b67dcb))
* **vuln:** zizmor --fix=all findings (SEC-199)
([#6905](#6905))
([d8cc34f](d8cc34f))

---
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>
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.

3 participants