Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo Indexer Type Elastic Search does not work with new migrated repositories #16986

Closed
2 of 6 tasks
Joannazyx opened this issue Sep 8, 2021 · 2 comments · Fixed by #16991
Closed
2 of 6 tasks

Repo Indexer Type Elastic Search does not work with new migrated repositories #16986

Joannazyx opened this issue Sep 8, 2021 · 2 comments · Fixed by #16991
Labels

Comments

@Joannazyx
Copy link

  • Gitea version (or commit ref): Gitea version 1.15.0 built with GNU Make 4.3, go1.16.7 : bindata, timetzdata, sqlite, sqlite_unlock_notify
  • Git version:git version 2.30.2
  • Operating system: docker
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No (the problem is about code indexer so I can't do it there)
  • Log gist:

I set logo level to INFO in app.ini

Description

I'm trying to build a gitea with Code Search feature. And I hope it will immediately refresh index after any updates.
I choose elastic search as the engine and in most cases it works well. But when I migrated a repository from Github and tried using Code Search feature on the UI to find a line from that repository, it did not return any output. And in log it seems like that gitea didn't report to elastic search after migrating.
I have to manually commit something new to the new repo to trigger report to elastic search, or delete the old elastic search topic and create a new index.
I've found a related issue: #16152, but my search engine is different so I still post a new issue.

Because the original log does not provide enough info for me, I add a few log.Info codes with "zyx test" as prefix, and tactically it won't affect the original progress.
the log
image

In MigrateRepositoryGitData() , gitea has already set repo.IsEmpty to false(means that the repo in Github is not empty). But when doing NotifyMigrateRepository(), gitea create a new repo, so it still thinks the repo is empty and won't report to elastic search.

So my question is, is there a special reason for gitea to consider new migrated repo as empty? If so, it seems to me that NotifyMigrateRepository() shouldn't check repo.IsEmpty field when reporting to code search engine.

relevant code NotifyMigrateRepository(with my log codes)
image

Thanks for reading my question, look forward to your kind reply~

Screenshots

@lunny
Copy link
Member

lunny commented Sep 8, 2021

@Joannazyx Could you help to confirm that #16991 fix this?

@Joannazyx
Copy link
Author

Joannazyx commented Sep 9, 2021

@lunny thanks for your reply and timely bugfix.
I rebuild gitea from the lastest main branch, and #16991 fix this.
Now after migrating a new repo, gitea will immediately report to elastic search engine.
image

zeripath pushed a commit that referenced this issue Sep 9, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants