Skip to content

Update bulk_create method to also create metadata records

What does this MR do and why?

In order for us to deduplicate commit metadata from the merge_request_diff_commits table to the new merge_request_commits_metadata table, we need bulk creation logic to also create data on the new table. This applies to new MRDC records. A separate backfill migration will be done along when we start to partition MRDC table as well.

This is a temporary situation. Later on as we progress in implementing this deduplication approach, we will be removing the logic to write commit metadata on MRDC table.

This is behind merge_request_diff_commits_dedup feature flag.

References

https://gitlab.com/gitlab-org/gitlab/-/issues/527231

How to set up and validate locally

  1. Enable merge_request_diff_commits_dedup feature flag.
  2. Create a MR.
  3. Add multiple commits to that MR.
  4. See the Commits tab on the MR page and they should still display all commits.
  5. Compare the merge_request_diff_commits and merge_request_commits_metadata records of the MR and they should all have the same values for the following columns:
    • commit_author
    • committer
    • authored_date
    • committed_date
    • sha
    • message
    • trailers
  6. merge_request_diff_commits records should have appropriate merge_request_commits_metadata_id set.
  7. merge_request_commits_metadata records should have appropriate project_id set. This should be the project where the MR is created on.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading