Repository navigation
fix: batch multitenant lifecycle tenants - #1654
Merged
Merged
Conversation
Signed-off-by: Ferhat Elmas <elmas.ferhat@gmail.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the resumable multitenant lifecycle enrollment changes.
No open issues 🎉
What changed in this PR
This PR makes multitenant lifecycle enrollment resumable by committing the registry and trigger before backfilling tenants, reducing lock duration and preserving completed batches if a later batch fails.
Changes:
- Backfills tenants in batches of up to 1,000, with the trigger covering concurrent inserts and feature activations.
- Retries schema and backfill lock conflicts with a limit of five attempts.
- Adds integration tests for lock release, partial recovery, retry limits, enrollment coverage, and migration-hash handling.
| File | Description |
|---|---|
src/test/lifecycle-tenants-migration.test.ts |
Adds tests for batching, concurrency, retries, recovery, and hash compatibility. |
migrations/multitenant/0031-lifecycle-tenants.sql |
Separates schema setup from committed backfill batches and adds bounded lock-conflict retries. |
Review effort: Balanced
Coverage Report for CI Build 41737182380Coverage increased (+0.07%) to 87.131%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
TylerHillery
approved these changes
Nov 3, 2026
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.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Multitenant lifecycle registry and trigger are created then it's backfilled for all enabled tenants in one tx. The trigger DDL lock remains for the backfill commits and a failure rolls every progress back.
What is the new behavior?
Commits the registry and trigger first then backfill tenants in batches of up to 1000. The trigger covers new tenants and feature activations during the scan. Lock conflicts are retried up to five times. If a later batch fails, progress from earlier batches remain committed and a a retry can replay the backfill.