Page MenuHomePhabricator

Convert Gerrit to use H2 as the database
Open, HighPublic


Since 2.16, all data has been migrated to NoteDB except it still requires a db connection and also a single table "schema_version" which has a single row.

This requires us doing T200739 first.

This task will fix T176532

Related Objects

Event Timeline

Paladox created this task.Dec 4 2018, 6:39 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 4 2018, 6:39 PM
Paladox renamed this task from Convert Gerrit's to use H2 as the database after 2.16 upgrade to Convert Gerrit to use H2 as the database after 2.16 upgrade.Dec 4 2018, 6:41 PM
Paladox updated the task description. (Show Details)
Dzahn added a subscriber: Dzahn.Dec 4 2018, 6:51 PM
Dzahn added a comment.EditedDec 4 2018, 7:05 PM

On one hand i would love this because it would make the gerrit codfw slave work which is blocked to lack of misc mysql cluster there. (because of that the DBA tag wasn't wrong to me fwiw). If we wouldn't need mysql that would be a nice solution for T176532.

But on the other hand i am afraid that this is not suitable for large installations with many users like ours. I checked upstream docs and unfortunately they confirmed those concerns.

Using the embedded H2 database is the easiest way to get a Gerrit site up and running, making it ideal for proof of concepts or small team servers. On the flip side, H2 is not the recommended option for large corporate installations. This is because there is no easy way to interact with the database while Gerrit is offline, it’s not easy to backup the data, and it’s not possible to set up H2 in a load balanced/hotswap configuration.

Those Docs are based on using H2 fully, by that i mean not using NoteDB. In 2.16 it would be a single table called "schema_version" that is used by the gerrit init when doing schema upgrades. This table is not used by the UI (as far as i know).

Dzahn triaged this task as Normal priority.Dec 5 2018, 5:15 PM

Reading notes from

To convert you setup a vanilla gerrit site (weather it be in a separate directory or on your own laptop and copy the db).

Then just copy the h2 db and switch to h2 in the db config.

Mentioned in SAL (#wikimedia-cloud) [2019-02-05T17:35:00Z] <paladox> temporarily disabling puppet on gerrit-test3 whilst trying T211139

I've just successfully switched from using mysql to h2 for that single table.

It's very easy to migrate, setup just a fake 2.16 site that uses h2 as the db then click y for NoteDB, once you have gone through all the setup, copy the ReviewDB* files from <gerrit_site>/db/ to /var/lib/gerrit2/review_site/db/ then merge

Change 488093 had a related patch set uploaded (by Paladox; owner: Paladox):
[operations/puppet@production] gerrit: Switch db from mysql to H2

Paladox raised the priority of this task from Normal to High.Mar 19 2019, 6:21 PM
Paladox renamed this task from Convert Gerrit to use H2 as the database after 2.16 upgrade to Convert Gerrit to use H2 as the database.Mar 19 2019, 6:23 PM
Paladox added a project: serviceops.

say something random to make wikibugs rejoin a channel

fsero moved this task from Backlog to Incoming on the serviceops board.Jun 20 2019, 2:23 PM
Joe moved this task from Incoming to Externally Blocked on the serviceops board.Jun 21 2019, 8:48 AM