Skip to content

Resolve "Timeout searching group issues"

Sean McGivern requested to merge 46648-timeout-searching-group-issues into master

What does this MR do?

Forces the use of a CTE when searching issuables within a project or group context (and on Postgres) to avoid the issue described in https://gitlab.com/gitlab-org/gitlab-ce/issues/46648#note_75772939.

More details on how to test this, and the results I got, are in https://gitlab.com/gitlab-org/gitlab-ce/snippets/1721019. From eyeballing the results, I didn't see any significant query time changes between the options, except the final one which improved this specific case.

Are there points in the code the reviewer needs to double check?

Yes!

  1. The first commit removed a complicated condition. However, I'm not sure exactly when it's used. When I visit https://gitlab.com/dashboard/issues?assignee_id=426128 on GitLab.com I get this query: https://gitlab.com/gitlab-org/gitlab-ce/snippets/1721099

    That looks broadly fine to me. I'm sure at some point in the past this query was more complicated. Maybe we removed the need for that, and it was just dead code?

  2. The CTE is only used as a fence in very specific circumstances. Notably, this does not include group issues search (using the search bar). See https://gitlab.com/search?group_id=9970&scope=issues&search=test for an example. This does not use the finder fully (https://gitlab.com/gitlab-org/gitlab-ce/blob/v10.8.0/lib/gitlab/search_results.rb#L113), but still, it's curious that this query apparently does not trigger the undesirable behaviour.

  3. I couldn't really think of any specs to write, so the snippet is my replacement for specs here.

Does this MR meet the acceptance criteria?

  • Changelog entry added, if necessary
  • Tests added for this feature/bug
  • Conform by the code review guidelines
    • Has been reviewed by a Backend maintainer
    • Has been reviewed by a Database specialist

What are the relevant issue numbers?

Closes #46648 (closed).

Edited by Grzegorz Bizon

Merge request reports