summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-09-13 18:28:45 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2016-09-13 22:27:51 +0200
commit4e87c02313241b1e0d36560a11014cb4b7992403 (patch)
treea62fc802d87f503bc7b7b6dc5113d4dab1d3f241 /db/migrate
parenta0c46221626ae367c3da68e38a6d5dde7dda32db (diff)
downloadgitlab-ce-4e87c02313241b1e0d36560a11014cb4b7992403.tar.gz
Move pushes_since_gc to Redispushes-since-gc-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.rb19
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