On Sat, 18 Sep 2004, Ara.T.Howard wrote:


say you have the following logic:


begin transaction in parent

 if pid = fork

   ....

   commit transaction

   close database

 else

   close database

   ...

 end


should this be o.k.? i notice the unlink of the db-journal will happen twice - which should be o.k. but will flush/sync operations happen twice? my code that does this seems to work fine - but i'm wondering what the 'official' answer would be.

kind regards.

i'm very sorry for being noisy here - but does anyone have a clue about this? i've read all the docs which suggest not carrying a db handle across a fork, but the implication there is that both the child and parent should not use such a handle. in my case i simply need to do a fork/exec of bash and the database handle is NOT used in the client. i must, however, do the fork within the transaction (a select is required to determine whether to fork and the child pid is part of a resulting update - all of this takes place in a transaction).

i am closing the db in the child after forking now and this seems fine -
however i'm worried that there may be some hidden operations (flushing of data
for instance) that doing a close in both parent and child may cause to happen
twice - thereby corrupting the database.  reading the code lead me to think
not - but i'm not that familiar with the code base.

again, sorry for being noisy - but i'm losing sleep over this one.

cheers.

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it. | --Dogen
===============================================================================

Reply via email to