Need more information about following terminology

41 views
Skip to first unread message

jiga...@gmail.com

unread,
Apr 11, 2018, 11:31:07 AM4/11/18
to Repo and Gerrit Discussion
I am new to Gerrit. I have come across the term secondary index and online indexing (in the context of Gerrit). I have checked the documents to get more idea about this terms.

It was first used in 2.8 release note:
Existing search operations use the secondary index, when enabled, to increase performance and reduce resource usage.
I assume that secondary index was introduced for text search.

Online reindexing was first used in Gerrit v2.11 (https://gerrit.googlesource.com/gerrit/+/v2.14-rc1/ReleaseNotes/ReleaseNotes-2.11.txt). This highlights that online reindexing saves the time taken by reindex program. Gerrit document covers how to use online reindexing. One must be running the Gerrit service prior to running online reindex. Given this, How can one use it efficiently? 
For example, currently, I have more than 5000 projects in Gerrit v2.9. I am migrating it to Gerrit v2.14. I am going to upgrade sequentially. Whenever I upgrade to newer version of Gerrit(v2.9, v2.10, v2.11, v2.12) then the first thing I have to do is to run reindex program (using java -jar gerrit.war reindex). If I skip this step then I get "No index version ready; run Reindex". I can not simply skip this step and end up spending time on reindexing offline. Any recommendation on how should I use online reindexing?

Sven Selberg

unread,
Apr 12, 2018, 2:49:33 AM4/12/18
to Repo and Gerrit Discussion
Hi,

Since v2.8 Gerrit uses a secondary index (default Lucene) that speeds up queries. So when data is updated it is not only updated in the DB it is also indexed in the secondary index.
Every time you upgrade a major version you have to recreate the index to correspond with the index definitions for the new version.
Up until v2.11 you needed to do this offline, (stop Gerrit, upgrade, init, reindex, start Gerrit). Since reindex took a large amount of time for larger installations online reindex was introduced in v2.11.
Online reindex means that if you don't need to do an offline reindex (stop Gerrit, upgrade, init, start Gerrit). Gerrit will use the old index for read and create the new index continually. When the new index is ready Gerrit will automatically switch to use the new index.

In your case since you upgrade from v2.8 to 2.14 I'm guessing your best bet is to upgrade to v2.14 and do an offline reindex. Don't remember if you need to upgrade to some intermediary version first it should be described in the release notes.

/Sven

jiga...@gmail.com

unread,
Apr 12, 2018, 10:10:41 AM4/12/18
to Repo and Gerrit Discussion
Thanks for the response. 

I believe if I will upgrade directly from v2.9 to 2.14 then I will run into issues mentioned in https://groups.google.com/forum/#!topic/repo-discuss/IHP1fTRuOKI 

Additionally, official release note https://www.gerritcodereview.com/releases/2.13.md points following:
To use online reindexing for the changes secondary index when upgrading to 2.13.x, the server must first be upgraded to 2.8 (or 2.9) and then through 2.10, 2.11 and 2.12. Skipping a version will prevent the online reindexer from working.

Sven Selberg

unread,
Apr 12, 2018, 11:15:58 AM4/12/18
to Repo and Gerrit Discussion
My point was more that I don't think you need to reindex for each version you upgrade to you should be able to upgrade to v2.14 and then do an offline reindex (if you can afford the downtime).
I don't remember if you need to upgrade to intermediary versions if you do it with this approach.
The documentation for v2.13 states "If reindexing will be done offline, you may ignore these warnings and upgrade directly to 2.13.x using the following command that will reindex both changes and accounts secondary indexes"
But according to the thread they had to upgrade to each intermediary version to make it work, so I guess that is your best bet and then do an offline reindex.

Perhaps someone has some more insight into what would be the correct approach?
Reply all
Reply to author
Forward
0 new messages