Race condition while indexing new projects
Summary
Pushing content with immediately after creating a project through the API causes indexing discrepancies.
Steps to reproduce
- Clone an existing project
- Create a new project through the API. Ex.
curl --header "Private-Token: blah" -X POST "https://gitlab.example.com/api/v4/projects?name=test&namespace_id=12031&visibility=internal&request_access_enabled=true"
- Add the remote for this project:
git remote add origin "https://:@gitlab.example.com:8443/namespace/test.git"
git push origin --mirror/all
- Use Advanced Global search on this project and check that it produces no results (At this point content does exist on the index)
- Push new commits
- Use Advanced Global search on this project and check that the only results are from the new pushed commits from the previous step (Previous indexed content disappeared from the index, only new content is present).
What is the current bug behavior?
It looks that there is a race condition during project creation regarding the indexing, please refer to the "steps to reproduce" section.
If we specify a delay between the project creation and the push, everything is correctly indexed.
What is the expected correct behavior?
Global search should provide all the content at any time.
Gitlab version
GitLab 11.1.4-ee (gitlab-ee@d17962f93455877eff70e4ad5dcc831d2469a8e0) and GitLab 11.2.5-ee (da87da28)