codeintel: Protect indexes serving intel for branch and tag tips from eviction
Created by: efritz
Previously, we tracked only the set of uploads that were visible from the tip of the default branch for each repository. This PR expands the lsif_uploads_visible_at_tip
table and commit graph calculation to also track the tip of any non-stale branch and tag.
The visible_at_tip
property in LSIF uploads and dumps still refers to the same concept (uploads that are visible from the tip of the default branch used in xrepo find references). All other uploads serving intelligence for the tip of another branch or tag are simply protected from being evicted based on age.
There is a maximum age threshold for branches and tags, after which the commit pointing to the branch head or tag is considered stale and will not be retained on the next code intel cleanup pass. These thresholds can be supplied globally as an env var (default is 3 months for branches, 1 year for tags). They can also be supplied via the database on a pre-repo basis (the table exists in this PR but it is not currently exposed for mutation via graphQL or the UI).
Partial effort towards #19120 (closed).