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
- Enable
merge_request_diff_commits_dedup
feature flag. - Create a MR.
- Add multiple commits to that MR.
- See the
Commits
tab on the MR page and they should still display all commits. - Compare the
merge_request_diff_commits
andmerge_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
-
merge_request_diff_commits
records should have appropriatemerge_request_commits_metadata_id
set. -
merge_request_commits_metadata
records should have appropriateproject_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.