Fix: Go partition by partition instead of in one shot#3755
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the v1_0_99 OLAP mirror-table migration to backfill data incrementally by iterating partitions and tracking progress, rather than attempting a single large backfill operation.
Changes:
- Remove monolithic backfill SQL statements and replace them with a reusable
backfillByPartitionhelper. - Add a temporary
v1_olap_backfill_progresstable to record completed partitions and allow incremental/restartable progress. - Consolidate post-backfill row-count verification into a single loop after the concurrent backfills complete.
Comments suppressed due to low confidence (1)
cmd/hatchet-migrate/migrate/migrations/20260424190713_v1_0_99.go:498
v1RunsOlapTableis used here but not defined in this migration file; it currently relies on a constant declared in an older migration (20251226153622_v1_0_66.go). This creates unnecessary coupling between migrations and can lead to compile-time breakage if the older migration file is ever refactored/removed. Definev1RunsOlapTablein this file (or move shared constants/helpers into a non-dated shared file in the migrations package).
eg.Go(func() error {
if _, err := db.ExecContext(ctx, `DROP INDEX IF EXISTS ix_v1_runs_olap_tenant_id`); err != nil {
return fmt.Errorf("drop old index on %s: %w", v1RunsOlapTable, err)
}
if _, err := db.ExecContext(ctx, buildCreateMirrorTableSQL(v1RunsOlapTable, v1RunsOlapTable+"_new", v1RunsOlapNewColDefs)); err != nil {
return fmt.Errorf("create %s_new: %w", v1RunsOlapTable, err)
abelanger5
approved these changes
Apr 27, 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.
Description
Another attempt... looping over the partitions instead of doing it all in one shot so we can make incremental progress
Type of change