You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you know if this fly command will do anything more than just setting a few components to paused in the future? Because if that is all that the fly command is doing, maybe we can just create a generic fly command that sets any components to paused with a flag where you pass in the name of the component you want to pause. There can also be a --all flag where it will pause all the components. I bring this up because I'm a little unsure about this fly command feeling generic as setting the db into protective mode, making it seem like it causes nothing to write to the database after this is set. But in reality things will still be running against the database. Let me know what you think!
I think making generic command makes sense. The only thing I am worring about is how to make user understand what set of components need to be paused for a specific purpose.
For example, to get minimum interruption during upgrading or DB backup, they need to know what exact components they want to pause (scheduler, collector_pipelines and tracker).
Maybe we could use a command like fly set-mode with arguments like --protective pauses components that might drop an object --read-only pauses all components and the API put/post/delete request will be rejected --no-gc pauses all GC components for debugging --normal unpauses all components
we could then extand the flags by adding any mode that has predefined usage. In this way, users wont be able to use the comand to pause whatever combination of components and asking for behaviour that we might not support. And we just need to document the modes instead of documenting the detail of each component.
Food for thought: can this be partially incorporated into the concourse migrate command? fly requires some sort of login, but what if I only have the connection details to the db? It could be nice to have a read only UI, rather than full service downtime when doing a major version upgrade.
problem with concourse migration command is later if we move to use voyager, what do we do with this command? Not sure if it would fit into voyager as it contains business logic for Concourse components only.
Hm I was thinking that we could just document what components they would need to pause if they wanted to do a backup using pg_dump.
I think those extra flags is an interesting idea, I do like how it makes it so that the operator does not need to know about the workings of each component and what its responsibility is. The argument against it would be that the admin operator of concourse should know about each component and it might be nice for the fly command to be flexible enough for the operator to choose which components they need to pause/unpause. This was actually a motivation behind this components concept (#2473, #5480).
It seems like the most common reason for failure during a pg_dump is builds finishing and their build event sequence being dropped. There is also the risk of a pipeline/team being deleted concurrently, but just pausing components won't help entirely with that unless we add a deleted_teams table and corresponding GC component, which seems like overkill for a rare use-case, given that the workaround is just to retry the backup. Since deleting pipelines/teams is a voluntary thing, maybe it's reasonable to just recommend doing backups during off-hours when people won't be deleting stuff (probably the right call anyway).
Just pausing the tracker also doesn't fix the issue with dropping sequences - when the tracker is paused, new builds won't be tracked, but existing builds will still run to completion.
So what if we just avoided that issue altogether by not dynamically creating/deleting sequences, and instead using a table like build_event_counters that just stores (build_id, event_id). When a build is created, we INSERT(build_id, 0). Whenever we would increment the sequence, we instead fetch-and-add the event_id via an UPDATE ... RETURNING event_id. When the build is finished, we DELETE the row.
Note that we shouldn't just add an event_id column to builds, since that'd yield a ton of dead tuples in the builds table and would require very frequent VACUUMing.
Just pausing the tracker also doesn't fix the issue with dropping sequences - when the tracker is paused, new builds won't be tracked, but existing builds will still run to completion.
@aoldershaw yes this where we have to add some draining buffer and retry logic in this PR.
I like the idea of not creating/deleting sequences. In general we should try to avoid DDL operation, especially for things happens frequently like builds. Probably worth to open an issue as its own under this epic.
For the record though fly pause/unpause component is not only for the race condition problem, as mentioned above in #2473 and #5480
Activity
clarafu commentedon Apr 6, 2021
I think the build tracker component also Finishes a build, so we might have to set that to paused too
concourse/atc/engine/engine.go
Lines 273 to 277 in 2279a05
Do you know if this fly command will do anything more than just setting a few components to
pausedin the future? Because if that is all that the fly command is doing, maybe we can just create a generic fly command that sets any components topausedwith a flag where you pass in the name of the component you want to pause. There can also be a--allflag where it will pause all the components. I bring this up because I'm a little unsure about this fly command feeling generic as setting the db into protective mode, making it seem like it causes nothing to write to the database after this is set. But in reality things will still be running against the database. Let me know what you think!xtremerui commentedon Apr 6, 2021
I think making generic command makes sense. The only thing I am worring about is how to make user understand what set of components need to be paused for a specific purpose.
For example, to get minimum interruption during upgrading or DB backup, they need to know what exact components they want to pause (scheduler, collector_pipelines and tracker).
Maybe we could use a command like
fly set-modewith arguments like--protectivepauses components that might drop an object--read-onlypauses all components and the API put/post/delete request will be rejected--no-gcpauses all GC components for debugging--normalunpauses all componentswe could then extand the flags by adding any mode that has predefined usage. In this way, users wont be able to use the comand to pause whatever combination of components and asking for behaviour that we might not support. And we just need to document the modes instead of documenting the detail of each component.
chenbh commentedon Apr 6, 2021
Food for thought: can this be partially incorporated into the
concourse migratecommand?flyrequires some sort of login, but what if I only have the connection details to the db? It could be nice to have a read only UI, rather than full service downtime when doing a major version upgrade.xtremerui commentedon Apr 6, 2021
problem with concourse migration command is later if we move to use voyager, what do we do with this command? Not sure if it would fit into voyager as it contains business logic for Concourse components only.
clarafu commentedon Apr 6, 2021
Hm I was thinking that we could just document what components they would need to pause if they wanted to do a backup using
pg_dump.I think those extra flags is an interesting idea, I do like how it makes it so that the operator does not need to know about the workings of each component and what its responsibility is. The argument against it would be that the admin operator of concourse should know about each component and it might be nice for the fly command to be flexible enough for the operator to choose which components they need to pause/unpause. This was actually a motivation behind this components concept (#2473, #5480).
[-]Add fly command `set-db-protective` and `unset-db-protective`[/-][+]Add fly command to pause/unpause components[/+]aoldershaw commentedon Apr 14, 2021
It seems like the most common reason for failure during a
pg_dumpis builds finishing and their build event sequence being dropped. There is also the risk of a pipeline/team being deleted concurrently, but just pausing components won't help entirely with that unless we add adeleted_teamstable and corresponding GC component, which seems like overkill for a rare use-case, given that the workaround is just to retry the backup. Since deleting pipelines/teams is a voluntary thing, maybe it's reasonable to just recommend doing backups during off-hours when people won't be deleting stuff (probably the right call anyway).Just pausing the tracker also doesn't fix the issue with dropping sequences - when the tracker is paused, new builds won't be tracked, but existing builds will still run to completion.
So what if we just avoided that issue altogether by not dynamically creating/deleting sequences, and instead using a table like
build_event_countersthat just stores(build_id, event_id). When a build is created, weINSERT(build_id, 0). Whenever we would increment the sequence, we instead fetch-and-add theevent_idvia anUPDATE ... RETURNING event_id. When the build is finished, weDELETEthe row.Note that we shouldn't just add an
event_idcolumn tobuilds, since that'd yield a ton of dead tuples in thebuildstable and would require very frequentVACUUMing.WDYT?
xtremerui commentedon Apr 14, 2021
@aoldershaw yes this where we have to add some draining buffer and retry logic in this PR.
I like the idea of not creating/deleting sequences. In general we should try to avoid DDL operation, especially for things happens frequently like builds. Probably worth to open an issue as its own under this epic.
For the record though fly pause/unpause component is not only for the race condition problem, as mentioned above in #2473 and #5480
taylorsilva commentedon Jan 6, 2025
Issue Bankruptcy
This issue is being closed as part of 2025's Issue Bankruptcy declaration. See here for details
If you think this issue still has merit then feel free to open a new issue and reference this one.