Commit Graph

502 Commits

Author SHA1 Message Date
Jacob Vosmaer e5fecc3a37 Create repositories via Gitaly 2017-09-29 18:27:06 +02:00
Gabriel Mazetto f4de14d71f
Add support to migrate existing projects to Hashed Storage async 2017-09-28 16:32:14 +01:00
Yorick Peterse 3e999684f9
Memoize pipelines for project download buttons
This adds Project#latest_successful_pipeline_for and
Project#latest_successful_pipeline_for_default_branch. The 2nd method
memoizes the result (taking nil values into account) to ensure the
underlying query isn't executed multiple times when viewing a project's
homepage.

See https://gitlab.com/gitlab-org/gitlab-ce/issues/36878#note_40073607
for more information.
2017-09-14 13:20:05 +02:00
Kamil Trzcinski 83c1bb688c Add has_auto_devops_implicitly_disabled 2017-09-07 15:08:51 +02:00
Kamil Trzcinski 632f6ba267 Add tests to cover all introduced changes 2017-09-06 21:00:34 +02:00
Zeger-Jan van de Weg 8189347b49
Merge branch 'master' into zj-auto-devops-table 2017-09-06 15:16:38 +02:00
Rubén Dávila 66cfb901c0 Optimize SQL queries used in Groups::GroupMembersController#create
The following optimizations were performed:

- Add new association to GroupMember and ProjectMember

  This new association will allow us to check if a user is a member of a
  Project or Group through a single query instead of two.

- Optimize retrieving of Members when adding multiple Users
2017-09-05 15:54:07 -05:00
Zeger-Jan van de Weg bcd70c4c46
Incorporate review 2017-09-04 15:44:46 +02:00
Marin Jankovski 28060caa0a
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2017-09-01 09:21:18 +02:00
Grzegorz Bizon d5d2497643 Merge branch 'zj-disable-pages-in-subgroups' into 'master'
Don't show references to Pages when not available

Closes #34864

See merge request !13888
2017-08-31 12:59:29 +00:00
Marin Jankovski 7d38df306c
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2017-08-31 10:45:28 +02:00
Zeger-Jan van de Weg 04cd47dd5a
Don't show references to Pages when not available
In this instance its subgroups, and given we can't deploy it, we
shouldn't allow it to be shown.

Fixes gitlab-org/gitlab-ce#34864
2017-08-31 09:27:42 +02:00
Lin Jen-Shin 3a4da8ce8b Fix tests 2017-08-28 18:51:23 +08:00
Gabriel Mazetto 8f178c4222 Prevent new / renamed project from using a repository path that already exists on disk
There are some redundancies in the validation steps, and that is to
preserve current error messages behavior

Also few specs have to be changed in order to fix madness in validation
logic.
2017-08-25 20:06:06 +02:00
Lin Jen-Shin 932d32515a Move to Projects::HousecleaningService 2017-08-24 18:58:31 +08:00
Lin Jen-Shin 140ac8d2ad Add changelog and tests 2017-08-23 21:51:21 +08:00
Gabriel Mazetto fb9e059a41 Make sure repository's removal work for legacy and hashed storages 2017-08-22 06:33:20 +02:00
Gabriel Mazetto 02737b8508 Use `@hashed` prefix for hashed paths on disk, to avoid collision with existing ones 2017-08-22 06:33:20 +02:00
Gabriel Mazetto d17a7be830 Refactor project and storage types 2017-08-22 06:33:20 +02:00
Gabriel Mazetto de89dcc213 Some codestyle changes and fixes for GitLab pages 2017-08-22 06:33:20 +02:00
Gabriel Mazetto fff5ebdcae Removed some useless code, codestyle changes and removed an index 2017-08-22 06:33:20 +02:00
Gabriel Mazetto e7a060321f Moving away from the "extend" based factory to a more traditional one.
Using `extend` dynamically can lead to bad performance as it
invalidates the method's cache.
2017-08-22 06:33:20 +02:00
Gabriel Mazetto 9e6fa996ea New storage is now "Hashed" instead of "UUID" 2017-08-22 06:33:20 +02:00
Douwe Maan 91d3e6d901 Merge branch 'ee-2628-backport-to-ce' into 'master'
Backports EE mirror stuck handling feature…

See merge request !13627
2017-08-17 13:53:39 +00:00
Tiago Botelho f865b1b459 Backports EE mirror stuck handling feature (https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2628) to CE 2017-08-17 13:38:05 +01:00
Nick Thomas c9856e53ea Run remove_pages in a run_after_commit block 2017-08-17 11:44:09 +01:00
Nick Thomas 0de85b5319 Remove a wat in NamespacelessProjectDestroyWorker 2017-08-17 11:30:07 +01:00
Yorick Peterse aef9f1eb94
Cache the number of forks of a project
The number of forks of a project doesn't change very frequently and
running a COUNT(*) every time this information is requested can be quite
expensive. We also end up running such a COUNT(*) query at least twice
on the homepage of a project.

