Hi,

For #1: this is a known problem which was fixed in later versions. See the
change log, version 1.4.188 Beta (2015-08-01): "MVStore: power failure
could corrupt the store, if writes were re-ordered."

For #2: it should no longer be needed. I think later versions write less in
the background thread.

If you want to disable background writes in version 1.4.187, then maybe the
easiest way is to change the source code directly. I'm not sure if there is
a simple way to configure this.

Regards,
Thomas




On Tuesday, January 5, 2016, Jean-Francois Duchesneau <
jfduchesn...@gmail.com> wrote:

> Hi,
>
> We are currently using H2 1.4.187 as a small embedded database for one of
> our product.
>
> Lately, one of our customer has experimented problems with a corrupted
> database.  After investigation, it looks like this customer occasionally
> "hard reboots" its system, for some reason.  The database corruption seems
> to appear right after some of these hard reboots.
>
> We looked at the application logs and observed that all the hard reboots
> occurred while the application had been idle for several minutes or hours.
> So the question is: how could an embedded database be corrupted by a reboot
> if nothing is actually being read or written?
>
> That interrogation led us to discover that, even if our application is
> idle, the database engine might not be.  Indeed, as you know, a background
> thread is running along with the MVStore.  Its role seems to be to
> autocommit pending transactions, and compact the database file.
>
> So far so good, but then we observe that the background thread seems to be
> endlessly compacting the file, even though our application is idle.  In
> other words, almost every time the background thread is triggered (every
> 50ms), it seems to compute that compacting is needed, and launch a compact
> process, event our application has not read or write anything.
>
> The result is the following while our application is idle:
>
>    - The database file is continuously rewritten (the timestamp changes);
>    - The size of the database file is continuously changing (alternately
>    increasing and decreasing);
>    - The MVStore's backgroundWriterThread is continuously taking CPU time;
>    - The memory usage is continuously moving, and the garbage collector
>    is continuously working;
>
>
> Now, what are we looking for?  Our goal is to avoid database corruption.
> So our questions are:
>
> 1- Is there a way to avoid database corruption when a hard reboot happens?
> 2- Is there a way to disable the background thread, or the compacting
> process, to avoid corruption while our application is idle and a hard
> reboot happens?
>
> As for question #2, we thought of disabling the background thread by
> changing the value of the variables "autoCommitDelay" and
> "autoCompactFillRate", but we haven't found a way to configure them.  Is
> there a way for us to change the value of these variables?
>
> Thanks,
> Jean-Francois
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to h2-database+unsubscr...@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','h2-database%2bunsubscr...@googlegroups.com');>
> .
> To post to this group, send email to h2-database@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','h2-database@googlegroups.com');>.
> Visit this group at https://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to