allowanonplz123 allowanonplz123 - 1 year ago 102
SQL Question

Fully delete abandoned commit from Gerrit DB AND 'query'

I am trying to fully purge a change from Gerrit and running into some problems.

Previously I tried to follow this guide to achieve my goal:

I messed this up however, and somehow managed to do the following:

  • Purge the offending change-id from all the tables in the Gerrit gsql database

  • The change still appears in the web-interface, but if I click on it, it fires an error: "The page you requested was not found, or you do not have permission to view this page."

  • If I run 'gerrit query' for the change, it still shows up, replete with all information.

Where is the change information coming from if it is not in the DB??? I also tried flushing all caches. Is it somewhere in the search index for lucene or something?

This is not super important, but it is really driving me nuts!

Answer Source

Queries use Gerrit's secondary index (by default Lucene-based) so if you modify the database outside of Gerrit you have to reindex the data with the reindex command:

$ java -jar path/to/gerrit.war reindex -d path/to/gerrit-site-dir

This command should only be executed when Gerrit isn't running.