Franck PORCHER wrote:
> 
> Well, I'm not 100% sure, but I recently switched for MLDBM and got this
> problem too. Here is what I found, and did to remedy the situation :
> 
> It *seemed* to me that the physical MLDBM repository was not physically created
> until I actually wrote something into it, eventhough it was reported as
> correctly open RW.
> 

This is correct.  This is a performance enhancement, with the side effect
that write errors will occur at runtime.

> So, any ends of my application trying to fetch value during this
> transcient stage got this kind of error (I do not remember
> precisely which one I got, but very close indeed).
> 
> I solved the problem by doing an awful trick on each RW opening, such as
> :
> 
> eval {
>        tie %hash, "MLDBM::Sync", $storage, O_RDWR | O_CREAT, 0660;
>        $hash{'__DuMmY__'} = 'OK';
>        delete $hash{'__DuMmY__'};
>      };
> 
> That solved the problem in the midtime, waiting for something
> much better...
> 

You could also 

  tie %hash, "MLDBM::Sync", $storage, O_RDWR | O_CREAT, 0660;
  tied(%hash)->Lock;

to similar effect, as Lock() will actually force a tie to 
the dbm on disk.

The basic premise of MLDBM::Sync is that the tie/untie actually
occur at the reads & writes, so that i/o is flushed correctly.

--Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

Reply via email to