Geo VerificationStateBackfillService errors on ci_job_artifact_states table since changes to primary key

Summary

The following error is being logged on a Geo primary:

{"severity":"ERROR","time":"2025-07-22T12:11:02.837Z","correlation_id":"ba4c95d2150a75f30ca4d15fa7d8c8e0","class":"Geo::VerificationStateBackfillService","gitlab_host":"orw-ddcp-git-01.wv.mentorg.com","message":"Error while updating ci_job_artifact_states","error":"No unique index found for job_artifact_id"}

The ci_job_artifact_states table has been changed recently to support partitioning and the primary key changed from job_artifact_id to job_artifact_id, partition_id.

Seen in GitLab version 18.0.1, 18.1.2.

Related items:

Steps to reproduce

  • Set up a Geo primary and secondary.
  • Run some jobs which create artifacts.
  • Delete one or more rows from the ci_job_artifact_states table.
  • Monitor the Geo and sidekiq logs when the VerificationStateBackfillService task runs and tries to recreate the missing rows.

Example Project

What is the current bug behavior?

Errors logged during job artifact object verification processing.

What is the expected correct behavior?

No errors should be logged.

Possible fixes

  1. Immediately do the short-term fix and backport it

    verification_state_table_class.insert_all(rows, unique_by: %i[job_artifact_id, partition_id])
  2. Long-term fix: #536647

Patch release information for backports

If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.

Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.

High-severity bug remediation

To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.

Edited by Michael Kozono