Optimise rendering of Markdown documents that belong to different projects
What does this MR do?
We extend the Markdown pipeline so we can render multiple documents that may belong to different projects.
These changes combined can quite drastically reduce the number of SQL queries necessary in various places. For example, when displaying the Atom feed of a group these changes reduced the number of SQL queries from 58 to 39 (when combining these changes with https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18217).
EE merge request: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5308
Why was this MR needed?
We keep running into N+1 query problems with the Markdown pipeline. Further, the Groups atom feed would group events per project and render them separately; resulting in many SQL queries being executed.
Does this MR meet the acceptance criteria?
- Changelog entry added, if necessary
- Tests added for this feature/bug
- Has been reviewed by Backend
- Has been reviewed by Database
- Conform by the merge request performance guides
- Conform by the style guides
- Squashed related commits together
End-to-end tests pass (
package-and-qamanual pipeline job)