summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/migration_helpers.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-06-15 17:04:07 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2016-06-15 17:04:07 +0200
commit816c453558c6d25fd8724bd3fe08e6fd221f2887 (patch)
treef4ff1664f6bf0e8cc64c92f05f973b8b1927b580 /lib/gitlab/database/migration_helpers.rb
parent8966263e0c738e85d8872aee0bfcf7fbe77b22a6 (diff)
downloadgitlab-ce-816c453558c6d25fd8724bd3fe08e6fd221f2887.tar.gz
Don't update columns in batches in a transaction
This ensures that whatever locks are acquired aren't held onto until the end of the transaction (= after _all_ rows have been updated). Timing wise there's also no difference between using a transaction and not using one.
Diffstat (limited to 'lib/gitlab/database/migration_helpers.rb')
-rw-r--r--lib/gitlab/database/migration_helpers.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb
index a87c9b038ae..909ff8677cb 100644
--- a/lib/gitlab/database/migration_helpers.rb
+++ b/lib/gitlab/database/migration_helpers.rb
@@ -138,11 +138,9 @@ module Gitlab
end
begin
- transaction do
- update_column_in_batches(table, column, default, &block)
+ update_column_in_batches(table, column, default, &block)
- change_column_null(table, column, false) unless allow_null
- end
+ change_column_null(table, column, false) unless allow_null
# We want to rescue _all_ exceptions here, even those that don't inherit
# from StandardError.
rescue Exception => error # rubocop: disable all