Skip to content

Return backfill.Task from Start phase operations #924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2025

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Jun 19, 2025

From now on Start functions of each operations return a backfill.Task instance. This struct contains information required by the backfill process. The tasks are collected in a single backfill.Job.
This aggregates all relevant information for the backfill process: list of tables to backfill and all the triggers to load.

@github-actions github-actions bot temporarily deployed to Docs Preview June 19, 2025 17:22 Inactive
@kvch kvch force-pushed the return-task-from-operations branch from 14e56bb to a65b6e0 Compare June 19, 2025 17:34
@github-actions github-actions bot temporarily deployed to Docs Preview June 19, 2025 17:35 Inactive
@kvch kvch force-pushed the return-task-from-operations branch from a65b6e0 to 351f414 Compare June 19, 2025 17:49
@github-actions github-actions bot temporarily deployed to Docs Preview June 19, 2025 17:49 Inactive
@kvch kvch force-pushed the return-task-from-operations branch from 351f414 to 5e22a83 Compare June 19, 2025 17:51
@github-actions github-actions bot temporarily deployed to Docs Preview June 19, 2025 17:51 Inactive
@kvch kvch force-pushed the return-task-from-operations branch from 5e22a83 to 6423c1b Compare June 19, 2025 17:54
@github-actions github-actions bot temporarily deployed to Docs Preview June 19, 2025 17:54 Inactive
@kvch kvch force-pushed the return-task-from-operations branch from 6423c1b to d1f72a8 Compare June 20, 2025 09:01
@github-actions github-actions bot temporarily deployed to Docs Preview June 20, 2025 09:01 Inactive
@kvch kvch changed the title Return backfill.Task from operations Return backfill.Task from Start phase operations Jun 20, 2025
@kvch kvch requested a review from andrew-farries June 20, 2025 09:03
Copy link
Collaborator

@andrew-farries andrew-farries left a comment

Choose a reason for hiding this comment

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

Some comments and a question about how this relates to the DBAction refactoring.

AIUI, the DBAction refactoring was going to make the operation Start methods return []DBAction which would then be merged/reordered/combined by a new orchestrator component. This component could also include combining triggers that are intended to act on the same table.

With this PR, we make operation Start methods return backfill jobs, which will allow us to combine backfill triggers, but what happens to the idea to return []DBAction from Start? It seems like returning []DBAction would allow us to solve a greater class of problems, including the one addressed by this PR.

How do you see the changes here fitting in with the broader plan to return []DBAction from operation Start methods?

@github-actions github-actions bot temporarily deployed to Docs Preview June 23, 2025 10:27 Inactive
Copy link

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/xataio/pgroll/pkg/backfill 0.00% (ø)
github.com/xataio/pgroll/pkg/migrations 74.61% (+0.01%) 👍
github.com/xataio/pgroll/pkg/roll 80.06% (+0.06%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/xataio/pgroll/pkg/backfill/backfill.go 0.00% (ø) 75 (+4) 0 75 (+4)
github.com/xataio/pgroll/pkg/migrations/migrations.go 94.12% (ø) 17 16 1
github.com/xataio/pgroll/pkg/migrations/op_add_column.go 80.99% (ø) 142 115 27
github.com/xataio/pgroll/pkg/migrations/op_alter_column.go 83.74% (ø) 123 103 20
github.com/xataio/pgroll/pkg/migrations/op_change_type.go 92.86% (ø) 14 13 1
github.com/xataio/pgroll/pkg/migrations/op_create_constraint.go 78.15% (+0.19%) 119 (+1) 93 (+1) 26 👍
github.com/xataio/pgroll/pkg/migrations/op_create_index.go 69.35% (ø) 62 43 19
github.com/xataio/pgroll/pkg/migrations/op_create_table.go 83.97% (ø) 131 110 21
github.com/xataio/pgroll/pkg/migrations/op_drop_column.go 76.74% (ø) 43 33 10
github.com/xataio/pgroll/pkg/migrations/op_drop_constraint.go 80.00% (ø) 65 52 13
github.com/xataio/pgroll/pkg/migrations/op_drop_index.go 90.91% (ø) 11 10 1
github.com/xataio/pgroll/pkg/migrations/op_drop_multicolumn_constraint.go 82.50% (ø) 80 66 14
github.com/xataio/pgroll/pkg/migrations/op_drop_not_null.go 93.33% (ø) 15 14 1
github.com/xataio/pgroll/pkg/migrations/op_drop_table.go 87.50% (ø) 24 21 3
github.com/xataio/pgroll/pkg/migrations/op_raw_sql.go 88.89% (ø) 18 16 2
github.com/xataio/pgroll/pkg/migrations/op_rename_column.go 93.33% (ø) 30 28 2
github.com/xataio/pgroll/pkg/migrations/op_rename_constraint.go 100.00% (ø) 16 16 0
github.com/xataio/pgroll/pkg/migrations/op_rename_table.go 100.00% (ø) 15 15 0
github.com/xataio/pgroll/pkg/migrations/op_set_check.go 84.62% (ø) 26 22 4
github.com/xataio/pgroll/pkg/migrations/op_set_comment.go 90.00% (ø) 10 9 1
github.com/xataio/pgroll/pkg/migrations/op_set_default.go 85.71% (ø) 21 18 3
github.com/xataio/pgroll/pkg/migrations/op_set_fk.go 74.29% (ø) 35 26 9
github.com/xataio/pgroll/pkg/migrations/op_set_notnull.go 80.65% (ø) 31 25 6
github.com/xataio/pgroll/pkg/migrations/op_set_replica_identity.go 100.00% (ø) 21 21 0
github.com/xataio/pgroll/pkg/migrations/op_set_unique.go 77.27% (ø) 22 17 5
github.com/xataio/pgroll/pkg/roll/execute.go 79.39% (+0.13%) 165 (+1) 131 (+1) 34 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@kvch kvch requested a review from andrew-farries June 23, 2025 11:25
Copy link
Collaborator

@andrew-farries andrew-farries left a comment

Choose a reason for hiding this comment

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

Thanks for making the suggested changes 👍

Just to understand the future direction, Is the plan now to make Start return []DBAction in addition to backfill.Task?

@kvch
Copy link
Contributor Author

kvch commented Jun 23, 2025

Just to understand the future direction, Is the plan now to make Start return []DBAction in addition to backfill.Task?

Yes. However, I am unhappy with returning 3 things, so I will try to find a way to decrease this number.

@kvch kvch merged commit b117582 into main Jun 23, 2025
30 checks passed
@kvch kvch deleted the return-task-from-operations branch June 23, 2025 13:26
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.

2 participants