Skip to content
Snippets Groups Projects
  1. Mar 20, 2020
  2. Feb 05, 2020
  3. Dec 11, 2019
  4. Nov 27, 2019
  5. Nov 20, 2019
  6. Nov 14, 2019
  7. Sep 04, 2019
  8. Aug 06, 2019
  9. Apr 01, 2019
  10. Mar 27, 2019
    • Nick Thomas's avatar
      Allow external diffs to be used conditionally · 0e831b0b
      Nick Thomas authored
      Since external diffs are likely to be a bit slower than in-database
      ones, add a mode that makes diffs external after they've been obsoleted
      by events. This should strike a balance between performance and disk
      space.
      
      A background cron drives the majority of migrations, since diffs become
      outdated through user actions.
      Verified
      0e831b0b
  11. Mar 14, 2019
  12. Mar 04, 2019
  13. Feb 05, 2019
  14. Dec 13, 2018
  15. Nov 07, 2018
  16. Nov 02, 2018
  17. Nov 01, 2018
  18. Aug 01, 2018
  19. Jul 18, 2018
  20. Jun 29, 2018
    • Sean McGivern's avatar
      Fix MR diffs created with gitaly_diff_between enabled · 2c2422d5
      Sean McGivern authored
      When we save merge request diffs to the database, we need to expand the diff
      before doing so. That's so that we can expand diffs (within the normal limits)
      without hitting the repository, but just by going to the database.
      
      This is done implicitly - diffs are expanded unless we say otherwise. However,
      we have another option we can pass, that lets us enforce diff size limits, that
      defaults to true.
      
      Prior to this commit:
      
      - The Rugged code path defaulted to setting `expanded: true` and
        `enforce_limits: true`.
      - The Gitaly code path defaulted to setting `expanded: false` and
        `enforce_limits: true`.
      
      This was introduced by eb36fa17, which
      implemented the initial feature. Since then, if the `gitaly_diff_between`
      feature flag was enabled, MRs would have diffs that could not be expanded in
      some cases, with no fix other than to disable the feature flag and force push to
      the MR to refresh the diff in the database.
      2c2422d5
  21. Jun 24, 2018
  22. Jan 12, 2018
  23. Nov 28, 2017
    • Sean McGivern's avatar
      Remove serialised diff and commit columns · 4ebbfe5d
      Sean McGivern authored
      The st_commits and st_diffs columns on merge_request_diffs historically held the
      YAML-serialised data for a merge request diff, in a variety of formats.
      
      Since 9.5, these have been migrated in the background to two new tables:
      merge_request_diff_commits and merge_request_diff_files. That has the advantage
      that we can actually query the data (for instance, to find out how many commits
      we've stored), and that it can't be in a variety of formats, but must match the
      new schema.
      
      This is the final step of that journey, where we drop those columns and remove
      all references to them. This is a breaking change to the importer, because we
      can no longer import diffs created in the old format, and we cannot guarantee
      the export will be in the new format unless it was generated after this commit.
      4ebbfe5d
  24. Nov 23, 2017
    • Sean McGivern's avatar
      Use latest_merge_request_diff association · 991bf24e
      Sean McGivern authored
      Compared to the merge_request_diff association:
      
      1. It's simpler to query. The query uses a foreign key to the
         merge_request_diffs table, so no ordering is necessary.
      2. It's faster for preloading. The merge_request_diff association has to load
         every diff for the MRs in the set, then discard all but the most recent for
         each. This association means that Rails can just query for N diffs from N
         MRs.
      3. It's more complicated to update. This is a bidirectional foreign key, so we
         need to update two tables when adding a diff record. This also means we need
         to handle this as a special case when importing a GitLab project.
      
      There is some juggling with this association in the merge request model:
      
      * `MergeRequest#latest_merge_request_diff` is _always_ the latest diff.
      * `MergeRequest#merge_request_diff` reuses
        `MergeRequest#latest_merge_request_diff` unless:
          * Arguments are passed. These are typically to force-reload the association.
          * It doesn't exist. That means we might be trying to implicitly create a
            diff. This only seems to happen in specs.
          * The association is already loaded. This is important for the reasons
            explained in the comment, which I'll reiterate here: if we a) load a
            non-latest diff, then b) get its `merge_request`, then c) get that MR's
            `merge_request_diff`, we should get the diff we loaded in c), even though
            that's not the latest diff.
      
      Basically, `MergeRequest#merge_request_diff` is the latest diff in most cases,
      but not quite all.
      991bf24e
  25. Jul 27, 2017
  26. Jul 26, 2017
    • Sean McGivern's avatar
      Fix saving diffs that are not valid UTF-8 · 396b8f91
      Sean McGivern authored
      Previously, we used Psych, which would:
      
      1. Check if a string was encoded as binary, and not ASCII-compatible.
      2. Add the !binary tag in that case.
      3. Convert to base64.
      
      We need to do the same thing, using a new column in place of the tag.
      396b8f91
  27. Jul 06, 2017
    • Sean McGivern's avatar
      Add table for merge request commits · aff5c9f3
      Sean McGivern authored
      This is an ID-less table with just three columns: an association to the merge
      request diff the commit belongs to, the relative order of the commit within the
      merge request diff, and the commit SHA itself.
      
      Previously we stored much more information about the commits, so that we could
      display them even when they were deleted from the repo. Since 8.0, we ensure
      that those commits are kept around for as long as the target repo itself is, so
      we don't need to duplicate that data in the database.
      aff5c9f3
  28. Jun 16, 2017
    • Sean McGivern's avatar
      Add table for files in merge request diffs · 9a73b634
      Sean McGivern authored
      This adds an ID-less table containing one row per file, per merge request
      diff. It has a column for each attribute on Gitlab::Git::Diff that is serialised
      currently, with the advantage that we can easily query the attributes of this
      new table.
      
      It does not migrate existing data, so we have fallback code when the legacy
      st_diffs column is present instead. For a merge request diff to be valid, it
      should have at most one of:
      
      * Rows in this new table, with the correct merge_request_diff_id.
      * A non-NULL st_diffs column.
      
      It may have neither, if the diff is empty.
      9a73b634
  29. Jun 14, 2017
  30. Jun 06, 2017
  31. Feb 23, 2017
  32. Jan 12, 2017
  33. Dec 01, 2016
  34. Oct 12, 2016
Loading