1. 26 Apr, 2021 1 commit
    • Dylan Griffith's avatar
      Add Elasticsearch migration to backfill project permissions on MRs · 3903395b
      Dylan Griffith authored
      As part of our efforts to avoid using joins in Elasticsearch queries
      https://gitlab.com/groups/gitlab-org/-/epics/2054 we need to
      "denormalize" (copy them into child docs) the permission related fields
      needed for searching.
      
      In order to allow us to search for merge requests without joining to the
      project we need to store the `merge_requests_access_level` as well as
      the `visibility_level` of the project on the merge request record. In
      https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59731 we started
      storing these fields for any newly created or updated Merge Requests.
      
      This MR is to backfill all the existing MRs in the index that don't have
      this value set. Technically we are backfilling 3 fields but, since all
      these fields were added in that MR, we can just check for the existence
      of any of those fields to be sure that a record has them all.
      
      This MR does not yet use these fields as it's only the 2nd step of all
      the steps described in https://gitlab.com/groups/gitlab-org/-/epics/5468
      
      Once these fields are backfilled we can start using them and get some
      performance gains. Technically we could add that code in this MR to use
      these new fields (conditioned upon the migration being finished) but in
      the past we've found that we often ran into issues that were only with
      one part of the code that led to us needing to revert and then do the
      whole process again and code review again and this is less efficient.
      
      This MR is actually pretty much an identical copy of the same thing we
      already did for issues a while back in
      https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47819 but all I
      did was find and replace `issues` with `merge_requests` since that's the
      only difference.
      
      Changelog: changed
      3903395b
  2. 25 Apr, 2021 39 commits