Geo: Forward project repo pulls to the primary when repo is out of date
What does this MR do and why?
Describe in detail what your merge request does and why.
A secondary site will now forward project repo pulls to the primary site if the latest repo change is not yet replicated. With limitations as shown below.
Part of #345267 (closed). Does not resolve it fully, yet.
Current limitations
We assume last_repository_updated_at
is a timestamp of the latest
change. So we compare the timestamp of the latest sync to
last_repository_updated_at
.
- Unfortunately, project wiki updates also touch
last_repository_updated_at
. So wiki updates will also bump the repo to out-of-date. - Unfortunately, successive
last_repository_updated_at
touches are throttled withinEvent::REPOSITORY_UPDATED_AT_INTERVAL
minutes. This is currently set to 5 minutes. So for example, secondary sites will think highly active repos are up-to-date after the first sync of each 5 minute interval.
This is a rough improvement over the current code.
Next, we can iteratively improve the accuracy of
.repository_out_of_date?
to fully address the problem. It may
be rather involved, so this MR helps by reducing the scope of that
future change.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Have Geo set up locally, with both sites running this MR's branch, with Unified URL
- Have a project with a repo, and make sure the secondary site has synced it
-
git clone
a project repo from the Unified URL - Notice that
git clone
(or a subsequentgit pull
) does not outputwarning: redirecting to
a path withpush_from_secondary
in it (yes, the path segment name should be different) - In Terminal, in the directory of the secondary site, run
gdk stop rails-background-jobs
to block repo replication - In the GitLab UI, edit a file in the repo and commit it
git pull
- Notice that
git pull
outputswarning: redirecting to
because the secondary's repo is out of date and the new code is exercised - In Terminal, in the directory of the secondary site, run
gdk start rails-background-jobs
to let repo replication happen git pull
- Notice that
git pull
does not outputwarning: redirecting to
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.