Renaming a repository

140 views
Skip to first unread message

Antoine Musso

unread,
Sep 14, 2020, 3:45:53 AM9/14/20
to Repo and Gerrit Discussion
Hello,

I am looking at a process to be able to rename repositories in our
Gerrit installation. Our environment is:

* Gerrit 3.2.3
* fully on NoteDB (by that I mean there is no more any MySQL database
connection)
* the secondary indices are backed up by Lucene.
* we have multiple replicas

Seems to me it might be as easy as:

* stopping Gerrit
* physically moving the git repository on disk to its new place
* start Gerrit
* remove the old project from all replicas

My trouble comes to updating the secondary indices. I guess I can have
the new project location indexed using:

gerrit index changes-in-project <new project>

But will it update the old entries to reflect the new project name?

Is there a way to remove obsolete entries for the old project or does
that require a full reindexing?

I imagine that any URL referring to the old project ends up being
broken, but a URL only having the change number will be fine.

I would appreciate any pointer, resource, documentation, hint anyone
might have.

--
Antoine "hashar" Musso

Jakub Sokol

unread,
Sep 14, 2020, 3:52:04 AM9/14/20
to repo-d...@googlegroups.com
Hi!

I've been recently tinkering around with renaming/symlinking
repositories on Gerrit, so I thought my observations may help ;-)

On 14.09.2020 09:45, Antoine Musso wrote:
> Hello,
>
> I am looking at a process to be able to rename repositories in our
> Gerrit installation.  Our environment is:
>
> * Gerrit 3.2.3
> * fully on NoteDB (by that I mean there is no more any MySQL database
> connection)
> * the secondary indices are backed up by Lucene.
> * we have multiple replicas
>
> Seems to me it might be as easy as:
>
> * stopping Gerrit
> * physically moving the git repository on disk to its new place
> * start Gerrit
> * remove the old project from all replicas
From my experience, that's the way to do it. I've done it in a similar
way with backwards compatibility, using symlinks - but I wouldn't
recommend it in the long run, there are problems with e.g. APIs not
working correctly
>
> My trouble comes to updating the secondary indices. I guess I can have
> the new project location indexed using:
>
>   gerrit index changes-in-project <new project>
>
> But will it update the old entries to reflect the new project name?
That's all I do after a rename and after a short while e.g. all entries
on dashboard get updated project, they become searchable using new name.
>
> Is there a way to remove obsolete entries for the old project or does
> that require a full reindexing?
>
> I imagine that any URL referring to the old project ends up being
> broken, but a URL only having the change number will be fine.
>
> I would appreciate any pointer, resource, documentation, hint anyone
> might have.
>
BR,
Jakub

Best Regards,
Jakub

Matthias Sohn

unread,
Sep 14, 2020, 4:52:38 AM9/14/20
to Antoine Musso, Repo and Gerrit Discussion

Antoine Musso

unread,
Sep 14, 2020, 4:03:30 PM9/14/20
to Matthias Sohn, Repo and Gerrit Discussion, Jakub Sokol
On 14/09/2020 10:52, Matthias Sohn wrote:
>
>
> try the rename-project plugin [1] which should care for the necessary steps.
> Find documentation in [2].
>
> [1]
> https://gerrit.googlesource.com/plugins/rename-project/+/refs/heads/stable-3.2
> [2]
> https://gerrit.googlesource.com/plugins/rename-project/+/refs/heads/stable-3.2/src/main/resources/Documentation

Hello,

Of course there is a plugin for it :] This morning I thought the plugin
was not supporting noteDb. Turns out that has been addressed!

https://bugs.chromium.org/p/gerrit/issues/detail?id=10525

Thank you for the hints.

--
Antoine "hashar" Musso
Release Engineering
Reply all
Reply to author
Forward
0 new messages