Deleting a repo does not delete repo_index #3713

Closed
opened 2025-11-02 05:22:45 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @guillep2k on GitHub (Aug 1, 2019).

  • 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.

Originally created by @guillep2k on GitHub (Aug 1, 2019). - Gitea version (or commit ref): v1.9.0 - Git version: 2.22.0 - Operating system: CentOS 7 - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] 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.
GiteaMirror added the type/bug label 2025-11-02 05:22:45 -06:00
Author
Owner

@guillep2k commented on GitHub (Aug 3, 2019):

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.

@guillep2k commented on GitHub (Aug 3, 2019): 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3713