multi-user // Corrupt Database

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Mon Jan 3 14:14:19 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]




More information about the Valentina mailing list