1) The size of the database constantly grows, and once the size hits
around 250MB it refuses to accept new connections. If the database is
shut down and re-opened the size of the database shrinks and it
becomes responsive again.
2) My second issue is that of a long start up time. One sites h2
database takes about one hour to open. I enabled logging and it
appears that the database is replaying every transaction since it was
created. I see lots of lines like the following:
11-23 17:35:16 pageStore: log redo - table:175 key:34191721
...
11-23 17:41:19 pageStore: updateRecord page[89022] b-tree leaf table:
13 entries:17
11-23 17:41:20 index: T10_DATA remove ( /* key:5977917 */ 5977917,
'0102D2918A90517BB06', 'Intel(R) ICH10 Family USB Universal Host
Controller - 3A68', 'Universal Serial Bus controllers', '9.0.0.1005',
'Intel', '2-25-2008', 'usbuhci.sys', 'Enabled')
11-23 17:41:20 pageStore: log redo - table:10 key:5977918
My theory is that these two issues have something to do with MVCC. The
documentation states that if one enables MVCC then the transaction log
must fit in memory. Is memory here the heap space? What about disk?
One of my theories here is that the database is constantly growing as
a result of the transaction log being persisted in addition to the
data.
I am still curious on how this log gets so large. I attempted to
reproduce the issue with a mini example and observed that if there is
an INSERT with no commit, it is automatically rolled back if:
* The client application exists (I am guessing that the rollback is
part of the connection cleanup in the database server).
* The database is shut down gracefully. There appears to be a shutdown
hook that rolls back uncommitted transactions on shutdown.
The only way I was able to get some items into the transaction log by
doing a kill -9 on the H2 server process while INSERTS were being
executed.
I also had suspicions similar to Noels. My first suspicion was there
there might also be a connection leak, I also examined the code
looking for missed commit statements but have yet to find any. The
exception handling in my clients persistence code is not the best, so
perhaps some more research will turn up some conditions where a commit
or rollback would be missed.
How can I truncate the log without starting the database over from
scratch?
the trace options might help you find this:
http://www.h2database.com/html/features.html#trace_options