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
The maximum number of simultaneously open files in macOS has a very low default. To the point where it can make codd barf just by having a few hundred migrations to apply. Even if this can be fixed with ulimit, it seems sensible for codd to avoid this in the first place, as it's possible without great effort, and who knows which environments out there might have similarly stringent limits.
Codd should open one file at a time, closing the previous file before opening the next (codd already does that for on-disk representations, but not for migrations).
We should be able to do this in a single pass, i.e. no need to read each file twice. But let's assume a nasty case where some migration is invalid. By the time codd finds out it may have applied and even committed other migrations. Codd can parse even invalid SQL, but it cannot accept invalid -- codd top-level comments, and for good reason: we don't want to silently treat something as a regular comment just because the user mistyped what they intended to be a special codd directive in the first place.
One argument against adding two passes is that such migrations should not make it into the migration folders because codd add would flag them.
In the end, we should probably go with whatever is easier to implement.
It would also be nice to test this. Maybe we mock file operations? Maybe we strace and ensure no two .sql files are open at the same time? The latter would be fool-proof and wouldn't complicate the codebase, and it could also be used to ensure the same applies to on-disk representations, so it is tempting..
The text was updated successfully, but these errors were encountered:
This was fixed by #173, and it's actually nice that migration headers are parsed once to detect errors, and then parsed again when necessary to be applied.
The maximum number of simultaneously open files in macOS has a very low default. To the point where it can make codd barf just by having a few hundred migrations to apply. Even if this can be fixed with
ulimit
, it seems sensible for codd to avoid this in the first place, as it's possible without great effort, and who knows which environments out there might have similarly stringent limits.Codd should open one file at a time, closing the previous file before opening the next (codd already does that for on-disk representations, but not for migrations).
We should be able to do this in a single pass, i.e. no need to read each file twice. But let's assume a nasty case where some migration is invalid. By the time codd finds out it may have applied and even committed other migrations. Codd can parse even invalid SQL, but it cannot accept invalid
-- codd
top-level comments, and for good reason: we don't want to silently treat something as a regular comment just because the user mistyped what they intended to be a special codd directive in the first place.One argument against adding two passes is that such migrations should not make it into the migration folders because
codd add
would flag them.In the end, we should probably go with whatever is easier to implement.
It would also be nice to test this. Maybe we mock file operations? Maybe we
strace
and ensure no two.sql
files are open at the same time? The latter would be fool-proof and wouldn't complicate the codebase, and it could also be used to ensure the same applies to on-disk representations, so it is tempting..The text was updated successfully, but these errors were encountered: