You explaination is very good.

My application is in python with wxpython gui, it would be easy implement row deletion from lock-table in onclose event of dialog with details about person. (this is horrible sentence, maybe I wrote some semantical errors :))

Thank you for your time...

Stano.


[EMAIL PROTECTED] wrote:

Stano,

There are many ways to track what goes on in an application. I suggest you
implement an application based version of "row-locking".

Create a table to hold a list of the IDs that you are currently editing. If
a user requests to edit a person, check that table and if no entry exists
add one otherwise tell your user that that record is already being edited
and they will have to wait.  There are many variations on this method. Some
add the threadID to the table so that one process can determine if it got
the lock or if another thread did.  You can wrap the entire "check-add"
process with a WRITE LOCK just to keep other threads out while you check.

If you are doing this with a browser-based front end, you run the risk of
locking a person's record but never unlocking it. You can specify a time
limit on the lock (just one more column in your tracking table) and if the
user doesn't submit their changes by then you could either deny the
submission or any number of other options.  A process (like the editor page
itself) could scan the lock table for expired locks and clear them out. You
have a lower risk of this if you are building your own front-end as you can
put into your shutdown housekeeping the code to clear any locks that user
may have left open.

The locks that are built into MySQL are not meant for "slow" processes like
people but to keep the database consistent while handling hundreds (or
thousands) of actions per second. Locking a database to prevent changes
during the 1 to 15 minutes it takes to edit a profile would be an extremely
long time to lock down your database as none of your other users would be
able to even read any other records while the lock was in place. There are
ways around that, too (read locking vs write locking), but I still DO NOT
feel that using database locks are the right way to solve your concurrency
issue.

Regards,
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine




-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to