By caching this data and refreshing it when necessary we can reduce
project homepage loading times by around 60 milliseconds (based on the
timings of https://gitlab.com/gitlab-org/gitlab-ce).
2017-08-14 18:00:28 +02:00
Sean McGivern e80a893ff0 Merge branch 'split-events-into-push-events' into 'master'
Use a separate table for storing push events

See merge request !12463
2017-08-11 14:40:03 +00:00
Robert Speicher c8b802471b Enable the RSpec/HookArgument cop and auto-correct offenses 2017-08-10 19:29:42 -04:00
Yorick Peterse 0395c47193
Migrate events into a new format
This commit migrates events data in such a way that push events are
stored much more efficiently. This is done by creating a shadow table
called "events_for_migration", and a table called "push_event_payloads"
which is used for storing push data of push events. The background
migration in this commit will copy events from the "events" table into
the "events_for_migration" table, push events in will also have a row
created in "push_event_payloads".

This approach allows us to reclaim space in the next release by simply
swapping the "events" and "events_for_migration" tables, then dropping
the old events (now "events_for_migration") table.

The new table structure is also optimised for storage space, and does
not include the unused "title" column nor the "data" column (since this
data is moved to "push_event_payloads").

== Newly Created Events

Newly created events are inserted into both "events" and
"events_for_migration", both using the exact same primary key value. The
table "push_event_payloads" in turn has a foreign key to the _shadow_
table. This removes the need for recreating and validating the foreign
key after swapping the tables. Since the shadow table also has a foreign
key to "projects.id" we also don't have to worry about orphaned rows.

This approach however does require some additional storage as we're
duplicating a portion of the events data for at least 1 release. The
exact amount is hard to estimate, but for GitLab.com this is expected to
be between 10 and 20 GB at most. The background migration in this commit
deliberately does _not_ update the "events" table as doing so would put
a lot of pressure on PostgreSQL's auto vacuuming system.

== Supporting Both Old And New Events

Application code has also been adjusted to support push events using
both the old and new data formats. This is done by creating a PushEvent
class which extends the regular Event class. Using Rails' Single Table
Inheritance system we can ensure the right class is used for the right
data, which in this case is based on the value of `events.action`. To
support displaying old and new data at the same time the PushEvent class
re-defines a few methods of the Event class, falling back to their
original implementations for push events in the old format.

Once all existing events have been migrated the various push event
related methods can be removed from the Event model, and the calls to
`super` can be removed from the methods in the PushEvent model.

The UI and event atom feed have also been slightly changed to better
handle this new setup, fortunately only a few changes were necessary to
make this work.

== API Changes

The API only displays push data of events in the new format. Supporting
both formats in the API is a bit more difficult compared to the UI.
Since the old push data was not really well documented (apart from one
example that used an incorrect "action" nmae) I decided that supporting
both was not worth the effort, especially since events will be migrated
in a few days _and_ new events are created in the correct format.
2017-08-10 17:45:44 +02:00
Rémy Coutable c946ee1282
Enable the Layout/SpaceBeforeBlockBraces cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-08-09 11:52:22 +02:00
blackst0ne 98535fc12c Add checks for branch existence before changing HEAD 2017-08-08 12:10:55 +11:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Robert Speicher 9513bd18c4 Ensure all project factories use `:repository` trait or `:empty_project` 2017-08-01 14:51:52 -04:00
Sean McGivern 90cb2aab38 Merge branch '28283-legacy-storage-format' into 'master'
[CE] Added Legacy Storage format

See merge request !13149
2017-08-01 12:24:24 +00:00
Gabriel Mazetto c6dee99803 Rename path_with_namespace -> disk_path when dealing with the filesystem 2017-08-01 07:26:58 +02:00
Gabriel Mazetto abb878326c Rename many path_with_namespace -> full_path 2017-08-01 07:26:58 +02:00
Michael Kozono f5fc912b33 Exclude keys linked to other projects 2017-07-28 14:48:39 -07:00
Rémy Coutable cddc5cacfb Use described_class when possible
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Jarka Kadlecova 7bee7b848a Support both internal and external issue trackers 2017-07-24 08:13:43 +02:00
Alexander Randa e0ab5618a0 Wrong data type when testing webhooks 2017-07-20 15:12:06 +00:00
Bob Van Landuyt 458f3cf9b0 Update specs for new upload path 2017-07-18 15:38:54 +02:00
Grzegorz Bizon 613208c360 Recover from renaming project that has container images 2017-07-13 15:34:36 +02:00
Paul Charlton cb3b4a15e6 Support multiple Redis instances based on queue type 2017-07-11 03:35:47 +00:00
Douwe Maan ec3b10e078 Merge branch '34716-environment-specific-variables-ce' into 'master'
Backports for ee-2112

Closes #34716

See merge request !12671
2017-07-06 13:11:07 +00:00
Yorick Peterse c63e322158
Add many foreign keys to the projects table
This removes the need for relying on Rails' "dependent" option for data
removal, which is _incredibly_ slow (even when using :delete_all) when
deleting large amounts of data. This also ensures data consistency is
enforced on DB level and not on application level (something Rails is
really bad at).

This commit also includes various migrations to add foreign keys to
tables that eventually point to "projects" to ensure no rows get
orphaned upon removing a project.
2017-07-06 12:01:36 +02:00
Lin Jen-Shin d9435d6121 Backports for ee-2112
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2112
2017-07-06 16:25:03 +08:00
Grzegorz Bizon 6afe25ef33 Merge branch '32815--Add-Custom-CI-Config-Path' into 'master'
Resolve "Project option to allow customizing CI/CD config path"

Closes #32815 and #33130

See merge request !12509
2017-07-06 07:20:36 +00:00