Reputation: 336
I am trying to build a database that will be used to store the results on some tests. The problem is that these tests run in parallel and separate processes and after each one of them finishes it will commit the results to the database. Now I know that MySQL is designed to handle such situations and some engines like InnoDB can achieve row level locking.
Any help is highly appreciated.
Upvotes: 1
Views: 2108
Reputation: 18757
The number 2 is up to you, what will you do when mysql_connect()
or whatever you use to connect to database will throw an exception. The number 1 issue will be resolved at MySQL level, depending on what does your process require to do with locked table or row. Usually this results in a temporary delay for query to access the data in locked areas, but can return an out-of-time error, should the other process lock the table/row for an extended period of time. Also a mutual lock is possible, say process A locks row 1, and process B locks row 2, and A wants data from row 2 and B wants data from row 1. This is named "deadlocking", and one of the processes is chosen as a deadlock victim and its query returns a failure.
Upvotes: 2