Need help with Gerrit migration

819 views
Skip to first unread message

hari

unread,
May 17, 2023, 6:10:47 AM5/17/23
to Repo and Gerrit Discussion

Hi,

Currently we have couple of gerrit production instances (Say A and B)  running on 2.16.28 and migrated to notedb. Now due to a requirement we need to migrate these 2 gerrit instances to a new gerrit instance, called "C"  ( This will be a empty instance, running on same 2.16.28version). My doubts

- can we use importer plugin to migrate the projects from A and B to C ? 
-  if importer plugin don't have the capabilities to migrate projects that are already migrated to notedb. Then the only option is to move the entire repo and run reindex, correct? in this case how to avoid change numbering conflict if say instance A and B have same numbered CL? 

I have went through posts with similar requirement in this forum but unfortunately none of them have a working solution.  Any pointers will be highly appreciated.

Sven Selberg

unread,
May 17, 2023, 7:05:56 AM5/17/23
to Repo and Gerrit Discussion
On Wednesday, May 17, 2023 at 12:10:47 PM UTC+2 hari wrote:

Hi,

Currently we have couple of gerrit production instances (Say A and B)  running on 2.16.28 and migrated to notedb. Now due to a requirement we need to migrate these 2 gerrit instances to a new gerrit instance, called "C"  ( This will be a empty instance, running on same 2.16.28version). My doubts

- can we use importer plugin to migrate the projects from A and B to C ? 
-  if importer plugin don't have the capabilities to migrate projects that are already migrated to notedb. Then the only option is to move the entire repo and run reindex, correct? in this case how to avoid change numbering conflict if say instance A and B have same numbered CL? 

The change number is unique per project [1], so the only way a numbering conflict could arise is when you have "the same" git project, with changes, in two different Gerrit instances and merge those two git projects.
That being said, in 2.16 I'm not sure if there are places in core or plugins where change number uniqueness is assumed which could cause issues if you have the same change number in 2 different projects.
Some such cases are outlined by Luca here: https://gerrit-review.googlesource.com/c/homepage/+/354234

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-id

hari

unread,
Jun 5, 2023, 5:30:30 AM6/5/23
to Repo and Gerrit Discussion



Thanks Sven, we were able to overcome the change conflict by renumbering the change #s. But now unsure how to proceed with account conflict. We have same user account in instance A and B but with different account id. 

In Instance A:

[externalId "username:manishn"]

        accountId = 1004590 

In Instance B:

 [externalId "username:manishn"]

        accountId = 800

Any pointers on how to deal with account conflict when migrating projects from one instance to other? 

Sven Selberg

unread,
Jun 5, 2023, 6:27:19 AM6/5/23
to Repo and Gerrit Discussion
Just my thoughts, not unlikely there's someone else that has more experience with merging accounts that will disagree. ;-)

One option is to manually merge the two accounts.
In most cases they should be more or less identical so basically:
1. Verify that all settings are the same.
2. Just refrain from migrating accountId=800.
One issue with this option is that the change-metadata (change-owner...) is connected to the account ID so in that case you would have to change all references in the change-metadata to link to the "new" AccountID.

Another option is to keep both account, but changing username/email on the "unused" account and deactivate it.
Don't know which dragons lies in this option.
 

Luca Milanesio

unread,
Jun 5, 2023, 6:31:41 AM6/5/23
to Repo and Gerrit Discussion, Luca Milanesio, Sven Selberg
There is also the option to have an “imported” identity of the old account-id, assuming is coming from a server with a different server-id.

See [1] for more info.

HTH

Luca.


 

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/5b925a45-f10c-4504-b2c1-75229f4400acn%40googlegroups.com.

tech....@gmail.com

unread,
Jan 23, 2024, 5:30:01 AM1/23/24
to Repo and Gerrit Discussion
On Monday 5 June 2023 at 16:01:41 UTC+5:30 Luca Milanesio wrote:

On 5 Jun 2023, at 11:27, Sven Selberg <sven.s...@axis.com> wrote:



On Monday, June 5, 2023 at 11:30:30 AM UTC+2 hari wrote:



Thanks Sven, we were able to overcome the change conflict by renumbering the change #s. But now unsure how to proceed with account conflict. We have same user account in instance A and B but with different account id. 

In Instance A:

[externalId "username:manishn"]

        accountId = 1004590 

In Instance B:

 [externalId "username:manishn"]

        accountId = 800

Any pointers on how to deal with account conflict when migrating projects from one instance to other? 

Just my thoughts, not unlikely there's someone else that has more experience with merging accounts that will disagree. ;-)

One option is to manually merge the two accounts.
In most cases they should be more or less identical so basically:
1. Verify that all settings are the same.
2. Just refrain from migrating accountId=800.
One issue with this option is that the change-metadata (change-owner...) is connected to the account ID so in that case you would have to change all references in the change-metadata to link to the "new" AccountID.

Another option is to keep both account, but changing username/email on the "unused" account and deactivate it.
Don't know which dragons lies in this option.

There is also the option to have an “imported” identity of the old account-id, assuming is coming from a server with a different server-id.

See [1] for more info.

