gitlab-org--gitlab-foss/app/models
Andreas Brandl 53801b1206
Preload routes information
This fixes a high frequency N+1 issue:

`RoutableActions#find_routable!` is used across many controllers to
retrieve e.g. the Project or Namespace by path. The `#find_routable!`
method calls `#ensure_canonical_path` which in turn retrieves
`#full_path` from the given Routable.

This in turn triggers a lookup on `routes`, leading to a high frequency
of these queries:

```sql
SELECT  "routes".* FROM "routes" WHERE "routes"."source_id" = $1 AND
"routes"."source_type" = $2 LIMIT $3
```

This is unnecessary as we already join `routes` in
`Routable#find_by_full_path` anyways.
2019-09-03 12:16:03 +02:00
..
analytics Implement validation logic to ProjectStage 2019-08-23 20:28:11 +00:00
application_setting Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
badges
blob_viewer Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
ci Merge branch 'add-pipeline-type-key-in-pipeline-entity' into 'master' 2019-09-03 09:18:46 +00:00
clusters Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
concerns Preload routes information 2019-09-03 12:16:03 +02:00
conversational_development_index Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
cycle_analytics Add code review remarks 2019-07-23 12:01:39 +02:00
diff_viewer Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
error_tracking Run rubocop -a on CE files 2019-05-05 03:24:28 -07:00
hooks Refactor SystemHookUrlValidator and specs 2019-08-02 15:39:18 +01:00
identity Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
issue Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
members Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
merge_request Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
namespace Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
network
postgresql Fix background migrations failing with unused replication slot 2019-06-25 08:35:29 -07:00
project_services Reduce amount of property definitions in ChatNotificationService 2019-09-02 13:25:15 +00:00
protected_branch Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
protected_tag Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
releases Align UrlValidator to validate_url gem implementation. 2019-04-11 06:29:07 +00:00
serverless Add Knative metrics to Prometheus 2019-04-06 02:02:39 +00:00
storage Add a rubocop for Rails.logger 2019-07-10 19:26:47 +00:00
uploads Add a rubocop for Rails.logger 2019-07-10 19:26:47 +00:00
.gitkeep
ability.rb
abuse_report.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
active_session.rb ActiveSession.cleaned_up_lookup_entries to use Redis#pipelined 2019-08-07 09:32:05 +00:00
appearance.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
application_record.rb Optimise upload path calls 2019-05-14 11:01:48 -05:00
application_setting.rb Merge branch 'remove-ignorable-column-concern' into 'master' 2019-08-30 21:59:31 +00:00
application_setting_implementation.rb Merge branch 'security-enable-image-proxy' into 'master' 2019-08-29 21:34:29 +00:00
audit_event.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
award_emoji.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
badge.rb Align UrlValidator to validate_url gem implementation. 2019-04-11 06:29:07 +00:00
blob.rb Update comments about N + 1 Gitaly calls 2019-04-09 17:21:16 +02:00
board.rb Move order lambda to list scope 2019-06-27 10:32:51 +12:00
board_group_recent_visit.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
board_project_recent_visit.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
broadcast_message.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
chat_name.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
chat_team.rb Add a rubocop for Rails.logger 2019-07-10 19:26:47 +00:00
commit.rb Fix moving issues API failing when text includes commit URLs 2019-08-28 00:18:33 -07:00
commit_collection.rb Backport splitting approval changes from CE 2019-04-02 11:01:07 +00:00
commit_range.rb Run rubocop -a on CE files 2019-05-05 03:24:28 -07:00
commit_status.rb Optimise DAG processing 2019-08-14 11:34:44 +02:00
commit_status_enums.rb Create framework for build prerequisites 2019-03-20 12:04:40 +11:00
compare.rb
container_repository.rb Backport of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/3809 2019-08-01 20:38:07 +03:00
dashboard_group_milestone.rb Fix bug with closed milestones in dashboard 2019-07-16 15:33:35 -06:00
dashboard_milestone.rb
deploy_key.rb Use self.ignored_columns += instead of = 2019-08-30 13:15:34 -07:00
deploy_keys_project.rb Speed up loading and filtering deploy keys and their projects 2019-08-05 06:42:34 -07:00
deploy_token.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
deployment.rb Extract logic who created deployment into Deployment#deployed_by 2019-08-22 15:36:55 +03:00
deployment_metrics.rb Removes potentially incorrect, and slow fallback 2019-07-25 16:46:20 +12:00
diff_discussion.rb
diff_note.rb Make diff_refs_match_commit validation reusable 2019-08-01 16:00:36 -05:00
directly_addressed_user.rb
discussion.rb GraphQL support for Notes created in discussions 2019-07-10 12:13:48 +12:00
discussion_note.rb
email.rb Upgrade to Rails 5.2 2019-07-12 10:15:31 +08:00
environment.rb Use separate Kubernetes namespaces per environment 2019-08-07 04:40:29 +00:00
environment_status.rb Add additional test case for Gitaly N+1 for diff files 2019-07-10 16:07:14 +02:00
epic.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
event.rb Remove dependency on IgnorableColumn concern 2019-08-30 02:09:13 +05:30
event_collection.rb
external_issue.rb
fork_network.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
fork_network_member.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
generic_commit_status.rb Align UrlValidator to validate_url gem implementation. 2019-04-11 06:29:07 +00:00
global_label.rb Move scoped_label into label presenter 2019-04-23 19:58:20 +00:00
global_milestone.rb Move scoped_label into label presenter 2019-04-23 19:58:20 +00:00
gpg_key.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
gpg_key_subkey.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
gpg_signature.rb Extract a Git::{Base,Tag,Branch}HooksService 2019-04-05 18:26:53 +01:00
group.rb Limit access request email to 10 most recently active owners/maintainers 2019-08-30 21:30:51 +00:00
group_custom_attribute.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
group_label.rb
group_milestone.rb
guest.rb
identity.rb Adds Identity#for_user for use in an EE MR 2019-05-24 15:14:19 +07:00
import_export_upload.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
individual_note_discussion.rb Remove reply_to_individual_notes feature flag 2019-04-03 10:00:18 +08:00
instance_configuration.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
internal_id.rb Always use internal ID tables in development and production 2019-04-22 10:48:16 -07:00
issue.rb Resolve "Use "moved" instead of "closed" in issue references" 2019-08-30 06:16:01 +00:00
issue_assignee.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
issue_collection.rb
key.rb Resolved EE differences in app/views/profiles/keys 2019-05-31 16:13:53 +02:00
label.rb Merge branch 'security-fix-html-injection-for-label-description-ce-master' into 'master' 2019-08-29 21:34:20 +00:00
label_link.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
label_note.rb Update label note to support scoped labels notes 2019-07-02 13:27:03 +02:00
label_priority.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
legacy_diff_discussion.rb
legacy_diff_note.rb Adds the Rubocop ReturnNil cop 2019-03-06 17:51:56 +02:00
lfs_download_object.rb
lfs_file_lock.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
lfs_object.rb Makes LFS object linker process OIDs in batches 2019-08-27 15:52:33 -07:00
lfs_objects_project.rb CE backport for changes in EE MR 13894 2019-06-17 11:23:06 +12:00
license_template.rb
list.rb Save board lists collapsed setting 2019-08-28 20:18:40 +00:00
list_user_preference.rb Save board lists collapsed setting 2019-08-28 20:18:40 +00:00
member.rb Add system hooks for project/group membership updates 2019-09-02 18:35:36 -05:00
members_preloader.rb
merge_request.rb Add pipeline.type key to PipelineEntity 2019-09-03 13:30:53 +07:00
merge_request_assignee.rb Add multiple assignees migration and table population 2019-03-25 19:50:40 -03:00
merge_request_diff.rb Remove dependency on IgnorableColumn concern 2019-08-30 02:09:13 +05:30
merge_request_diff_commit.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
merge_request_diff_file.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
merge_requests_closing_issues.rb Upgrade to Rails 5.2 2019-07-12 10:15:31 +08:00
milestone.rb Added relationships between Release and Milestone 2019-09-03 09:38:59 +00:00
milestone_release.rb Added relationships between Release and Milestone 2019-09-03 09:38:59 +00:00
namespace.rb Allow disabling group/project email notifications 2019-08-15 17:37:36 +00:00
note.rb Merge branch 'remove-ignorable-column-concern' into 'master' 2019-08-30 21:59:31 +00:00
note_diff_file.rb Remove cleaned up OIDs from database and cache 2019-05-06 11:35:03 +01:00
notification_reason.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
notification_recipient.rb Allow disabling group/project email notifications 2019-08-15 17:37:36 +00:00
notification_setting.rb Use self.ignored_columns += instead of = 2019-08-30 13:15:34 -07:00
oauth_access_grant.rb
oauth_access_token.rb
out_of_context_discussion.rb
pages_domain.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
pages_domain_acme_order.rb Add pages domains acme orders 2019-06-06 18:55:31 +00:00
personal_access_token.rb OAuth2 support for GitLab personal access tokens 2019-07-22 08:50:25 +00:00
personal_snippet.rb
pool_repository.rb Fix wrong use of ActiveRecord in PoolRepository 2019-04-20 13:27:53 +00:00
programming_language.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
project.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
project_authorization.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
project_auto_devops.rb Remove ignore rule for ProjectAutoDevops#domain 2019-07-22 15:46:00 +10:00
project_ci_cd_setting.rb Move project default git depth behind feature flags 2019-06-10 17:40:19 +00:00
project_custom_attribute.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
project_daily_statistic.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
project_deploy_token.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
project_feature.rb Fix wrong pages access level default 2019-07-17 12:56:58 +00:00
project_group_link.rb Externalize strings in app/models 2019-04-12 12:28:07 +00:00
project_import_data.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
project_import_state.rb Add a rubocop for Rails.logger 2019-07-10 19:26:47 +00:00
project_label.rb
project_metrics_setting.rb Add ProjectMetricsDashboardSetting model and table 2019-04-26 17:23:26 +00:00
project_repository.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
project_snippet.rb
project_statistics.rb Removes update_statistics_namespace feature flag 2019-08-02 09:29:29 -05:00
project_team.rb
project_wiki.rb New wiki page redirects user to random slug 2019-08-21 09:33:12 +12:00
prometheus_metric.rb Support dashboard params for metrics dashboard 2019-08-07 16:17:35 +00:00
prometheus_metric_enums.rb Support dashboard params for metrics dashboard 2019-08-07 16:17:35 +00:00
protectable_dropdown.rb
protected_branch.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
protected_tag.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
push_event.rb Rename methods that conflict in Rails 5.2 2019-05-12 23:42:06 -05:00
push_event_payload.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
readme_blob.rb
redirect_route.rb Further remove code branches by database type 2019-07-29 12:47:06 +02:00
ref_matcher.rb
release.rb Added relationships between Release and Milestone 2019-09-03 09:38:59 +00:00
remote_mirror.rb Handle invalid mirror url 2019-08-29 16:19:07 +00:00
repository.rb Stub DetectRepositoryLanguagesWorker for all tests 2019-09-03 06:19:21 +00:00
repository_language.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
resource_label_event.rb Update label note to support scoped labels notes 2019-07-02 13:27:03 +02:00
route.rb Upgrade Rails to 5.1.6.1 2019-04-23 08:31:23 +08:00
security_event.rb
sent_notification.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
service.rb Provide filename and line number for class_eval 2019-09-02 18:05:33 +00:00
shard.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
snippet.rb GraphQL mutations for add, remove and toggle emoji 2019-06-28 12:03:33 +12:00
snippet_blob.rb
spam_log.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
ssh_host_key.rb Add a rubocop for Rails.logger 2019-07-10 19:26:47 +00:00
subscription.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
suggestion.rb Prepare suggestion implementation for multi-line 2019-03-27 12:26:53 -03:00
system_note_metadata.rb Add merge note type as cross reference 2019-08-13 08:48:17 +03:00
term_agreement.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
timelog.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
todo.rb Add Issue and Merge Request titles to Todo items 2019-08-27 20:09:24 -05:00
tree.rb
trending_project.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
u2f_registration.rb Externalize strings in app/models 2019-04-12 12:28:07 +00:00
upload.rb Externalize strings in app/models 2019-04-12 12:28:07 +00:00
user.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
user_agent_detail.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
user_callout.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
user_callout_enums.rb Revert "Merge branch '64341-data-and-privacy-agreement-for-gitlab-users' into 'master'" 2019-08-14 17:53:07 +00:00
user_custom_attribute.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
user_interacted_project.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
user_preference.rb Enable Rubocop Performance/InefficientHashSearch 2019-07-24 11:47:58 -07:00
user_status.rb Avoid calling freeze on already frozen strings in app/models 2019-09-01 01:27:00 +05:30
user_synced_attributes_metadata.rb Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
users_star_project.rb Fix N+1s queries while loading users 2019-08-19 17:35:46 -03:00
wiki_directory.rb
wiki_page.rb Fix grouping wiki pages by directory 2019-04-12 13:25:17 +00:00