Commit Graph

482 Commits

Author SHA1 Message Date
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
Grzegorz Bizon 1a581a6afc Use a previous approach for cycle analytics dummy pipeline 2017-07-05 21:23:10 +02:00
Robert Speicher ef8147f388 Merge branch 'enable-a-few-rubocop-rspec-cops' into 'master'
Disable RSpec/BeforeAfterAll and enable RSpec/ImplicitExpect cops

See merge request !12562
2017-07-05 18:29:38 +00:00
Lin Jen-Shin 33a5157ad4 Merge remote-tracking branch 'upstream/master' into 32815--Add-Custom-CI-Config-Path
* upstream/master: (149 commits)
  Revert change to design. Go back to scrollable page
  Fixes the column widths for the new navigation options in settings
  Migrate #submodule_url_for to Gitaly
  Add test example for external commit status retries
  Fix invalid Rails.logger call in lib/gitlab/health_checks/fs_shards_check.rb
  Fix build for !12300.
  Log rescued exceptions to Sentry
  Fix issues with non-UTF8 filenames by always fixing the encoding of tree and blob paths
  Revert "Merge branch 'revert-12499' into 'master'"
  Prevent accidental deletion of protected MR source branch by repeating checks before actual deletion
  Improve the overall UX for the new monitoring dashboard
  Document that GitLab 9.3 requires the TRIGGER permission on MySQL
  Instrument Unicorn with Ruby exporter
  Remove group modal like remove project modal. Closes #33130
  Update prometheus client gem
  Enables the option in user preferences to turn on the new navigation
  Add Jasmine tests for `OAuthRememberMe`
  Simplify authentication logic in the v4 users API for !12445.
  Use stub_application_setting when testing ApplicationHelper#support_url
  wait_for_requests is not needed when AJAX is not in play
  ...
2017-07-05 22:05:39 +08:00
Lin Jen-Shin 9f5ac179d1 Rename ci_config_file to ci_config_path 2017-07-05 20:11:01 +08:00
Lin Jen-Shin 9f7e5e45df Add back Pipeline#ci_yaml_file_path due to all the troubles 2017-07-05 20:04:53 +08:00
Lin Jen-Shin 84e37683cb Make sure we remove null characters 2017-07-04 18:18:36 +08:00
Sean McGivern 049d4baed0 Merge branch 'sh-allow-force-repo-create' into 'master'
Make Project#ensure_repository force create a repo

Closes gitlab-ee#2800

See merge request !12580
2017-07-03 19:29:26 +00:00
Lin Jen-Shin 63bf2457e4 Follow feedback on the merge request 2017-07-04 03:08:30 +08:00
Douglas Barbosa Alexandre 73f5b02b4f Change the force flag to a keyword argument 2017-07-03 14:37:20 -03:00
Rémy Coutable 1b0c6ffd51 Disable RSpec/BeforeAfterAll and enable RSpec/ImplicitExpect cops
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-06-30 17:52:27 +02:00
Stan Hu 9c8075c4b9 Make Project#ensure_repository force create a repo
In Geo, Project#ensure_repository is used to make sure that a Git repo
is available to be fetched on a secondary. If a project were a fork,
this directory would never be created.

Closes gitlab-org/gitlab-ee#2800
2017-06-30 07:21:01 -07:00
Lin Jen-Shin 17ba052f5c Update wordings, allow only full path, add tests 2017-06-30 15:23:46 +08:00
Lin Jen-Shin 62fdbbeeb0 Merge remote-tracking branch 'upstream/master' into 32815--Add-Custom-CI-Config-Path
* upstream/master: (123 commits)
  Backport changes to Projects::IssuesController and the search bar
  bugfix: use `require_dependency` to bring in DeclarativePolicy
  Resolve "Select branch dropdown is too close to branch name"
  Clean up issuable lists
  Defer project destroys within a namespace in Groups::DestroyService#async_execute
  Fixed new navgiation bar logo height in Safari
  Resolve "Issue dropdown persists when adding issue number to issue description"
  Move verification to block level instead of paragraph
  Revert "Merge branch 'dm-drop-default-scope-on-sortable-finders' into 'master'"
  Added code for defining SHA attributes
  Minor edits
  Job details won't scroll horizontally to show long lines
  Run mysql tests on stable preperation branches like 9-3-stable-patch-2
  Bring back branches badge to main project page
  optimize translation content based on comments
  supplement traditional chinese in taiwan translation
  Inserts exact matches of username, email and name to the top of the user search list
  Remove Namespace model default scope override and write additional test to Project search
  optimize translation content based on comments
  Limit OpenGraph image size to 64x64
  ...
2017-06-30 13:46:51 +08:00
Douglas Barbosa Alexandre 2446252cfd Expires full_path cache after project is renamed 2017-06-29 19:11:48 -03:00
Douwe Maan 0b704d4ece Merge branch 'refactor-namespace-default-scope-override' into 'master'
Remove Namespace model default scope override and write additional test to Project search

See merge request !12546
2017-06-29 15:15:39 +00:00
Sean McGivern ff048ba8a3 Merge branch 'fix-34417' into 'master'
Perform housekeeping only when an import of a fresh project is completed

Closes #34417

See merge request !12529
2017-06-29 09:22:52 +00:00
Tiago Botelho 7b77e2862a Remove Namespace model default scope override and write additional test to Project search 2017-06-29 07:56:48 +01:00
Douwe Maan c89f7c71f6 Merge branch '30708-stop-using-deleted-at-to-filter-namespaces' into 'master'
refactors Project#search namespace join

Closes #30708

See merge request !12091
2017-06-29 01:11:45 +00:00
Douglas Barbosa Alexandre 639639ef8a Add tests for project import state transition: [:started] => [:finished] 2017-06-28 16:08:36 -03:00
Douglas Barbosa Alexandre 2a64607b98 Add Project#ensure_repository 2017-06-28 10:42:51 -03:00