Ignore builds already added to Ci::FinishedBuildChSyncEvent
What does this MR do and why?
This MR ensures that if EE::Ci::BuildFinishedWorker#process_build
is called twice for the same build, we don't raise an error inserting a Ci::FinishedBuildChSyncEvent
record that already exists (and is potentially already processed). This behavior has been seen in production, likely due to retries.
Changelog: fixed EE: true
Part of #428146 (closed)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Run test with old production code:
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "p_ci_finished_build_ch_sync_events_1_pkey" DETAIL: Key (build_id, partition)=(42, 1) already exists.
Run test with new code from branch. It should pass.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.