Re: Strange multi-user timing phenomenon



Thanks for the response.
I've posted questions related to this for about a week and have not had much
feedback so far.
The essential problem is in a multi-user system to alllow different users to
grab records (read then eventually delete) from a table whilst ensuring no
two users EVER get the same record.
My locking mechanism is to insert a record to a special table whose only
purpose is to force single-threading. I insert a single record with a single
primary key. I delete this record at the end of processing. If the insert
fails I wait for .5 seconds and try again up to a max of 6 tries then display
a message.
This is my 4th attempt to get this to work - all previous attempts having
failed as well. However, I think I'm getting closer...



"Paul Shapiro" wrote:

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. If you want help you have
to give us a little more info. What are you locking and how are you locking
it?

"mscertified" <rupert@xxxxxxxxxxxxx> wrote in message
news:646353B4-4FFF-4FEA-B33E-53C42D37324E@xxxxxxxxxxxxxxxx
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: [PATCH 1/1] (v2) SYSVIPC - Fix the ipc structures initialization
    ... So idr_get_newis inserting a pointer into the ... its lock uninitialized. ... This patch moves the spin_lock_initbefore the call to ipc_addid. ... turning off the locking correctness validator. ...
    (Linux-Kernel)
  • Re: using clustered index to optimize inserts ...
    ... I will try to explain locking in terms of Sybase docs... ... Allpages Locking: Allpages locking locks both data pages and index ... the data page is locked with an exclusive lock. ... Clustered Index: The datarows will be arranged as per the clustered ...
    (comp.databases.sybase)
  • Re: CSingleLock - known behaviour?
    ... It is better to design code that doesn't require locking. ... If you don't need the resource, don't lock it. ... magnitude less efficient, than locking once. ...
    (microsoft.public.vc.mfc)
  • Re: Strange multi-user timing phenomenon
    ... table record with pessimistic locking and both edit the same record. ... the recordset will be sufficient to lock out other users. ... update the recordset (if you had to edit data) and then close it. ...
    (microsoft.public.access.formscoding)