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
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
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
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
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
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
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
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