Geo: Replicate Organizations::OrganizationDetail uploads

What does this MR do and why?

Adds Geo SSF (self-service framework) replication and verification for the organization_detail_uploads partition table so Organizations::OrganizationDetail attachments (organization avatars) are mirrored from the primary to secondary Geo sites alongside the other upload partitions.

Generated with scripts/geo/generate-blob-replicator:

scripts/geo/generate-blob-replicator \
  --replicable-name=organization_detail_upload \
  --model-class=Organizations::OrganizationDetail \
  --table-name=organization_detail_uploads \
  --sharding-key=organization_id \
  --milestone=19.2 \
  --upload-partition

Two adaptations were made on top of the generated output:

  • 1:1 ownership. Organizations::OrganizationDetail is 1:1 with Organization (organization_id is its primary key), so the factory and selective-sync fixtures reuse a single detail per organization and set avatar: nil, ensuring the shared Geo Framework selective sync behavior examples assert only on the tracked uploads.
  • Index name length. Registry and state index names are shortened to the idx_od_upl_* convention to stay within PostgreSQL's 63-character identifier limit, matching the sibling vulnerability_export_upload tables.

Selective sync uses the organization-only scope (parity with Geo::VulnerabilityExportUpload), since OrganizationDetail#uploads_sharding_key only ever sets organization_id.

References

How to set up and validate locally

Requires a primary + secondary Geo setup (e.g. two GDKs).

  1. On both sites, run migrations:

    bin/rake db:migrate db:migrate:geo

  2. On the primary, enable replication:

    Feature.enable(:geo_organization_detail_upload_replication)

  3. Create an organization detail upload on the primary (UI: set an organization's avatar under Organization settings, or attach an upload to an Organizations::OrganizationDetail directly).

  4. On the secondary, confirm the registry row was created and replication + verification succeeded:

    Geo::OrganizationDetailUploadRegistry.last => state: 'synced', verification_state: 'succeeded'

  5. Confirm the file is present at the secondary's upload path and that verification_checksum matches the primary's.

  6. Optionally re-verify:

    Geo::OrganizationDetailUploadRegistry.last.verification_pending!

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Victor Prêté

Merge request reports

Loading