Resolve "Wiki page returns error code 502"
What does this MR do?
Fixes a performance bottleneck in rendering wiki pages - #has_ancestor?
is much faster than #ancestors
, it seems.
Before:
*** PRODUCTION *** production> Gitlab::Profiler.profile('https://gitlab.com/services-support-testing/d/wiki/wikis/test2', user: User.find_by(username: 'deandre')).threads.first.total_time
Started GET "/services-support-testing/d/wiki/wikis/test2" for 127.0.0.1 at 2018-06-26 11:09:08 +0000
Processing by Projects::WikisController#show as HTML
Parameters: {"namespace_id"=>"services-support-testing/d", "project_id"=>"wiki", "id"=>"test2"}
Completed 200 OK in 784815ms (Views: 784162.8ms | ActiveRecord: 93.8ms | Elasticsearch: 0.0ms)
=> 785.3386883735657
After pasting in the change from this MR:
*** PRODUCTION *** production> Gitlab::Profiler.profile('https://gitlab.com/services-support-testing/d/wiki/wikis/test2', user: User.find_by(username: 'deandre')).threads.first.total_time
Started GET "/services-support-testing/d/wiki/wikis/test2" for 127.0.0.1 at 2018-06-26 11:05:49 +0000
Processing by Projects::WikisController#show as HTML
Parameters: {"namespace_id"=>"services-support-testing/d", "project_id"=>"wiki", "id"=>"test2"}
Completed 200 OK in 12337ms (Views: 11601.6ms | ActiveRecord: 95.8ms | Elasticsearch: 0.0ms)
=> 12.471254348754883
Are there points in the code the reviewer needs to double check?
I added the other ancestor tags for consistency, but this is a slightly bigger change than is strictly needed to close the issue.
Why was this MR needed?
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18524 introduced this change in 11.0, which created a performance issue with large wiki pages.
What are the relevant issue numbers?
Closes #48269 (closed).
Edited by Sean McGivern