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

Deleting a repo does not delete repo_index #7703

Closed
2 of 7 tasks
guillep2k opened this issue Aug 1, 2019 · 1 comment · Fixed by #7734
Closed
2 of 7 tasks

Deleting a repo does not delete repo_index #7703

guillep2k opened this issue Aug 1, 2019 · 1 comment · Fixed by #7734
Labels
Milestone

Comments

@guillep2k
Copy link
Member

  • Gitea version (or commit ref): v1.9.0
  • Git version: 2.22.0
  • Operating system: CentOS 7
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

The function DeleteRepository() at models/repo.go doesn't delete repo indexes.

func DeleteRepository(doer *User, uid, repoID int64) error {
}

To reproduce:

  • Configure your installation to create repo indexes.
  • Create a repository with default README.md and .gitignore.
  • Edit README.md and add enought text so at least some of it goes into the repo_index. For instance, I've added:
int WinMain(int argc, char* argv[])
{
}
  • Make sure the index was created, and run the following query in the database:
gitea=# select r.id, r.name, i.commit_sha, s.sha, s.description
from repo_indexer_status i full outer join repository r on i.repo_id = r.id
left outer join commit_status s on s.repo_id = r.id order by r.id;
 id |           name           |                commit_sha                | sha | description
----+--------------------------+------------------------------------------+-----+-------------
 63 | repoindextest            | 6186ba7ae6d27769ac4e1da50ec25622ea13adbb |     |
(1 row)
  • Delete the repository from Gitea using the GUI (or API too, I guess).
  • Run the query in the database again:
gitea=# select r.id, r.name, i.commit_sha, s.sha, s.description
from repo_indexer_status i full outer join repository r on i.repo_id = r.id
left outer join commit_status s on s.repo_id = r.id order by r.id;
 id |           name           |                commit_sha                | sha | description
----+--------------------------+------------------------------------------+-----+-------------
    |                          | 6186ba7ae6d27769ac4e1da50ec25622ea13adbb |     |
(1 row)

As you see, there's an orphaned record in repo_indexer_status. Probably in the index itself.

@lunny lunny added the type/bug label Aug 1, 2019
@guillep2k
Copy link
Member Author

I've found out that the actual index data is indeed properly deleted. Only the repo_indexer_status row is left behind. I'll PR this when I have a minute.

@lafriks lafriks added this to the 1.9.1 milestone Aug 4, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
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.

3 participants