Strange multi-user timing phenomenon



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?

.



Relevant Pages

  • Re: Strange multi-user timing phenomenon
    ... Look at how you're "locking", because as you say, it's not locking what you think it is. ... If your lock was exclusive and was working, then user 2 would indeed not be able to place the "impossible" lock. ... I'm attempting to enforce single-threading of a process by inserting a ... user 1 processes record ...
    (microsoft.public.access.formscoding)
  • Re: Lock fields
    ... You are using a DATE or TIME field rather than a CREATEDATE field. ... inserting using the keyboard shortcut or header/footer toolbar button). ... select lock fields, it will lock. ... This message is posted to a newsgroup. ...
    (microsoft.public.word.formatting.longdocs)
  • Re: using constants in sql server
    ... You can build a table of constants within a schema using Standard SQL ... DEFAULT 'X' NOT NULL PRIMARY KEY ... The "lock" column assures you that there is always only one row. ...
    (microsoft.public.sqlserver.programming)
  • Re: asynchronous select statements
    ... This is how you would do it; put the desired row into lock until the update ... you need a primary key on the table! ... create table t1(i int primary key, ...
    (microsoft.public.sqlserver.programming)
  • Re: Is there such a thing as a User-defined Global variable?
    ... You can build a table of constants within a schema using Standard SQL ... DEFAULT 'X' NOT NULL PRIMARY KEY ... The "lock" column assures you that there is always only one row. ...
    (microsoft.public.sqlserver.programming)

Loading