Store group and project full name and full path in routes table
What does this MR do?
- adds name field to routes table
- moves full_name and full_path implementation from Namespace/Project to Routable concern
- uses route.name and route.path for full name/path to group or project
Are there points in the code the reviewer needs to double check?
no
Why was this MR needed?
- less sql queries (no need to collect parents to build full name/path)
- use routes table as single point of truth for resource location
- cleaner code
Does this MR meet the acceptance criteria?
-
Changelog entry added Documentation created/updatedAPI support added- Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Merge request reports
Activity
added 1 commit
- a60171c9 - Store group and project full name and full path in routes table
@DouweM check this out. Its alternative to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8845 based on our recent discussion.
marked the task Changelog entry added as completed
marked the task Squashed related commits together as completed
added 1 commit
- ddd15fd4 - Store group and project full name and full path in routes table
added 7 commits
-
ddd15fd4...572fb0be - 6 commits from branch
master
- 094b9297 - Store group and project full name and full path in routes table
-
ddd15fd4...572fb0be - 6 commits from branch
marked the task Conform by the style guides as completed
marked the task Conform by the merge request performance guides as completed
assigned to @DouweM
@dzaporozhets I prefer this over https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8845. It requires adding
with_route
in a few places, but doesn't have theN+1
issue, uses more Rails fundamentals, and generally seems easier to understand.assigned to @dzaporozhets
@vsizov please review
changed milestone to %9.0
mentioned in merge request !8845 (closed)
mentioned in issue #2772 (closed)
- Resolved by username-removed-444
@dzaporozhets LGTM
added 479 commits
-
094b9297...bbb7fbcd - 478 commits from branch
master
- 4ecfdad3 - Store group and project full name and full path in routes table
-
094b9297...bbb7fbcd - 478 commits from branch
added 1 commit
- 2989192d - Store group and project full name and full path in routes table
mentioned in commit 8820f3cd
11 after_update :rename_descendants 12 12 13 13 def rename_descendants 14 # We update each row separately because MySQL does not have regexp_replace. 15 # rubocop:disable Rails/FindEach 16 Route.where('path LIKE ?', "#{path_was}/%").each do |route| 17 # Note that update column skips validation and callbacks. 18 # We need this to avoid recursive call of rename_descendants method 19 route.update_column(:path, route.path.sub(path_was, path)) 14 if path_changed? || name_changed? 15 descendants = Route.where('path LIKE ?', "#{path_was}/%") 16 17 descendants.each do |route| 18 attributes = { 19 path: route.path.sub(path_was, path), 20 name: route.name.sub(name_was, name) I believe this is causing the following issue
Processing by DashboardController#activity as JSON Parameters: {"limit"=>"20", "offset"=>"0"} Completed 500 Internal Server Error in 329ms (ActiveRecord: 23.4ms) ActionView::Template::Error (undefined method `sub' for nil:NilClass): 1: %span.event-scope 2: = event_preposition(event) 3: - if event.project 4: = link_to_project event.project 5: - else 6: = event.project_name app/models/route.rb:20:in `block in rename_descendants' app/models/route.rb:17:in `rename_descendants' app/models/concerns/routable.rb:134:in `update_route' app/models/concerns/routable.rb:90:in `full_name' app/models/group.rb:92:in `human_name' app/helpers/projects_helper.rb:7:in `block in link_to_project' app/helpers/projects_helper.rb:3:in `link_to_project' app/views/events/_event_scope.html.haml:4:in `_app_views_events__event_scope_html_haml___2929874715229744757_47358257732160' app/views/events/event/_push.html.haml:12:in `_app_views_events_event__push_html_haml__1441259515167165541_47358256146220' app/views/events/_event.html.haml:11:in `_app_views_events__event_html_haml__8499293176541115_47358253063620' app/views/events/_events.html.haml:1:in `_app_views_events__events_html_haml___398254689614415965_47358308510200' app/controllers/application_controller.rb:204:in `pager_json' app/controllers/dashboard_controller.rb:19:in `block (2 levels) in activity' app/controllers/dashboard_controller.rb:14:in `activity' lib/gitlab/middleware/multipart.rb:93:in `call' lib/gitlab/request_profiler/middleware.rb:14:in `call' lib/gitlab/middleware/go.rb:16:in `call'
But i might be wrong or missing an upgrade step (installation from sources)
Happy to provide additional information in case that's needed
Edit : MySQL as DB,
name
column values appear to benull
for all rowsEdited by username-removed-17207
mentioned in issue #29554 (closed)