Skip to content

Do not touch last_downloaded_at when on a geo secondary

What does this MR do and why?

🔥 Problem

In Add last_downloaded_at to packages (!97143 - merged), we added a last_downloaded_at to the package model.

The problem is that users could pull packages from geo secondaries but geo secondaries are read-only mirrors, so guess what happens when we try to bump a column in the packages table? Yes, 💥 (An error similar to: "Updates are not allowed on geo secondaries").

🚒 Solution

Fortunately, bumping the last_downloaded_at field is centralized in a model function. So the solution is quite trivial:

  • Add a guard to that function: if we are in a geo secondary, return early. Note that since geo is a premium feature, we need to override the last_downloaded_at bumping method in EE module.

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

  1. Install a secondary geo node in your local gdk instance.
  2. Publish any package to the package registry to test with a published one.
  3. Download any package file, the last_downloaded_at column for this package record in the packages_package table shouldn't be bumped.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #405297 (closed)

Edited by Moaz Khalifa

Merge request reports