-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Check that auto_vacuum
is disabled when porting a SQLite database to Postgres, as VACUUM
s must not be performed between runs of the script.
#13195
Conversation
Signed-off-by: Olivier Wilkinson (reivilibre) <[email protected]>
6686191
to
2846b88
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.
Happy with the changes, just a few questions.
The portdb script relies on rowids being consistent.
Can you point me to the relevant source code here?
" be used if the database could be vacuumed between re-runs.\n" | ||
" To disable auto_vacuum, you need to stop Synapse and run the following SQL:\n" | ||
" PRAGMA auto_vacuum=off;\n" | ||
" VACUUM;" |
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.
Why do you need to vacuum here after disabling autovacuum? To ensure there is no vacuum in progress when the script runs?
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.
You can't change the auto_vacuum
setting without VACUUM
ing if there are existing tables
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.
You can't change the
auto_vacuum
setting withoutVACUUM
ing if there are existing tables
Does that mean the vacuum should happen first?
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.
No; you set the PRAGMA then VACUUM to make it take effect.
An example line is synapse/synapse/_scripts/synapse_port_db.py Line 421 in b036685
but feel free to look all over the script — the tables that are being migrated are paginated by rowid. Notable is the |
The portdb script relies on
rowid
s being consistent.VACUUM
does not uphold that.auto_vacuum
is not enabled by default (unless SQLite was compiled with an option to make it default), but I'm aware thatsome community members manually VACUUM and I wouldn't be surprised if some of them enabled
auto_vacuum
themselves.Doing so is dangerous for the portdb script as it means that some rows may be omitted from the copy.
For safety's sake, let's prohibit
auto_vacuum
when porting a database and document that manualVACUUM
are also not to be done.