Page MenuHomePhabricator

Support renaming repositories in Gerrit
Closed, ResolvedPublic

Description

My understanding is that the Gerrit metadata will no more be in the database and would only be in the Git repository (known as NoteDB). Gerrit the index those metadata from git into a faster system (the secondary index, supported by Lucene).

So if I get it right, renaming a repository would mean something like:

  • stop Gerrit
  • move the git repository on disk
  • run offline indexing to get rid of the old repository and notice the new repository
  • start Gerrit
  • Possibly flush the project_list cache? Had an issue with the parentproject:integration query after deleting a repository ( T263682 ). Can be done using gerrit flush-caches --cache project_list

But:

  • the offline indexing takes age iirc (roughly an hour when we did it for Gerrit 3.2 upgrade).
  • online indexing does not seem to support deleting informations for a no more existing repository

Gerrit mailing list discussion (2020-09-14): https://groups.google.com/g/repo-discuss/c/ZPVSc5h2hNw

Event Timeline

Filled that task since I could not find a task to support renaming repositories. At least no task that express the feature request.

This should be supported with the online indexer I think (I remember testing this but it was on a different version and also a while ago)

Under 2.16+ you need to reindex the project index and changes.

I have bring it up to the Gerrit discussion mailing list at https://groups.google.com/g/repo-discuss/c/ZPVSc5h2hNw

hashar claimed this task.

From T201953, I have finally added to our Gerrit instance the rename-project plugin which provides a rename-project ssh command (as well as a REST API entry point).

I think the interest of this task was to detail the manual steps that would be required to complete a project renaming, notably flushing the project-list cache or reindexing the changes. The plugin handles that for us.

Thus I guess we can mark this one as solved (by the plugin) and remove the stalled state from all parent tasks.

Change #1097425 had a related patch set uploaded (by Hashar; author: Hashar):

[All-Projects@refs/meta/config] Grant "Rename project" to "Administrators"

https://gerrit.wikimedia.org/r/1097425

Change #1097425 merged by Hashar:

[All-Projects@refs/meta/config] Grant "Rename project" to "Administrators"

https://gerrit.wikimedia.org/r/1097425

Change #1098021 had a related patch set uploaded (by Hashar; author: Hashar):

[All-Projects@refs/meta/config] Revert "Grant "Rename project" to "Administrators""

https://gerrit.wikimedia.org/r/1098021

Change #1098021 merged by Hashar:

[All-Projects@refs/meta/config] Revert "Grant "Rename project" to "Administrators""

https://gerrit.wikimedia.org/r/1098021

When renaming operations/debs/wmf-sre-laptop to operations/debs/wmf-laptop (T365985), I have noticed the renaming is not replicated. Filed as a follow up task T398401

Change #1165832 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/puppet@production] gerrit: config replicas for rename-project plugin

https://gerrit.wikimedia.org/r/1165832

Change #1165832 merged by Dzahn:

[operations/puppet@production] gerrit: config replicas for rename-project plugin

https://gerrit.wikimedia.org/r/1165832

Change #1175122 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/puppet@production] gerrit: replica renames as "gerrit2" application user

https://gerrit.wikimedia.org/r/1175122

Change #1175122 merged by Dzahn:

[operations/puppet@production] gerrit: replicate repo renames as "gerrit2" application user

https://gerrit.wikimedia.org/r/1175122