Create a periodic cron that checks for consistency of data in merge request compliance violations table
Description
Even though we have model level hooks (after_update
) we still want to ensure that the denormalized columns in the merge_request_compliance_violations
table is consistent with the source tables.
Implementation Plan
- Write a worker that runs periodically (maybe once a day) and checks for any inconsistencies in the following columns:
-
merged_at
inmerge_request_compliance_violations
vsmerged_at
inmerge_request_metrics
-
target_project_id
,title
andtarget_branch
inmerge_request_compliance_violations
vs the corresponding data inmerge_requests_compliance_violations
- Update the inconsistent columns in
merge_request_compliance_violations
table to match with the source tables.
-
- Need to ensure that the job is not executed for a very long time (not >5 min) since it will breach the threshold and account in the error budget. Use logic similar to
inactive_projects_deletion_cron_worker
to prevent the worker from exceeding the maximum allowed threshold of five minutes.
Edited by Huzaifa Iftikhar