-
Notifications
You must be signed in to change notification settings - Fork 106
Move backfill options to start
and migrate
command
#660
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
Conversation
08a7668
to
ae056d6
Compare
ae056d6
to
4dcd097
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this has broken the flags - they aren't taking effect for me:
Apply the migration:
{
"name": "01_create_table",
"operations": [
{
"create_table": {
"name": "items",
"columns": [
{
"name": "id",
"type": "serial",
"pk": true
},
{
"name": "name",
"type": "text"
}
]
}
}
]
}
Fill the table with data:
insert into items(name) select 'name_' || i from generate_series(1, 1_000_000) as i
Start a migration with a specified delay:
go run . start --backfill-batch-delay=10s 02_set_unique.json
where the migration is defined:
{
"name": "02_set_unique",
"operations": [
{
"alter_column": {
"table": "items",
"column": "name",
"unique": {
"name": "items_name_unique"
},
"up": "name",
"down": "name"
}
}
]
}
There is no delay between each batch during the backfill.
I think the problem is how the flags are defined as PersistentFlags
in the start
and migrate
commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flags still don't work for me, using the same reproduction as in this comment:
Fixed the issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now; the flags work as expected 👍
Left some comments, feel free to address them or not.
This PR moves the flags
backfill-batch-delay
andbackfill-batch-size
tothe commands
start
andmigrate
. So these options no longer show up in the listof global flags.
I created a new struct
backfill.Config
to store and pass the options downto the migration runner. I also moved the default values for batch delay and batch size
into the package
backfill
. I renamedoptions.go
toconfig.go
because it is a better name given the new contents of the file.Closes #657