Skip to content

Add support for *_path de-duplication to mrd_files

As part of the partitioning/sharding/DB size work:

Add support for *_path de-duplication in Rails

  • Add custom getter in MergeRequestDiffFile to return old_path when new_path is NULL
    • We should also look at DiffFile#to_hash (this is in app/models/concern). This method is called whenever we build the Gitlab::Git::DiffCollection based on MergeRequestDiffFiles.
  • Update *_path values before they get to the DB
    • Add before_validation to set new_path = nil if old_path == new_path
    • Update MergeRequestDiff#build_merge_request_diff_files as we build the rows we bulk insert. (see MergeRequestDiff#save_diffs)
Edited by Kerri Miller