codeintel: Do not delete reachable uploads
Created by: efritz
This PR adds a deleting
state to LSIF upload records. This state acts as an intermediate between completed
and deleted
states.
A problem currently arises when deleting visible uploads, as the deletion of the record does not force an (immediate) recalculation of the commit graph. If a record is deleted, the code intelligence resolvers will attempt to use these indexes (as they are still referenced in the nearest uploads table), but won't be able to fetch them as they have a state filtered out by all fetch queries.k
Instead of jumping directly to deleted for these records, we mark them as queued for deletion. Then, the next time the commit graph is calculated for the owning repository, all deleting records are marked as deleted (which is fine as it's now unreachable from the commit graph).
Summary of other changes:
- Update lsif_dumps view to include both completed and deleting records
- Update queries to include deleting records where completed records are used
- All queries that mark an upload as deleted now mark it as deleting if it's currently completed
- Update help text for delete button in UI
- Do not show delete button in UI if it's already marked