summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2018-02-08 10:17:00 -0800
committerMichael Kozono <mkozono@gmail.com>2018-02-12 10:44:15 -0800
commit67d310a1a640088d497843ec8dce3f16eb285d2d (patch)
treef2ea00284eaeb700466e98954a0489e27a2ec7e0 /lib
parentf917fc5d76d39fb17fda2678d5270407595f0128 (diff)
downloadgitlab-ce-67d310a1a640088d497843ec8dce3f16eb285d2d.tar.gz
Fix orphan temp table untracked_files_for_uploads
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/background_migration/prepare_untracked_uploads.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/background_migration/prepare_untracked_uploads.rb b/lib/gitlab/background_migration/prepare_untracked_uploads.rb
index 3aa4caf1841..298de005b9b 100644
--- a/lib/gitlab/background_migration/prepare_untracked_uploads.rb
+++ b/lib/gitlab/background_migration/prepare_untracked_uploads.rb
@@ -43,7 +43,11 @@ module Gitlab
store_untracked_file_paths
- schedule_populate_untracked_uploads_jobs
+ if UntrackedFile.all.empty?
+ drop_temp_table
+ else
+ schedule_populate_untracked_uploads_jobs
+ end
end
private
@@ -165,6 +169,11 @@ module Gitlab
bulk_queue_background_migration_jobs_by_range(
UntrackedFile, FOLLOW_UP_MIGRATION)
end
+
+ def drop_temp_table
+ UntrackedFile.connection.drop_table(:untracked_files_for_uploads,
+ if_exists: true)
+ end
end
end
end