Skip to content

Deleting a repo does not delete repo_index #7703

Closed
@guillep2k

Description

@guillep2k
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.

Activity

guillep2k

guillep2k commented on Aug 3, 2019

@guillep2k
MemberAuthor

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.

added this to the 1.9.1 milestone on Aug 4, 2019
locked and limited conversation to collaborators on Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @lunny@lafriks@guillep2k

      Issue actions

        Deleting a repo does not delete repo_index · Issue #7703 · go-gitea/gitea