db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Forcing Data to Disk on JPA Commit
Date Wed, 12 Dec 2007 20:51:48 GMT
Bryan Pendleton <bpendleton@amberpoint.com> writes:

>> later. Obviously, the data is being cached, which is generally a
>> good thing. However, when a power outage occurs, there's no time for
>> the cache to be written to the database. Transactions that happened
>> two weeks earlier were not written to the database
> When a Derby transaction is committed, although the data pages
> may not be immediately written to disk, the log records for that
> transaction are immediately written to disk, before the commit finishes.
> So if the power should fail, when Derby is later restarted, it will
> perform recovery, read the committed transaction data from the log,
> and re-do those transactions.

This is true, but many systems have enabled the write cache on the hard
drive. This means that although Derby and the OS think the data have
been written to non-volatile storage, they may still reside in the
volatile write cache on the disk and can be lost in a power outage.

Olav mentioned in one of his presentations that he had run some
experiments where he cut the power while the database was under heavy
load. When the write cache on the disk was enabled, Derby failed to
recover in 3 out of 10 runs, and recovered with lost transactions in 2
out of 10 runs (see
http://home.online.no/~olmsan/publications/pres/apachecon07eu/DerbyApacheCon07eu.pdf). With
the write cache disabled, the database was successfully recovered in 10
out of 10 runs.

I think most desktop systems have the disk write cache enabled by

Knut Anders

View raw message