Skip to content

Geo: Fix verification timeout of registry records

Michael Kozono requested to merge mk/fix-verification-timeout-job-resync into master

What does this MR do and why?

Fix verification timeout of Geo registry records. It should mark the registry record as failed sync.

Resolves #432523 (closed)

MR acceptance checklist

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

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. In Rails console in a secondary Geo site, get a synced and verified Geo::UploadRegistry record
  2. Put it in verification_started verification state and set verification_started_at = 8.hours.ago
  3. Call registry_record.replicator.class.trigger_background_verification to enqueue the Geo::VerificationTimeoutWorker

The upload registry record should show up in Replication details as failed sync, and within a couple minutes it should automatically get resynced.

Instead of waiting to get verified again.

Queries

Query plans do not change. 3 more fields are SET during an existing bulk update query.

Before

UPDATE
  "package_file_registry"
SET
  "verification_state" = $ 1,
  "verification_failure" = $ 2,
  "verification_checksum" = $ 3,
  "verification_retry_count" = $ 4,
  "verification_retry_at" = $ 5,
  "verified_at" = $ 6
WHERE
  ("package_file_registry"."state" IN (2))
  AND "package_file_registry"."verification_state" = 1
  AND "package_file_registry"."verification_started_at" < '2024-01-31 16:55:45.355265'
  AND "package_file_registry"."id" >= 21

After

UPDATE
  "package_file_registry"
SET
  "verification_state" = $ 1,
  "verification_failure" = $ 2,
  "verification_checksum" = $ 3,
  "verification_retry_count" = $ 4,
  "verification_retry_at" = $ 5,
  "verified_at" = $ 6,
  "state" = $ 7,
  "last_sync_failure" = $ 8,
  "retry_count" = $ 9
WHERE
  ("package_file_registry"."state" IN (2))
  AND "package_file_registry"."verification_state" = 1
  AND "package_file_registry"."verification_started_at" < '2024-01-31 16:55:45.355265'
  AND "package_file_registry"."id" >= 21
Edited by Michael Kozono

Merge request reports