Skip to content

Draft: Only check index integrity when commit_count is > 0

Terri Chu requested to merge 214601-refactor-when-blobs-are-missing into master

What does this MR do and why?

Related to #214601 (closed)

We introduced index integrity check and when reviewing kibana logs, I suspect that the index integrity check is not using the repository methods correctly.

Advanced Search only indexes the default branch, so we should only check projects when:

  • repository exists
  • repository is not empty
  • repository has a commit_count > 0 (commit_count is run against the root_ref so it's only for the default branch)

This change adds the commit_count check. The commit_count method checks that a root_ref exists, and gets a commit_count for the root_ref (Default branch). This should ensure that in most cases there are files in the repository for the default branch. I also removed the call to repository.exists? since repository.empty? checks that the repository exists, so we don't need to call that twice.

Screenshots or screen recordings

N/A

How to set up and validate locally

I'm not sure how to setup a non-empty repository with a default branch that is empty and has no commits, but you can setup empty branches.

MR acceptance checklist

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

Edited by Terri Chu

Merge request reports

Loading