ariga / atlas

Manage your database schema as code
https://atlasgo.io
Apache License 2.0
5.77k stars 260 forks source link

Add support for specifying lock timeout for declarative workflow #2915

Open tonycosentini opened 3 months ago

tonycosentini commented 3 months ago

(Sorry if this exists, I couldn't find it when searching through the docs/source.)

Is it possible to add an option to set the lock timeout for atlas schema apply?

I have a use case for some high write-throughput tables where we need to run with a very low lock timeout to prevent performance issues (basically we use this workflow with a low lock timeout that retries until it can safely get the lock and apply the change).

a8m commented 3 months ago

Hey! If you're using the latest builds (and logged in), you can use the migration hooks for the declarative workflow as well - I'll update the docs.

Let me know if this helps, or you need more assistance.

tonycosentini commented 3 months ago

Are there no plans to just have a plain old parameter like --lock-timeout in the migrations-based flow?

a8m commented 3 months ago

The lock-timeout defines the maximum duration that Atlas waits to acquire an advisory lock before starting the migration, ensuring that there are no concurrent runs. It does not set the session/transaction lock_timeout.

This flag name is ambiguous, so I think we should change it to wait_timeout instead.