gerhard
(Gerhard Schlager)
14 Gennaio 2020, 2:09pm
42
I recently made lots of improvements to the restore process and a couple more are planned. The pull request contains a high level description of the changes.
master ← gschlager:backup_refactor
merged 10:41AM - 14 Jan 20 UTC
Lots of refactoring to make the code easier to test as well as fixing of bugs an… d doing some house cleaning.
The highlights are:
* `Restorer` has been split up into multiple classes to allow easier testing with as little stubbing as possible.
* All backups are directly restored into the `public` schema, because only very old database dumps can be restored into the `backup` schema. This simplifies that part of the restore process a lot.
* Restoring into PostgreSQL 11+ works.
* Better error handling and detection during the restore of the database dump.
* Restoring of backups from all major versions since v1.1 has been tested and various bugs for older versions have been fixed.
* The restore process really waits for Sidekiq to pause instead of just claiming that it does.
* Bugs in remapping of uploads have been fixed and there are tons of tests for it.
* Less disk space needed during restore, because uploads do not get copied before the migration to S3 anymore.
* Database runs as a new system process (`rake db:migrate`) instead of using the same process as the restore. This should fix a couple of weird bugs related to DB migrations. It's always migrating to the latest available DB migration (including plugin and post migrations). That simplifies that part of the code by a lot and prevents issues we previously saw with plugin migrations or missing post migrations.
* Most of the logic of the `migrate_to_s3` rake task was moved into the `ToS3Migration` class. This should make it easier to add tests in the future. All `exit` calls were replaced with exceptions to make it easier to handle exceptions during the restore process.
* Lots of other, smaller bugfixes and improvements.
* Roughly 200 new specs.
I’m closing this bug report as fixed. Please create a new bug report when you encounter an error during a restore and you are using the tests-passed version of Discourse.
8 Mi Piace