Expose total weight for epic board lists on GraphQL endpoint
What does this MR do and why?
It exposes sum of epic board list issues weights for graphQL endpoint. It simply takes all epics in the epic board and sum weights of their issues. It ignores subepics if they are not in the same list as their respective parent epics. This has been discussed in the original issue and a follow-up issue has been created.
The weight is included in newly introduced metadata
field, also epicsCount
was moved there and the original field was deprecated.
Database
Query plan
Query before the change: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7889/commands/28282
Query after the change (with weight): https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/8149/commands/28952
The new query joins 2 additional tables.
Adding index
Up
== 20220124200927 AddIndexToIssues: migrating =================================
-- transaction_open?()
-> 0.0000s
-- index_exists?(:issues, [:id, :weight], {:name=>"index_issues_on_id_and_weight", :algorithm=>:concurrently})
-> 0.0183s
-- execute("SET statement_timeout TO 0")
-> 0.0008s
-- add_index(:issues, [:id, :weight], {:name=>"index_issues_on_id_and_weight", :algorithm=>:concurrently})
-> 0.0103s
-- execute("RESET statement_timeout")
-> 0.0006s
== 20220124200927 AddIndexToIssues: migrated (0.0329s) ========================
Down
== 20220124200927 AddIndexToIssues: reverting =================================
-- transaction_open?()
-> 0.0000s
-- indexes(:issues)
-> 0.0197s
-- execute("SET statement_timeout TO 0")
-> 0.0007s
-- remove_index(:issues, {:algorithm=>:concurrently, :name=>"index_issues_on_id_and_weight"})
-> 0.0046s
-- execute("RESET statement_timeout")
-> 0.0008s
== 20220124200927 AddIndexToIssues: reverted (0.0299s) ========================
How to set up and validate locally
Preparation
- Go to group - epics - boards
- Add some epics to the board lists, make sure the epics have at least some issues
- Find the epic board id, eg. in rails console:
Group.find_by(path: 'flightjs').epic_boards
GraphQL query
query epicBoardListEpics {
group(fullPath: "gitlab-org"){
epicBoard(id: "gid://gitlab/Boards::EpicBoard/1") {
lists {
nodes {
title
metadata {
epicsCount
totalWeight
}
}
}
}
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Follow-ups:
- Frontend: #353444
- Performance: #352825 (closed)
- FF rollout: #353450 (closed)
Related to #321392 (closed)