dhaivat home

You are in the right place if you are stuck with an aging Gerrit install with H2 db backend

Problem:

An old Gerrit installation on older version of gerrit with H2 backend

Desired result:

New Gerrit installation on latest version of gerrit with PostgreSQL backend

Requirements:

old gerrit box (codename: old_gerrit), additional server to test things out without impacting live gerrit (codename: new_gerrit), new gerrit war (codename: newwar), script from this page to convert H2 sql dump to PostgreSQL, working postgres install

Steps:

Copy entire review_site directory from old_gerrit (including repos) to new_gerrit and run gerrit init with newwar , during init old gerrit schema will be upgraded to new version.

java -jar ~/gerrit-full.war init -d /gerrit/review_site
  ... wait for all messages, say *yes* for upgrading schema...
  ssh -p 29418 new_gerrit gerrit gsql
  >SCRIPT TO 'h2_backup.sql';

Resulting sql dump is not usable by postgresql just yet, to run it through script below.

Load converted sql dump to PostgreSQL with, and run gerrit init again but choose PostgreSQL as backend and provide credentials.

## load
psql reviewdb gerrit -f h2_fixed.sql > gerrit_dataload.log 2> gerrit_dataload.errql reviewdb gerrit -f h2_fixed.sql > gerrit_dataload.log 2> gerrit_dataload.err

## init - with PostgreSQL
java -jar ~/gerrit-full.jar init -d /gerrit/review_site

## start
/gerrit/review_site/bin/gerrit.sh start

done.

comments powered by Disqus
Fork me on GitHub