HTH

Luca.

Hi Luca,
Please guide me through how to migrate from server1 to server2 using this document.
  1. Create the destination project of the import in Gerrit 

  2. Push the changes under refs/changes/* from the source Gerrit into the newly created destination project. - which commands are needed here to push open MRs. also help me how to clone the source repository which can get all refs/changes/* data.

Luca Milanesio

unread,
Jan 23, 2024, 6:20:50 AM1/23/24
to Repo and Gerrit Discussion, Luca Milanesio, tech....@gmail.com
I actually did a step-by-step presentation at the Gerrit User Summit 2022 in London (see [2]), hopefully that would guide you through.

using this document.
  1. Create the destination project of the import in Gerrit 

  2. Push the changes under refs/changes/* from the source Gerrit into the newly created destination project. - which commands are needed here to push open MRs.


‘git push’ (see [3]), that’s the command to push refs between Git repositories.

Bear in mind that you would need to push *behind Gerrit’s back*, otherwise Gerrit would reject the operation.

  1. also help me how to clone the source repository which can get all refs/changes/* data.

No need to close, just SSH into the first Gerrit server (e.g. gerrit1), cd into the bare repository and from there push to the destination.

HTH

Luca

[2] https://youtu.be/Su1OpJ_s850



 

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/5b925a45-f10c-4504-b2c1-75229f4400acn%40googlegroups.com.


--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

Luca Milanesio

unread,
Jan 23, 2024, 6:34:45 AM1/23/24
to Repo and Gerrit Discussion, Luca Milanesio, tech....@gmail.com
Sorry, I misspelled it :-) … I meant “no need to clone"

tech....@gmail.com

unread,
Jan 23, 2024, 9:34:55 AM1/23/24
to Repo and Gerrit Discussion
Thanks for the info.
Yes, I followed the video. and the procedure.
The following error facing while pushing changes from one bare repository

 ! [remote rejected] refs/changes/99/74699/meta -> refs/changes/99/74699/meta (NoteDb update requires -o notedb=allow)

Fabio Ponciroli

unread,
Jan 23, 2024, 9:41:44 AM1/23/24
to tech....@gmail.com, Repo and Gerrit Discussion
Hi,


Did you check in any of these [1] posts for any help? 

 

Matthias Sohn

unread,
Jan 23, 2024, 9:44:21 AM1/23/24
to Fabio Ponciroli, tech....@gmail.com, Repo and Gerrit Discussion
Looks like you tried to push this to Gerrit, which doesn't work as
Luca explained above.
You need to push behind Gerrit's back, e.g. using file:// URL of the
repo you are pushing to.
Alternatively you can fetch the refs in the reverse direction (again
behind Gerrit's back).
> To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/CAPYXC5Pht5TrNtjqu-M_7QvVN%3DqYvXWVer0FGc7oGceDCzErww%40mail.gmail.com.

Shad Perwez

unread,
Jan 29, 2024, 11:35:23 PM1/29/24
to Matthias Sohn, Fabio Ponciroli, Repo and Gerrit Discussion
Thanks for informing. I was able to push and reindex from backend server directly. 
Changes are visible on the UI.
But how to search the changes in the searchbox. As it will search the existing local change . How to search a migrated chage using project name?

Fabio Ponciroli

unread,
Jan 30, 2024, 4:19:14 AM1/30/24
to Shad Perwez, Matthias Sohn, Repo and Gerrit Discussion
Hi Shad,


You should be able to search by project. There is an open issue I am working on [1] to allow searching by change number.
Are you having any issues in the search by project?

tech....@gmail.com

unread,
Jan 30, 2024, 4:46:29 AM1/30/24
to Repo and Gerrit Discussion
How to search by project? 
Let's assume one project <android/repo> has 50000+ changes and I want to search for change number-45555  associated with that repo.
What is the right keywords to search it on the search bar?

Fabio Ponciroli

unread,
Jan 30, 2024, 4:54:18 AM1/30/24
to tech....@gmail.com, Repo and Gerrit Discussion
Hi,



Can you please try to find the answer in the documentation and if it is not clear ask for help?
 

tech....@gmail.com

unread,
Jan 31, 2024, 1:23:55 AM1/31/24
to Repo and Gerrit Discussion
Hi,
Yes, I have gone through the docu. And was not able to search the change with below searching keywords.
1. project:int_tpf/nets-mw-lpad-imported change:108932
2. project:int_tpf/nets-mw-lpad-imported-change:108932
3. int_tpf/nets-mw-lpad-imported-108932

Sven Selberg

unread,
Jan 31, 2024, 1:44:37 AM1/31/24
to Repo and Gerrit Discussion
This is the correct query `project:$PROJECT change:CHANGE_NUMBER`
 
2. project:int_tpf/nets-mw-lpad-imported-change:108932
3. int_tpf/nets-mw-lpad-imported-108932

Then it seems like that change hasn't been indexed.

tech....@gmail.com

unread,
Jan 31, 2024, 1:59:28 AM1/31/24
to Repo and Gerrit Discussion
Completed reindex and secondary change index as well successfully. 

Reindexing changes: changes: 100% (235/235), project-slices: 100% (1/1), Slicing projects: 100% (5/5), done
Reindexed 235 documents in changes index in 4.5s (52.8/s)
Index changes in version 82 is ready

FYI, we are using Gerrit v3.8.3 , is it the right version we are tasing the feature on ?

Fabio Ponciroli

unread,
Jan 31, 2024, 3:21:17 AM1/31/24
to tech....@gmail.com, Repo and Gerrit Discussion
Hi,

For imported changes, it is not possible to search by change number [1].
I am working on a fix for it.

Thanks,
Ponch

 

tech....@gmail.com

unread,
Jan 31, 2024, 3:48:31 AM1/31/24
to Repo and Gerrit Discussion
Yes, I understood. But there was a way to search it using project and change combination. 
My concern is that , why   `project:$PROJECT change:CHANGE_NUMBER` not  working on v3.8.3 version
I am working on a fix for it.
In which version the fix would be released ?? 3.8.x or 3.9.x ?

Fabio Ponciroli

unread,
Jan 31, 2024, 3:53:28 AM1/31/24
to tech....@gmail.com, Repo and Gerrit Discussion
Hi,

It will go in master and probably end up in 3.10.
 

Matthias Sohn

unread,
Jan 31, 2024, 5:33:37 AM1/31/24
to Fabio Ponciroli, tech....@gmail.com, Repo and Gerrit Discussion
To my experience, using Gerrit 3.9.1-63-g84deab1e49 on gerrithub.io, you can search for imported changes using their changeId e.g.

Fabio Ponciroli

unread,
Jan 31, 2024, 5:37:18 AM1/31/24
to Matthias Sohn, tech....@gmail.com, Repo and Gerrit Discussion
Hi,

On Wed, 31 Jan 2024 at 10:33, Matthias Sohn <matthi...@gmail.com> wrote:
To my experience, using Gerrit 3.9.1-63-g84deab1e49 on gerrithub.io, you can search for imported changes using their changeId e.g.

O yes, search by changeId works fine.

 

tech....@gmail.com

unread,
Jan 31, 2024, 7:10:42 AM1/31/24
to Repo and Gerrit Discussion
On Wednesday 31 January 2024 at 16:07:18 UTC+5:30 Fabio Ponciroli wrote:
Hi,

On Wed, 31 Jan 2024 at 10:33, Matthias Sohn <matthi...@gmail.com> wrote:
To my experience, using Gerrit 3.9.1-63-g84deab1e49 on gerrithub.io, you can search for imported changes using their changeId e.g.

O yes, search by changeId works fine.
Yeah, but change Ids are not unique in lot of cases in our production instance. this might lead to other issues

Luca Milanesio

unread,
Jan 31, 2024, 7:29:32 AM1/31/24
to Repo and Gerrit Discussion

On 31 Jan 2024, at 12:10, tech....@gmail.com <tech....@gmail.com> wrote:



On Wednesday 31 January 2024 at 16:07:18 UTC+5:30 Fabio Ponciroli wrote:
Hi,

On Wed, 31 Jan 2024 at 10:33, Matthias Sohn <matthi...@gmail.com> wrote:
To my experience, using Gerrit 3.9.1-63-g84deab1e49 on gerrithub.io, you can search for imported changes using their changeId e.g.

O yes, search by changeId works fine.
Yeah, but change Ids are not unique in lot of cases in our production instance. this might lead to other issues

You should then wait until Gerrit v3.10 IMHO, which should be out in Spring.

@Ponch has a change (under review) for allowing search by change number for imported changes.

Luca.

Shad Perwez

unread,
Feb 1, 2024, 12:09:15 AM2/1/24
to Luca Milanesio, Repo and Gerrit Discussion


On Wed, 31 Jan, 2024, 5:59 pm Luca Milanesio, <luca.mi...@gmail.com> wrote:


On 31 Jan 2024, at 12:10, tech....@gmail.com <tech....@gmail.com> wrote:



On Wednesday 31 January 2024 at 16:07:18 UTC+5:30 Fabio Ponciroli wrote:
Hi,

On Wed, 31 Jan 2024 at 10:33, Matthias Sohn <matthi...@gmail.com> wrote:
To my experience, using Gerrit 3.9.1-63-g84deab1e49 on gerrithub.io, you can search for imported changes using their changeId e.g.

O yes, search by changeId works fine.
Yeah, but change Ids are not unique in lot of cases in our production instance. this might lead to other issues

You should then wait until Gerrit v3.10 IMHO, which should be out in Spring.

@Ponch has a change (under review) for allowing search by change number for imported changes.
Sure. Then we sould wait. 
Apart from that. We are using java open jdk 11 in our test instances instead of Oracle, will it be impacting the current behaviour?

lucamilanesio

unread,
Feb 16, 2024, 5:51:54 PM2/16/24
to Repo and Gerrit Discussion
FYI, Matthias Sohn has presented yesterday how the JGit/EGit migration was done between Gerrit servers with different versions.
The video of the recording is available at [1].

HTH

Luca.

Reply all
Reply to author
Forward
0 new messages