<div dir="ltr"><div><div><div><div>Hello,<br><br></div>I&#39;ve attempted a test migration of our gerrit database from H2 to PostgreSQL.<br><br># How<br>I copied everything another server, so I wouldn&#39;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.<br><br></div><div># Issues<br></div><div>The csv files need to have execution permission on them for all users and read permissions so that postgresql can open them.<br><br>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 &quot;id, name, datetime&quot;, but the csv has &quot;datetime, name, id&quot;, importing will fail.<br><br></div>In our particular, instance, instead of the following query,<br><br>COPY ACCOUNT_GROUPS FROM &#39;/tmp/migrate/ACCOUNT_GROUPS&#39; DELIMITER &#39;,&#39; CSV HEADER;<br><br></div>We&#39;d need this one, which specifies the order explicitly<br><br>COPY ACCOUNT_GROUPS(name, description, visible_to_all, group_uuid, group_id, owner_group_uuid) FROM &#39;/tmp/migrate/ACCOUNT_GROUPS&#39; DELIMITER &#39;,&#39; CSV HEADER;<br><br></div># Conclusion<br><div><div><div><div><div>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&#39;t confidently say that everything will work on Centos 5 without testing. I&#39;ll be doing another round of testing with Centos 5, to confirm all will go well there as well.<br></div><div><br>If you have time to test, please take a look at <a href="http://review.nigelb.me">review.nigelb.me</a> (you may have to add an /etc/hosts entry pointing to 159.203.88.175). I&#39;ve turned off replication, so you can push to this server without side effects elsewhere.<br><br></div><div>I&#39;ll bring up a Centos 5 server and do a second round of testing. After that I&#39;ll work to schedule a 2-hour maintenance window for gerrit to complete migration on production.<br><br><div><div>-- <br><div class="gmail_signature"><div dir="ltr">nigelb<br></div></div>
</div></div></div></div></div></div></div></div>