[Gluster-infra] Gerrit migration to PostgreSQL

Nigel Babu nigelb at redhat.com
Wed May 25 06:13:51 UTC 2016


Hello,

I've attempted a test migration of our gerrit database from H2 to
PostgreSQL.

# How
I copied everything another server, so I wouldn't affect the production
instance in anyway. I converted everything from H2 into csv and then
imported the files into postgres. I ran into a few problems at the postgres
end that are not blockers but will add a bit of time to the conversation.

# Issues
The csv files need to have execution permission on them for all users and
read permissions so that postgresql can open them.

When importing from CSV, postgres does not map column names in the CSV to
column names into the database. It depends on the order instead. For
example, if your table is defined as "id, name, datetime", but the csv has
"datetime, name, id", importing will fail.

In our particular, instance, instead of the following query,

COPY ACCOUNT_GROUPS FROM '/tmp/migrate/ACCOUNT_GROUPS' DELIMITER ',' CSV
HEADER;

We'd need this one, which specifies the order explicitly

COPY ACCOUNT_GROUPS(name, description, visible_to_all, group_uuid,
group_id, owner_group_uuid) FROM '/tmp/migrate/ACCOUNT_GROUPS' DELIMITER
',' CSV HEADER;

# Conclusion
Other than these two issues, the test migration was a smooth process. I
took about 1.5 hours to complete including the time spent with the
unexpected issues. This testing was done on Centos 7, rather than Centos 5.
We now know that migration to Centos 7 will not bring on very large visible
failures. I can't confidently say that everything will work on Centos 5
without testing. I'll be doing another round of testing with Centos 5, to
confirm all will go well there as well.

If you have time to test, please take a look at review.nigelb.me (you may
have to add an /etc/hosts entry pointing to 159.203.88.175). I've turned
off replication, so you can push to this server without side effects
elsewhere.

I'll bring up a Centos 5 server and do a second round of testing. After
that I'll work to schedule a 2-hour maintenance window for gerrit to
complete migration on production.

-- 
nigelb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gluster.org/pipermail/gluster-infra/attachments/20160525/bc4ec8b4/attachment.html>


More information about the Gluster-infra mailing list