Aggregate Geo uploads status from the upload partitions

What does this MR do and why?

When the legacy Geo::UploadReplicator is not replication-enabled, the uploads_* Geo node status fields now report the sum over the enabled upload partition replicators. These fields feed the Geo sites status API, Service Ping, geo:status, and the geo_uploads_* Prometheus gauges. The legacy replicator is disabled by default in 19.6 (#628308 (closed)), and without this change the fields would freeze at their last legacy values.

  • Counts are sums. uploads_oldest_unsynced_time is the minimum over partitions, ignoring the -1 sentinel for partitions with nothing unsynced.
  • On the primary, the legacy values stay while the legacy replicator still checksums. That happens when geo_upload_force_primary_checksumming is enabled with geo_upload_replication disabled.
  • Only enabled partitions are summed, because the saved status row still holds stale values for disabled ones. No field is written when no partition has a value, so an empty sum never reports 0.
  • geo:status prints an aggregate "Uploads" row after the partition rows, in both the replication and verification sections.
  • The field names stay as they are. They are derived from REPLICATOR_CLASSES, which keeps the legacy class until #628552 removes it and hardcodes the names.

References

Resolves #628546 (closed)

Screenshots or screen recordings

Not applicable: this MR has no UI change.

How to set up and validate locally

You need a Geo primary and secondary with upload partition replication running.

  1. On the primary, in the Rails console, disable the legacy replicator and its primary checksumming:

    Feature.disable(:geo_upload_replication)
    Feature.disable(:geo_upload_force_primary_checksumming)
  2. On the secondary, in the Rails console, compare the aggregate with the per-partition values:

    status = GeoNodeStatus.current_node_status
    partitions = Gitlab::Geo.replication_enabled_replicator_classes.select { |r| r.replicable_group == 'uploads' }
    
    status.uploads_synced_count
    partitions.sum { |r| status["#{r.replicable_name_plural}_synced_count"].to_i }

    Both values should match.

  3. On the secondary, run bin/rake gitlab:geo:status. The "Uploads replicated" and "Uploads verified" rows appear after the per-type upload rows.

  4. On the primary, run Feature.enable(:geo_upload_replication) and Feature.enable(:geo_upload_force_primary_checksumming) to restore the legacy values. The aggregate rows disappear from geo:status.

MR acceptance checklist

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

Edited by Chloe Fons

Merge request reports

Loading
Loading