db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: [Fwd: Re: [SHUTDOWN] Should I shutdown embedded data base ?]
Date Thu, 30 Mar 2006 20:05:15 GMT
Bryan Pendleton wrote:

> Moving this discussion to Derby-Dev because I want to ask a code-related
> question to Oystein:
>
> Have you had a chance to look at 
> http://issues.apache.org/jira/browse/DERBY-51
>
> Your comments seem to relate to a number of the issues raised in this 
> bug.
>
> In particular, I am trying to understand the differences, *in the Network
> Server Environment*, between:
>  - Shutting down a single database that is being served by the Network 
> Server
>  - Shutting down all the databases that the NS is serving, but leaving 
> the
>    NS itself up and running
>  - Shutting down the Network Server itself, either
>    - with, or
>    - without shutting down the databases it is serving
>
> I've only looked at this a little bit, and have made myself thoroughly
> confused, so I was hoping that maybe you could shed some light in this 
> area.
>
> thanks,
>
> bryan
>
>
> -------- Original Message --------
> Subject: Re: [SHUTDOWN] Should I shutdown embedded data base ?
> From: Oystein Grovlen - Sun Norway <Oystein.Grovlen@Sun.COM>
>
> Note that a derby shutdown is just a shutdown of all databases you have
> opened.  If you just have a single database, a single shut down is 
> enough.
>
Hi -
There are two forms of shutdown and this is how it has been explained to me:
1) Used with a URL specifying a database name   
(jdbc:derby:myDB;shutdown=true) shuts down THE database specified  by 
closing out all transactions, flushing the buffers to disk, 
checkpointing the transaction log and removing the db.lck file.  NOTE: 
it leaves the Derby engine running within the JVM
2) Use without a database name (jdbc:derby:;shutdown=true) shuts down 
ALL database that were booted (doing all the above things for each) then 
shutsdown the Derby engine it self (I believe this means unloading the 
driver but Oystein will know for sure).

I believe (Oystein or someone in the code can you confirm this) that 
when Network Server is shutdown it basically performs the form 2 (ALL) 
shutdown of Derby before exiting (if it does not then a bug needs to be 
filed).  Unless there are specific reasons to do otherwise it is best 
NOT to shutdown datbases from the application but to let them be 
shutdown when the Server is shutdown. 
The reason is that there is no way to tell if someone else is also 
connected to the DB.  If they are and you shutdown the DB the next query 
they make will fail cause the DB is gone.  We need to play nicely in a 
shared environment.

I think this addresses the situations you describe.  I have noted that 
no database shutdown messages are writen to the log when the databases 
are shutdown along with Network Server and the db.lck file still exists 
afterwards so this process could use improvement.





Mime
View raw message