checking custom prop data integrity

Phil Davis revdev at pdslabs.net
Mon Jul 20 19:59:10 EDT 2009


I'm looking for the best way to detect data corruption ASAP after it 
happens in a custom property of a stack. The stack resides on a file 
server and is read & written by many clients. File locking during reads 
and writes is already in place and seems to be doing its job, but 
occasionally we still have data corruption that creeps in.

Specifically, I want to make a way for the "Client B" app to know that 
the value it gets from the "uData" custom property of stack "myStack" is 
exactly what the "Client A" app put there a moment before.

Here's how I see this working:

    * Client A
          o (stack is in memory, file is locked on server)
          o sets the uData of stack "myStack" to new value
          o puts md5digest of updated uData into "dataDigest" file on server
          o saves "myStack" stack
          o deletes stack from memory
          o unlocks file on server
    * Client B (a moment later)
          o locks "myStack" file on server
          o puts "dataDigest" file from server into tOldDigest
          o goes to stack "myStack"
          o puts md5digest of uData custom prop into tNewDigest
          o if tNewDigest = tOldDigest, all is well; otherwise
            corruption exists

Does anyone see a problem with this approach? Is there a better way to 
accomplish the goal? If each client could check the data after its own 
write without having to read the stack into memory again to do so, that 
would be great - I just didn't see a way for that to happen.

Thanks everyone -
-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the use-livecode mailing list