Skip to content

codeintel: Fix misc expiration errors

Administrator requested to merge ef/codeintel-expiry into main

Created by: efritz

This PR fixes an expiration issue that I encountered when doing a multi-version upgrade from 3.25 -> 4.0. This PR does effectively fix the issue on this upgrade, and it may relate to some flakes in the codeintel-qa but I'm not confident at this point (we should continue to investigate that expiration issue, whatever it is).

Changes made:

  • Previously, GetOldestCommitDate would filter out -infinity and NULL values (incidentally) and return the smallest one. If there are no results then it could either be that there are no uploads for that repository, or that there are uploads but none of their committed_at values have been backfilled. Now, this method filters out -infinity (only written for unresolvable commits) but not NULL. Sorting by NULLS FIRST allows us to know if all the committed at dates for the repository are known. We now return a null time for incompletely backfilled repositories.
  • The previous change allows us to take different behaviors on empty repositories and incompletely backfilled repositories. Empty repositories have a null commit graph, but incompletely backfilled repositories should be retried at a later time. We force a retry by returning an error during processing.
  • Lastly, we stop returning an empty commit graph when we get a repo not found error. Unfortunately this error is a bit misleading, as it's also the error that occurs when a repository is currently being cloned. I think this may have been causing some issues in environments where repos can be re-cloned on demand.

Note that the oldest commit date is used to determine how much of the commit graph to look at when considering visibility. If our date doesn't go back far enough, we can miss the commits where the upload exists, and cause them to become unreferenced, be useless for code nav queries, and eventually be purged. This PR fixes this sequence of events from happening on these edge conditions.

Test plan

Updated unit tests.

Merge request reports

Loading