M
mscertified
Problem: 2 users appear able to insert the same (unique) primary key to the
same table.
I'm attempting to enforce single-threading of a process by inserting a
record to a table. All users use the same primary key so only one
(theoretically) can succeed. Other users go into a wait and retry loop. After
processing, I delete the record thus releasing the lock. I've traced the
processing for 2 users (using timer function). The processing sequence is:
user 1 places lock
user 2 lock fails
user 1 processes record
user 2 places lock (should be impossible!)
user 2 processes record
user 1 releases lock
user 2 releases lock
A couple of questions?
Can the timer function be compared between 2 different users?
I'm assuming that inserted and deleted rows are inserted and deleted
immediately and immediately visible to other users, is this the case?
same table.
I'm attempting to enforce single-threading of a process by inserting a
record to a table. All users use the same primary key so only one
(theoretically) can succeed. Other users go into a wait and retry loop. After
processing, I delete the record thus releasing the lock. I've traced the
processing for 2 users (using timer function). The processing sequence is:
user 1 places lock
user 2 lock fails
user 1 processes record
user 2 places lock (should be impossible!)
user 2 processes record
user 1 releases lock
user 2 releases lock
A couple of questions?
Can the timer function be compared between 2 different users?
I'm assuming that inserted and deleted rows are inserted and deleted
immediately and immediately visible to other users, is this the case?