-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
sql: enable auto_vacuum on all connections #2955
Conversation
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.
thanks a lot for taking care!
not totally sure i understand all side-effects totally, however, some things turn out to be visible during testing only, so it probably makes sense to get things in and move forward. we can revert and improve any time.
The point of having this pragma enabled on all connections is to ensure that when we execute VACUUM, no matter on which connection it happens, we enable auto_vacuum. This can't be merged as is though, it fails random tests with "database is locked" error on CI currently. |
wondering what is happening here. databases used for ci are only a few kb large and even a full VACUUM should take only a ms or so. |
Auto vacuum is not really important right now, it is enabled for new databases (with a test for it) and for existing databases if it's not enabled worst case is that the database never shrinks in size except on VACUUM, but the space is still reused by the database itself. |
38dcd0e
to
737d0d1
Compare
Dropping sqlite connection pool does not result in actually closing connections immediately. On windows this is a problem, because files remain locked for some time after drop. As a workaround, migration test and account removal now has a 5 second sleep to ensure all connections are actually closed :/ There is an open bugreport about this in r2d2: sfackler/r2d2#99 |
I guess as a workaround when we try to rename files or delete files, we should sleep 1 second and retry up to 5 times or something like this. |
2669b53
to
f3e360e
Compare
f3e360e
to
6268464
Compare
Waiting for #3229 to be merged and a similar fix for migrate_account is needed. |
3d9c619
to
2dd6bd4
Compare
If this is still true and the PR triggers issues in tests the i think this can be put to project resurrection. It would become more important if we put blob files into the same database used for messages, networking etc. And then only for older databases. New databases are created with auto-vaccum as noted in the quote. |
ebcfe62
to
0a0f241
Compare
4a09e01
to
f7eeb15
Compare
Now with #4043 tests pass. |
f7eeb15
to
ac12a58
Compare
In execute_migration transaction first update the version, and only then execute the rest of the migration. This ensures that transaction is immediately recognized as write transaction and there is no need to promote it from read transaction to write transaction later, e.g. in the case of "DROP TABLE IF EXISTS" that is a read only operation if the table does not exist. Promoting a read transaction to write transaction may result in an error if database is locked.
ac12a58
to
92f08ec
Compare
92f08ec
to
7d2cca8
Compare
Trying to enable auto_vacuum on all connections