summaryrefslogtreecommitdiff
path: root/db/fixtures
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-11-24 10:40:44 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-11-25 13:35:01 +0100
commit92b2c74ce14238c1032bd9faac6d178d25433532 (patch)
treed17f91f55068655b0fd7c1297ae4dce7311d9485 /db/fixtures
parent3943e632103271b3683e0cc355f0fef4c9452491 (diff)
downloadgitlab-ce-92b2c74ce14238c1032bd9faac6d178d25433532.tar.gz
Refresh project authorizations using a Redis leaserefresh-authorizations-with-lease
When I proposed using serializable transactions I was hoping we would be able to refresh data of individual users concurrently. Unfortunately upon closer inspection it was revealed this was not the case. This could result in a lot of queries failing due to serialization errors, overloading the database in the process (given enough workers trying to update the target table). To work around this we're now using a Redis lease that is cancelled upon completion. This ensures we can update the data of different users concurrently without overloading the database. The code will try to obtain the lease until it succeeds, waiting at least 1 second between retries. This is necessary as we may otherwise end up _not_ updating the data which is not an option.
Diffstat (limited to 'db/fixtures')
-rw-r--r--db/fixtures/development/04_project.rb1
-rw-r--r--db/fixtures/development/06_teams.rb1
-rw-r--r--db/fixtures/development/17_cycle_analytics.rb1
-rw-r--r--db/fixtures/support/serialized_transaction.rb9
4 files changed, 0 insertions, 12 deletions
diff --git a/db/fixtures/development/04_project.rb b/db/fixtures/development/04_project.rb
index 18a2df7c059..a984eda5ab5 100644
--- a/db/fixtures/development/04_project.rb
+++ b/db/fixtures/development/04_project.rb
@@ -1,5 +1,4 @@
require 'sidekiq/testing'
-require './db/fixtures/support/serialized_transaction'
Sidekiq::Testing.inline! do
Gitlab::Seeder.quiet do
diff --git a/db/fixtures/development/06_teams.rb b/db/fixtures/development/06_teams.rb
index 04c3690e152..5c2a03fec3f 100644
--- a/db/fixtures/development/06_teams.rb
+++ b/db/fixtures/development/06_teams.rb
@@ -1,5 +1,4 @@
require 'sidekiq/testing'
-require './db/fixtures/support/serialized_transaction'
Sidekiq::Testing.inline! do
Gitlab::Seeder.quiet do
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb
index 7b3908fae98..916ee8dbac8 100644
--- a/db/fixtures/development/17_cycle_analytics.rb
+++ b/db/fixtures/development/17_cycle_analytics.rb
@@ -1,6 +1,5 @@
require 'sidekiq/testing'
require './spec/support/test_env'
-require './db/fixtures/support/serialized_transaction'
class Gitlab::Seeder::CycleAnalytics
def initialize(project, perf: false)
diff --git a/db/fixtures/support/serialized_transaction.rb b/db/fixtures/support/serialized_transaction.rb
deleted file mode 100644
index d3305b661e5..00000000000
--- a/db/fixtures/support/serialized_transaction.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'gitlab/database'
-
-module Gitlab
- module Database
- def self.serialized_transaction
- connection.transaction { yield }
- end
- end
-end