Skip to content

Controller Projects::MilestonesController#destroy executes more than 100 SQL queries

This controller executes more than 100 SQL queries, the maximum number of queries allowed as per MR https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/16466. The number of queries should be reduced to less than 100 and the corresponding whitelisted sections of code (Gitlab::QueryLimiting.whitelist('...')) should be removed.

Summary (after working on the issue)

  • It is a case that is easy to replicate, here is how: #21092 (closed)
  • It could explode up to 1000s of DB request even for the milestone having > 10 MRs + > 10 issues
  • I had a wrong impression that we don't do much, but as Heinrich pointed we do quite a lot of business logic we could not just ignore by firing update_all or just not executing each individual service: !58387 (comment 545226849)
  • My impression that the solution for such cases is to rewriting the bulk update service being aware of which attrs require callbacks, which don't. Also being able to bulk-execute hooks as well. I find it really huge and fundamental, but highly beneficial.
  • I asked if we maybe, by any chance, already worked on that or have it planned, but it seems that not
Edited by Aleksei Lipniagov