Reindex issue with gerrit 3.9.1 after copying the repos from another server

501 views
Skip to first unread message

Sweta Asnodkar

unread,
Apr 23, 2024, 2:28:10 AM4/23/24
to Repo and Gerrit Discussion
Hello Team,

I setup gerrit new server. I copied the repos from our production server. When I try to start gerrit, it gives me below error

[wnc-0]] WARN  com.google.gerrit.server.index.change.AllChangesIndexer : Failed to read change 799 for indexing
com.google.gerrit.server.notedb.InvalidServerIdException: invalid server id, expected 9d6291cb-c956-429a-be2a-f18a07a5f4ae: actual: da954faa-1105-40b5-9aee-3e1b1ec9f210


It is expecting the server id of production sever from where I have copied the repos.
Id there any work around for this?

If I copy the same server id as production server on the new gerrit, will it affect the production server? I don't want to harm the production server.

Thanks,
Sweta

Sven Selberg

unread,
Apr 23, 2024, 4:36:32 AM4/23/24
to Repo and Gerrit Discussion
I believe this more-or-less a safety feature so that you can control which gerrit servers you should import changes and change-metadata from.
The server-id is part of the author of the Note DB commits:
```
commit cfc49e826887b3b8a4a4a733315ad4fdc99f2d1d
Author: Gerrit User $USER_ID <$USER_ID@$SERVER_ID>
Date:   Wed Jun 12 11:21:20 2019 +0000
```
By adding the server id from production as an Imported server id (https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#gerrit.importedServerId) in the configuration of your staging instance you acknowledge that the staging server should accept changes and change-metadata created by the production server(s).
The only way it might become an issue is if you add the staging-server's server-id as importedServerId in production as that opens up an opportunity for making mistakes.

/Sven


Thanks,
Sweta

Sweta Asnodkar

unread,
Apr 24, 2024, 4:24:53 AM4/24/24
to Repo and Gerrit Discussion
Thank you Sven for your reply.

>> I added the property as you mentioned, and reindexing worked and gerrit came up too.
Just one issue:
          Changes which I open now, for Owner it is said "Name of user not set"
           Also the changes created by this user is not visible. 
Is it because the author details are associated with the server id?

Thanks,
Sweta

 


Thanks,
Sweta

Matthias Sohn

unread,
Apr 24, 2024, 5:47:21 AM4/24/24
to Sweta Asnodkar, Repo and Gerrit Discussion
Account information is stored in the All-Users repository. This means when transferring changes from another server
you also need to import the respective account information used in those changes otherwise their data is unknown
to the server where you imported changes.
 
Thanks,
Sweta

 


Thanks,
Sweta

--
--
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/28eccc71-f3ee-49fd-906a-6ddddad80780n%40googlegroups.com.

Sweta Asnodkar

unread,
Apr 25, 2024, 2:51:22 AM4/25/24
to Repo and Gerrit Discussion
>> Thank you for your reply.
>> I have already migrated the All-Users repository, is there a specific configuration change or something which has to be made? 
>> How do I import the account information?  

Sweta Asnodkar

unread,
May 3, 2024, 1:10:59 AM5/3/24
to Repo and Gerrit Discussion
Sorry for spam, but can someone please help me here? I am stuck at one point to find out how do I import the account information to another server. 

Sven Selberg

unread,
May 3, 2024, 2:32:51 AM5/3/24
to Repo and Gerrit Discussion
Have you done an offline reindex of accounts after you copied All-Projects?

`GERRIT_SITE$ java -jar bin/gerrit.war reindex --index accounts`

Sweta Asnodkar

unread,
May 14, 2024, 2:03:24 AM5/14/24
to Repo and Gerrit Discussion
Hi Sven,

Yes I did run  java -jar bin/gerrit.war reindex --index accounts. Reindexed 601 accounts but still not showing the owners name (Shows Name of user not set as attached in the screenshot) in the change
Collecting accounts:    601
Reindexing accounts:    100% (601/601)
Reindexed 601 documents in accounts index in 0.6s (933.2/s)

Thanks
Sweta
Capture.PNG

Matthias Sohn

unread,
May 14, 2024, 4:41:23 AM5/14/24
to Sweta Asnodkar, Repo and Gerrit Discussion
If you know the email address of the account you can try to search it to find out if it's present in All-Users.
E.g. from a gerrit test site:

All-Users.git (BARE:refs/meta/config)]$ git grep user_1 refs/meta/external-ids
refs/meta/external-ids:73bc819d6010850ce903d05f6c8e4ddee8675ca0:        email = use...@example.com

All-Users.git (BARE:refs/meta/config)]$ git show refs/meta/external-ids:73bc819d6010850ce903d05f6c8e4ddee8675ca0
[externalId "gerrit:user1"]
        accountId = 1000002
        email = use...@example.com

All-Users.git (BARE:refs/meta/config)]$ git show refs/users/02/1000002:account.config
[account]
        preferredEmail = use...@example.com
        fullName = User One
        displayName = one


 
Thanks
Sweta

 

 
Thanks,
Sweta

 


Thanks,
Sweta

--
--
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/28eccc71-f3ee-49fd-906a-6ddddad80780n%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.

Sweta Asnodkar

unread,
May 14, 2024, 5:14:13 AM5/14/24
to Repo and Gerrit Discussion
Hi Mathias,

I am able to search for the users using above commands. But problem is  the display information related to the users and the changes associated with that user.
When I open a change and click on the user there are no associated changes which are displayed. 

I am kind of stuck as I have to also implement the OWNERs plugin for the same. Unless I get the user information, owners plugin won't work for assigning reviewers.
Capture1.PNG
Reply all
Reply to author
Forward
0 new messages