diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-09-13 19:28:45 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-09-13 23:27:51 +0300 |
commit | 4e87c02313241b1e0d36560a11014cb4b7992403 (patch) | |
tree | a62fc802d87f503bc7b7b6dc5113d4dab1d3f241 /db/migrate | |
parent | a0c46221626ae367c3da68e38a6d5dde7dda32db (diff) |
Move pushes_since_gc to Redis
This moves tracking of the pushes since the last Git GC from PostgreSQL
to Redis. This reduces the number of writes on the "projects" table.
This in turn reduces the vacuuming overhead.
The lease used for incrementing the counter has been removed. This lease
was mostly put in place to prevent high database load but this isn't
needed anymore due to the counter now being stored in Redis.
Fixes gitlab-org/gitlab-ce#22125
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20160913162434_remove_projects_pushes_since_gc.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb b/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb new file mode 100644 index 00000000000..c5b8c35e961 --- /dev/null +++ b/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb @@ -0,0 +1,19 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class RemoveProjectsPushesSinceGc < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = true + DOWNTIME_REASON = 'This migration removes an existing column' + + disable_ddl_transaction! + + def up + remove_column :projects, :pushes_since_gc + end + + def down + add_column_with_default! :projects, :pushes_since_gc, :integer, default: 0 + end +end |