diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-05-22 20:07:28 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-05-22 20:07:28 +0800 |
commit | c2bd48fadf505c83c90b3e10a1385e9be0d803e0 (patch) | |
tree | ba2251ad80567e89ddfba1a3059a3413797877fa | |
parent | 539d9a0044ec82b5526031eed2e749476022e7e8 (diff) | |
download | gitlab-ce-c2bd48fadf505c83c90b3e10a1385e9be0d803e0.tar.gz |
Resolve conflicts, using changes from master
-rw-r--r-- | db/post_migrate/20170503004427_upate_retried_for_ci_build.rb | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/db/post_migrate/20170503004427_upate_retried_for_ci_build.rb b/db/post_migrate/20170503004427_upate_retried_for_ci_build.rb index ab43dd923d2..3096c54acb7 100644 --- a/db/post_migrate/20170503004427_upate_retried_for_ci_build.rb +++ b/db/post_migrate/20170503004427_upate_retried_for_ci_build.rb @@ -2,31 +2,12 @@ class UpateRetriedForCiBuild < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = false - + disable_ddl_transaction! def up disable_statement_timeout -<<<<<<< HEAD - latest_id = <<-SQL.strip_heredoc - SELECT MAX(ci_builds2.id) - FROM ci_builds ci_builds2 - WHERE ci_builds.commit_id=ci_builds2.commit_id - AND ci_builds.name=ci_builds2.name - SQL - - # This is slow update as it does single-row query - # This is designed to be run as idle, or a post deployment migration - is_retried = Arel.sql("((#{latest_id}) != ci_builds.id)") - - update_column_in_batches(:ci_builds, :retried, is_retried) do |table, query| - query.where(table[:retried].eq(nil)) - end - end - - def down -======= if Gitlab::Database.mysql? up_mysql else @@ -40,7 +21,7 @@ class UpateRetriedForCiBuild < ActiveRecord::Migration private def up_mysql - # This is a trick to overcome MySQL limitation: + # This is a trick to overcome MySQL limitation: # Mysql2::Error: Table 'ci_builds' is specified twice, both as a target for 'UPDATE' and as a separate source for data # However, this leads to create a temporary table from `max(ci_builds.id)` which is slow and do full database update execute <<-SQL.strip_heredoc @@ -81,6 +62,5 @@ class UpateRetriedForCiBuild < ActiveRecord::Migration if Gitlab::Database.postgresql? execute 'DROP INDEX CONCURRENTLY IF EXISTS index_for_ci_builds_retried_migration' end ->>>>>>> 7f31768... Merge branch 'fix-retried-for-mysql' into 'master' end end |