Commit e2862180 authored by Stan Hu's avatar Stan Hu

Fix backups not working when feature_flags table does not exist

Previously this would fail if you attempted to restore the database:

```
RAILS_ENV=test bundle exec rake db:reset
RAILS_ENV=test bundle exec rake gitlab:backup:db:create
RAILS_ENV=test bundle exec rake gitlab:db:drop_tables
RAILS_ENV=test bundle exec rake gitlab:backup:db:restore
```

The last step would attempt to read `backup_information.yml` and fail
because the file isn't generated in the `gitlab:backup:db:create`
task. We can disable the reading of that file since it's only needed
in the `gitlab:backup:create` task.

In addition, the third step is optional. Since the `feature_flags`
table does not exist, the feature flag check that happened in the last
step would fail.

Changelog: fixed
parent b17b71f0
......@@ -144,7 +144,6 @@ module Backup
def run_restore_task(task_name)
definition = @definitions[task_name]
read_backup_information
puts_time "Restoring #{definition.task.human_name} ... ".color(:blue)
unless definition.task.enabled
......@@ -483,7 +482,7 @@ module Backup
end
def repository_backup_strategy(incremental)
if Feature.enabled?(:gitaly_backup, default_enabled: :yaml)
if !Feature.feature_flags_available? || Feature.enabled?(:gitaly_backup, default_enabled: :yaml)
max_concurrency = ENV['GITLAB_BACKUP_MAX_CONCURRENCY'].presence
max_storage_concurrency = ENV['GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY'].presence
Backup::GitalyBackup.new(progress, incremental: incremental, max_parallelism: max_concurrency, storage_parallelism: max_storage_concurrency)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment