summaryrefslogtreecommitdiff
path: root/db/schema.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '24386-8-14-rc1-requires-quite-amount-of-downtime' into 'master' Stan Hu2016-11-111-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update 8.14-rc1 migrations to minimize downtime and deploy time ## What does this MR do? Modify 8.14-rc1 migrations and code to minimize downtime and deploy time ## Are there points in the code the reviewer needs to double check? No ## Why was this MR needed? 8.14-rc1 migrations took too much time in staging, so we didn't want to take too much downtime in production ## Does this MR meet the acceptance criteria? - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if it does - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? Closes #24386 See merge request !7427
| * Update 8.14-rc1 migrations to minimize downtime and deploy timeAlejandro Rodríguez2016-11-111-1/+1
| | | | | | | | See https://gitlab.com/gitlab-org/gitlab-ce/issues/24386
* | Merge branch 'sidekiq-job-throttling' into 'master' Douwe Maan2016-11-111-0/+3
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow certain Sidekiq jobs to be throttled ## What does this MR do? Allows certain slow running Sidekiq jobs to be throttled. It is disabled by default and can be enabled via the Application Settings. ![Screen_Shot_2016-11-04_at_4.51.24_PM](/uploads/a1f1d24c693fcdb278602765cd404d94/Screen_Shot_2016-11-04_at_4.51.24_PM.png) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - Tests - [x] Added for this feature/bug - [x] All builds are passing ## What are the relevant issue numbers? Related to #23352 See merge request !7292
| * Allow the Sidekiq queues to throttle and the factor by which to throttle ↵Patricio Cano2016-11-101-0/+2
| | | | | | | | them to be configurable
| * Allow certain Sidekiq jobs to be throttledPatricio Cano2016-11-101-0/+1
| |
* | Fix project records with invalid visibility_level valuesNick Thomas2016-11-101-1/+1
|/ | | | | | | | | | | | | The AddVisibilityLevelToGroups migration introduced a visibility_level for namespaces and specified that projects should always have a visibility level less than or equal to their namespace. However, some invalid rows could have been created. This commit introduces a migration that updates the invalid rows, setting the invalid project to have the same visibility_level as their namespaces. This will make some projects internal or private when they would previously have been public or internal, but this is better than silently making an internal or private group public.
* Merge branch 'use-separate-token-for-incoming-email' into 'master' Douwe Maan2016-11-081-0/+2
|\ | | | | | | | | Use separate email-friendly token for incoming email See merge request !5914
| * implements reset incoming email token on issues modal and account page,use-separate-token-for-incoming-emailtiagonbotelho2016-11-071-2/+2
| | | | | | | | reactivates all tests and writes more tests for it
| * Use separate email-friendly token for incoming email and let incomingDouwe Maan2016-11-071-1/+3
| | | | | | | | email token be reset
* | Merge branch 'jacobvosmaer-gitlab/gitlab-ce-git-gc-improvements' into 'master' Douwe Maan2016-11-071-0/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | Use more than one kind of Git garbage collection Replaces https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6588 by @jacobvosmaer to get the builds to pass :) Closes #22729 See merge request !7321
| * | Refine Git garbage collectionJacob Vosmaer2016-11-041-0/+5
| | |
* | | Add an index for project_id in project_import_data to improveadd-project-import-data-indexStan Hu2016-11-061-1/+3
| |/ |/| | | | | | | | | | | | | | | | | performance We see that many slow queries on GitLab.com are dominated by finding the project import data for a specific project. Adding an index is the most straightforward way of fixing this. Closes #23748
* | Add setting to only allow merge requests to be merged when all discussions ↵Rodolfo Santos2016-11-041-0/+1
|/ | | | | | are resolved Signed-off-by: Rémy Coutable <remy@rymai.me>
* Allow multiple repository storage shards to be enabled, and automatically ↵Nick Thomas2016-11-041-2/+2
| | | | round-robin between them
* Merge branch 'use-optimistic-locking' into 'master' Stan Hu2016-10-281-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use optimistic locking ## What does this MR do? Removes the usage of pessimistic locking in favor of optimistic which is way cheaper and doesn't block database operation. Since this is very simple change it should be safe. If we receive `StaleObjectError` message we will reload object a retry operations in lock. However, I still believe that we need this one: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7005 as this will reduce a load on Database and FS. This changes a behavior from: ### Pesimistic locking (previous behavior) #### For updating 1. SELECT * FOR UPDATE (other updates wait on this) 2. we update ci_pipeline 3. latest_build_status 4. enqueue: (use: transition :created -> :pending) 5. [state_machine] we are in state created, we can go to pending 6. [state_machine] ci_pipeline.status = created 7. [state_machine] ci_pipeline.save 8. [state_machine] after_transition: (if for success): PipelineSuccessWorker on Sidekiq 9. release DB lock #### If no update is required 1. SELECT * FOR UPDATE (other updates wait on this) 2. we update ci_pipeline 3. latest_build_status 4. we are in pending, we can't transition to pending, because it's forbidden 5. release DB lock ### Optimistic locking (implemented by this MR) #### For updating 1. latest_build_status 2. enqueue: (use `transition :created -> :pending`) 3. [state_machine] we are in state created, we can go to pending 4. [state_machine] ci_pipeline.status = created 5. [state_machine] ci_pipeline.save 6. [state_machine] [save] where(lock_version: ci_pipeline.lock_version).update_all(status: :created, updated_at: Time.now) 7. [state_machine] [save] unless we_updated_row then raise ObjectInconsistentError #### If no update is required 1. we update ci_pipeline 2. latest_build_status 3. we are in pending, we can't transition to pending, because it's forbidden ## Why was this MR needed? We have been seeing a number of problems when we migrated Pipeline/Build processing to Sidekiq. Especially we started seeing a lot of blocking queries. We used a pessimistic locking which doesn't seem to be required. This effectively allows us to fix our issues with blocked queries by using more efficient method of operation. ## What are the relevant issue numbers? Issues: https://gitlab.com/gitlab-com/infrastructure/issues/623 and https://gitlab.com/gitlab-com/infrastructure/issues/584, but also there's a bunch of Merge Requests that try to improve behavior of scheduled jobs. cc @pcarranza @yorickpeterse @stanhu See merge request !7040
| * Use optimistic lockingKamil Trzcinski2016-10-261-0/+2
| |
* | Finish updates to use JIRA gemFelipe Artur2016-10-261-1/+1
|/ | | | Code improvements, bug fixes, finish documentation and specs
* Fix reply-by-email not working due to queue name mismatchsh-fix-mailroom-configStan Hu2016-10-231-1/+1
| | | | | | | | | | mail_room was configured to deliver mail to the `incoming_email` queue while `EmailReceiveWorker` was reading the `email_receiver` queue. Adds a migration that repeats the work of a previous migration to ensure all mails that wound up in the old queue get processed. Closes #23689
* Fix project member access levelsfix_project_member_access_levelsValery Sizov2016-10-211-1/+1
|
* Create project feature when project is createdissue_22944Felipe Artur2016-10-191-1/+1
|
* Split migration to create label prioritiesDouglas Barbosa Alexandre2016-10-191-1/+1
|
* Add label type to group and project labels listsDouglas Barbosa Alexandre2016-10-191-3/+2
|
* Add LabelPriority modelDouglas Barbosa Alexandre2016-10-191-2/+13
|
* Add GroupLabel modelDouglas Barbosa Alexandre2016-10-191-0/+4
|
* Merge remote-tracking branch 'origin/master' into 22191-delete-dynamic-envs-mr22191-delete-dynamic-envs-mrKamil Trzcinski2016-10-181-0/+1
|\
| * Add visibility level to project repositoryissue_19734_2Felipe Artur2016-10-171-1/+2
| |
* | Add on_stop column [ci skip]Kamil Trzcinski2016-10-171-1/+1
| |
* | Update `db/schema.rb`Kamil Trzcinski2016-10-171-1/+2
| |
* | Refactor code to use available and stopped statuses and refactor views to ↵Kamil Trzcinski2016-10-171-10/+1
| | | | | | | | use separate renders
* | Merge remote-tracking branch 'origin/master' into 22191-delete-dynamic-envs-mrKamil Trzcinski2016-10-171-564/+600
|\ \ | |/
| * Use activerecord_sane_schema_dumperRémy Coutable2016-10-121-587/+587
| | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * Precalculate trending projectsprecalculate-trending-projectsYorick Peterse2016-10-101-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a Sidekiq worker that precalculates the list of trending projects on a daily basis. The resulting set is stored in a database table that is then queried by Project.trending. This setup means that Unicorn workers no longer _may_ have to calculate the list of trending projects. Furthermore it supports filtering without any complex caching mechanisms. The data in the "trending_projects" table is inserted in the same order as the project ranking. This means that getting the projects in the correct order is simply a matter of: SELECT projects.* FROM projects INNER JOIN trending_projects ON trending_projects.project_id = projects.id ORDER BY trending_projects.id ASC; Such a query will only take a few milliseconds at most (as measured on GitLab.com), opposed to a few seconds for the query used for calculating the project ranks. The migration in this commit does not require downtime and takes care of populating an initial list of trending projects.
| * Add markdown cache columns to the database, but don't use them yetNick Thomas2016-10-071-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | This commit adds a number of _html columns and, with the exception of Note, starts updating them whenever the content of their partner fields changes. Note has a collision with the note_html attr_accessor; that will be fixed later A background worker for clearing these cache columns is also introduced - use `rake cache:clear` to set it off. You can clear the database or Redis caches separately by running `rake cache:clear:db` or `rake cache:clear:redis`, respectively.
* | Allow to close environmentsKamil Trzcinski2016-10-061-2/+3
|/
* Add organization field to user profileDmitriy Zaporozhets2016-09-271-1/+2
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Add index on labels titleAhmad Sherif2016-09-231-1/+2
|
* Update db/schema.rb per most recent migrationsupdate-db-schemaYorick Peterse2016-09-211-4/+5
| | | | | It seems this wasn't updated properly when migrations were added in a previous commit.
* Update schema.rbTimothy Andrew2016-09-201-12/+12
|
* Merge remote-tracking branch 'origin/master' into 21170-cycle-analyticsTimothy Andrew2016-09-201-3/+6
|\
| * Merge branch 'master' into per-build-tokenKamil Trzcinski2016-09-191-4/+5
| |\
| | * Added missing db/schema changesKamil Trzcinski2016-09-191-1/+2
| | |
| | * Merge branch 'increase_artifact_size_column' into 'master' Yorick Peterse2016-09-161-2/+2
| | |\ | | | | | | | | | | | | | | | | Increase ci_builds artifacts_size column to 8-byte integer to allow larger files See merge request !6333
| | | * Increase ci_builds artifacts_size column to 8-byte integer to allow larger filesDrew Blessing2016-09-151-2/+2
| | | |
| | * | Added group-specific setting for LFS.Patricio Cano2016-09-151-0/+1
| | |/ | | | | | | | | | Groups can enable/disable LFS, but this setting can be overridden at the project level. Admin only
| * | Merge remote-tracking branch 'origin/master' into per-build-tokenKamil Trzcinski2016-09-151-2/+2
| |\ \ | | |/ | | | | | | | | | # Conflicts: # db/schema.rb
| | * Move pushes_since_gc to Redispushes-since-gc-redisYorick Peterse2016-09-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Update db/schema.rbKamil Trzcinski2016-09-131-1/+3
| |/
| * Fix DB schema to match latest migrationsh-update-db-schemaStan Hu2016-09-081-1/+1
| |
* | Improve performance of the cycle analytics page.Timothy Andrew2016-09-151-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. These changes bring down page load time for 100 issues from more than a minute to about 1.5 seconds. 2. This entire commit is composed of these types of performance enhancements: - Cache relevant data in `IssueMetrics` wherever possible. - Cache relevant data in `MergeRequestMetrics` wherever possible. - Preload metrics 3. Given these improvements, we now only need to make 4 SQL calls: - Load all issues - Load all merge requests - Load all metrics for the issues - Load all metrics for the merge requests 4. A list of all the data points that are now being pre-calculated: a. The first time an issue is mentioned in a commit - In `GitPushService`, find all issues mentioned by the given commit using `ReferenceExtractor`. Set the `first_mentioned_in_commit_at` flag for each of them. - There seems to be a (pre-existing) bug here - files (and therefore commits) created using the Web CI don't have cross-references created, and issues are not closed even when the commit title is "Fixes #xx". b. The first time a merge request is deployed to production When a `Deployment` is created, find all merge requests that were merged in before the deployment, and set the `first_deployed_to_production_at` flag for each of them. c. The start / end time for a merge request pipeline Hook into the `Pipeline` state machine. When the `status` moves to `running`, find the merge requests whose tip commit matches the pipeline, and record the `latest_build_started_at` time for each of them. When the `status` moves to `success`, record the `latest_build_finished_at` time. d. The merge requests that close an issue - This was a big cause of the performance problems we were having with Cycle Analytics. We need to use `ReferenceExtractor` to make this calculation, which is slow when we have to run it on a large number of merge requests. - When a merge request is created, updated, or refreshed, find the issues it closes, and create an instance of `MergeRequestsClosingIssues`, which acts as a join model between merge requests and issues. - If a `MergeRequestsClosingIssues` instance links a merge request and an issue, that issue closes that merge request. 5. The `Queries` module was changed into a class, so we can cache the results of `issues` and `merge_requests_closing_issues` across various cycle analytics stages. 6. The code added in this commit is untested. Tests will be added in the next commit.
* | Merge remote-tracking branch 'origin/master' into 21170-cycle-analyticsTimothy Andrew2016-09-071-46/+40
|\ \ | |/