|Just another Perl shrine|
[OT]? Behavior of Berkeley DB cache when reading cached page that was changed on disk by another appby DrWhy (Chaplain)
|on May 05, 2011 at 22:00 UTC||Need Help??|
DrWhy has asked for the
wisdom of the Perl Monks concerning the following question:
Okay so this is really a Berkeley DB question, but it's for a Perl application so I'm posting it here to see if anyone can help out.
I'm using Berkeley DB in an manner that is not approved of by the great Berkeley DB oracles-that-be. I'm using it from a shared disk in a distributed environment with multiple processes on mulitple machines reading and writing simultaneously. The saving grace, if there is one here is that there is expected to be very infrequent, but still possible cases of two processes on different machines accessing the BDB at the same time.
Going off a tip from the Oracle Berkeley DB FAQ online, I'm taking the following approach: Do external locking on the entire DB, handled by the application. I'm planning to use File::SharedNFSLock for this purpose.
I could just get a lock at the beginning of each app's run and that would be sufficient to get the locking I need, completely serializing access to the DB at a very high level. This would waste alot of time so I was looking at having each app take and release a lock several times around logical units of DB work within the app. Each unit of activity would look like:
"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."