Re: Problem with DBM concurrent access

2002-04-05 Thread Dan Wilga
I would also suggest using BerkeleyDB.pm, but with the DB_INIT_MPOOL|DB_INIT_CDB flags. In this mode, only one writer is allowed at a time, and Berkeley automatically handles all the locking and flushing. Just don't forget to use db_close() to close the file before untie'ing it. Dan Wilga

Re: Problem with DBM concurrent access

2002-04-05 Thread Andrew Ho
Hello, DWI would also suggest using BerkeleyDB.pm, but with the DWDB_INIT_MPOOL|DB_INIT_CDB flags. In this mode, only one writer is DWallowed at a time, and Berkeley automatically handles all the locking DWand flushing. Just don't forget to use db_close() to close the file DWbefore untie'ing

Problem with DBM concurrent access

2002-04-04 Thread Franck PORCHER
Hi there, I have a quick and possibly trivial question that has bothered me for quite a while. I'm using a DBM as a repository. The DBM is constantly written to by only one process (the 'writer') that opens it RW. At the same time, many process (the 'reader') access it *read only*. I

Re: Problem with DBM concurrent access

2002-04-04 Thread Perrin Harkins
Franck PORCHER wrote: So my question narrows down to : How to flush on disk the cache of a tied DBM (DB_File) structure in a way that any concurrent process accessing it in *read only* mode would automatically get the new values as soon as they are published (synchronisation) You have to

RE: Problem with DBM concurrent access

2002-04-04 Thread Rob Bloodgood
So my question narrows down to : How to flush on disk the cache of a tied DBM (DB_File) structure in a way that any concurrent process accessing it in *read only* mode would automatically get the new values as soon as they are published (synchronisation) Isn't that just as simple as

Re: Problem with DBM concurrent access

2002-04-04 Thread Stas Bekman
Rob Bloodgood wrote: So my question narrows down to : How to flush on disk the cache of a tied DBM (DB_File) structure in a way that any concurrent process accessing it in *read only* mode would automatically get the new values as soon as they are published (synchronisation) Isn't that just

Re: Problem with DBM concurrent access

2002-04-04 Thread Joshua Chamas
Stas Bekman wrote: tied(%dbm_array)-sync(); I believe that's not enough, because the reader may read data during the write, resulting in corrupted data read. You have to add locking. see the DBM chapter in the guide. You might add MLDBM::Sync to the docs, which easily adds locking to

Re: Problem with DBM concurrent access

2002-04-04 Thread Perrin Harkins
Isn't that just as simple as tied(%dbm_array)-sync(); I believe that's not enough, because the reader may read data during the write, resulting in corrupted data read. Not only that, there's also the issue with at least some dbm implementations that they cache part of the file in memory