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: Database corruption on crash during table creation
Date Tue, 06 Jul 2010 06:57:06 GMT
On 07/ 6/10 08:23 AM, David Van Couvering wrote:
> Hi, all.  I seem to have a repeatable issue where my database is
> getting corrupted, and I can only assume it's happening when the table
> is getting created, because I know Derby is great on handling crashes
> during normal operation.
> First of all - is it true that a Derby database can get corrupted if
> the VM goes down in the middle of a DML like CREATE TABLE?

I hope not... :)

> What I'm seeing is that upon restart, when I try to access the
> database, I get the error "unable to create database FOO: the
> directory already exists."  The directory contains what appears to be
> a Derby database, but apparently not enough of one.

There is a report about a similar problem, probably caused by the
application being killed while the database was being created. See
DERBY-4589 and the possibly related DERBY-4098.

> What I'm hoping for, is there a "forceCreate=true" kind of option when
> opening a database that forces the creation of the database in the
> given directory even if something is already there? 
> Otherwise it appears my only option is to detect this specific error
> ('directory already exists'), and then blow away what's there and try
> again.  That's a chunk of work I'd rather not do, so I'm hoping you've
> already addressed it (ahem :)).

I'm afraid that this is a chunk of work that you'll have to do for now,
if this is an error you see frequently. May I suggest that when you go
ahead implementing it, you make the changes in the Derby engine and not
in your application, so that everyone benefits from it? :)


Knut Anders

View raw message