multi-user // Corrupt Database

Infinity Development dev at infinitydatasystems.com
Mon Jan 3 14:47:17 CST 2011


  > 
  > 
  > On 1/3/11 9:00 PM, "Infinity Development" <dev at infinitydatasystems.com>
  > wrote:
  > 
  > > Thanks for the replies guys. In response to some of the additional
  > > questions...
  > > 
  > > 1) I am using DB.Flush with every single write to the database.
  > > 
  > > 2) While not mult-user, my program (an email client) does access the databases
  > > from different points. For example, you may be reading an email in a mailbox
  > > (database) while new email is being downloaded and saved to it.
  > 
  > Hmm.
  > 
  > And now important question then:
  >     you use threads for these tasks? Read and save?
  >     
  >     does this threads use any mutex for Valentina db?
  >     you must use single mutex for your db.
  > 
  > 
  > Also it is good idea, e.g. For your first thread do task as
  > 
  > ------------------------
  > SomeMethod
  > 
  >     Mutex.lock
  > 
  >     curs = db.SqlSelect(
  >                     "SELECT My mailbox WHERE some filters",
  >                     RecordLocks
  >                     Client or Server side  )
  > 
  >     Mutex.unlock
  > 
  > end
  > 
  > 
  > ------------------------
  > AnotherMethodWhichReadRecordOfCursor
  > 
  >     Mutex.lock
  > 
  >         curs.GoToPosition( N )   // or First Next    // all this touch db
  > 
  >       // extract values of fields into VARs of language.
  >        str1 = curs.StringField("Name").value
  >        ...  
  > 
  >      Mutex.unlock
  > 
  >     // now you can use VARs not touching db
  >     ... 
  > 
  > end
  > 
  > 
  >  
  > > What was so odd about this crash is the fact that no writes were even
  > > happening at the time. I was simply opening a mailbox (database) when
  > > something else cause the program to lock up. When I reopened the program, the
  > > mailbox was no longer accessible.
  > 
  > Was used threads for many reads ?
  > 
  > If yes - this can be a reason.
  > 
  > 
  > -- 
  > Best regards,
  > 
  > Ruslan Zasukhin
  > VP Engineering and New Technology
  > Paradigma Software, Inc
  > 
  > Valentina - Joining Worlds of Information
  > http://www.paradigmasoft.com
  > 
  > [I feel the need: the need for speed]
  > 
  > 
  > _______________________________________________
  > Valentina mailing list
  > Valentina at lists.macserve.net
  > http://lists.macserve.net/mailman/listinfo/valentina


Ruslan,

Actually I'm not using threads for the reads or the writes. Like I said, I'm used to SQLite which doesn't have any problems with simultaneous reads. And although it can collide when attempting to write, practically this almost never happens, and doesn't lead to corruption even when it does happen.

So do I need to write an access manager for Valentina to ensure that simulaneous read/writes aren't happening?
--
Matt Milano
Project Manager
Infinity Data Systems, LLC

Skype & Twitter: InfinityData

Phone Support
Monday - Thursday
9:00 - 5:00Eastern Time
866-919-8545
605-644-6505
www.infinitydatasystems.com


More information about the Valentina mailing list