I am trying to create a changelog containing a “dump” of a database, and always receive OutOfMemoryErrors. This even happens when I run liquibase with Xmx=5g!
The DB itself is not very large (an uncompressed SQL-Dump [MySQL] is about 156MB, and contains about 1 million records).
I get the impression, that liquibase builds a DOM in memory and chokes, but cannot confirm this.
What can I do to make the dump work? How can I assist to resolve this issue?
Yes, it does currently build up a DOM object and then serialize it out. If yoru database is not large, you may be able to increase the java heap size with the -Xmx JVM flag and be fine.
If you are wanting to look the code, it is in the liquibase.diff.DiffResult class in the liquibase 2.0 codebase. I would guess it is going to be non-trivial to handle. It will be easier with the CSV output than output since you can stream to the file better and/or use scrollable result sets.
increasing the memory limit did not help that much: With 5 GiB of Xmx java still OOMes. I removed a few ten thousand of db rows and the export ran smoothly.