human-readable lock table

Posted by adisney on 16-May-2012 18:48

We're trying to get to the bottom of a complex locking/transaction issue involving appserver agents and persistent programs.

If I use promon -> record locking table -> display all entries, I get a very fast response.  It's minimally useful, however, because under the Table column a number is displayed instead of a table name.

So we've written a utility which does this:

for each _lock no-lock where
_lock._lock-Usr   ne ? and
_lock._lock-table ne ?,
first _file no-lock where
_file._file-number = _lock._lock-table:

   [extract some other info like user's name, _connect]

   [display]

end.

This displays exactly what we need, but takes a longish time.  In fact, if we just do "for each _lock no-lock" and count the records, it takes a while since there are 12,000, even though none of them have _lock-Usr or _lock-table valued.

So how does promon do it?

I tried to extract the source code, but it seems to run some version of _mprshut ...

If I look at the indexes on the _lock table, the only one I see is on _lock-id, which doesn't seem to be useful.

Thanks for any help,

Anne

All Replies

Posted by adisney on 16-May-2012 19:08

More info ... poking around, I see that _dbstatus._dbStatus-mostLocks is labeled in the dictionary "Lock table high water mark".


If it is true that Progress would use the lowest possible _lock.lockID each time a lock was used, it would seem this could would speed things up tremendously, since we would rarely have more than 100 simultaneous locks, even with 50+ users:

define variable i as integer no-undo.


find first _dbstatus no-lock.

for each _lock no-lock:
   i = i + 1.
   if i > _dbstatus._DbStatus-MostLocks + 10 /* to be safe */

      then leave.

   if _lock._lock-Usr   = ? or
      _lock._lock-table = ?
   then next.

   find first _file no-lock where
      _file._file-number = _lock._lock-table.

      [extract futher useful info]

   [display]

end.

Would this work?

Thanks,

Anne

Posted by rohit.ramak on 17-May-2012 07:07

Can you try :

FOR EACH _Lock NO-LOCK WHILE _Lock-Usr <> ? :

    /*  do some processign on _Lock    */

END.

Posted by asthomas on 17-May-2012 07:11

Jeg er væk fra kontoret indtil den 21. maj, og checker ikke altid mail og telefon regelmæssigt. Jeg vil dog svare på din mail så snart som muligt.

Hvis du har behov for support, kontakt venligst support@app-solutions.com, så vender vi tilbage så snart det er mnuligt.

Administrative henvendelser kan ske til : admin@app-solutions.com.

I am not in the office until May 21st 2012. I will not be checking my mail and phone on a regular basis, but will reply to your mail as soon as I can.

If you need support from appSolutions, please send your mails to support@app-solutions.com.

If you need Roundtable support, please send mails to :

support-europe@roundtable-tsms.com.

Med venlig hilsen / Regards

Thomas Hansen

appSolutions a/s

Posted by Tim Kuehn on 17-May-2012 08:48

Rather than rolling your own, I'd suggest downloading ProTop and using that:

http://dbappraise.com/protop.html

Posted by adisney on 17-May-2012 11:32

Yes, thank you, this did work.  I had assumed that there would be holes in the list of _lock-id values as locks were created and released, but this is not true.  The list is constantly reshuffling itself by rules I haven't yet determined, but does not leave any gaps.

Very fast!  Thank you.

Posted by gus on 17-May-2012 12:33

Hello Anne,

No good news, I'm afraid. Take Tim's advice and use protop. Have a look inside at the code too.

The lock-ids are meaningless. The lock table is organised as several hash tables that each contain many chains of lock table entries in order by rowid. This structure is constantly changing as locks are acquired and released. It is designed this way so that the actions of acquiring, releasing, and detecting lock conflicts is fast. Human readability was never a priority.

The lock table high water mark is a simple counter that has nothing to do with the lock ids.

Posted by adisney on 17-May-2012 12:37

OK, will do.

Anne

Posted by Admin on 21-May-2012 12:51

Hello,

I am new to PSDN and really appreciate having such a great source

for information. But I have a question. I am receiving tons of email

on subjects that don't apply to me at all. Perhaps I did not set up

my account properly. Is there something I need to change?

Thanks

David Valpreda

Posted by gus on 22-May-2012 08:44

At the top of the page on psdn you should see "Your Stuff". Among other things, there is a "Preferences" there. If you click on that you can see a bunch of stuff that you may want to change. Fair warning: I have no idea what any of it actually does.

Posted by robw@hltool.com on 22-May-2012 10:31

I'm not the OP - but I poked around in Preferences for a while with no luck. So I still get emails for products I don't use.

But I'd rather get everything than nothing.

Posted by egarcia on 22-May-2012 10:43

Hello,

If you need to stop or active email notifications, you can use the link that appears on the right side of the page of a forum.

You can navigate using the links: Progress Communities > PSDN > OpenEdge, then use the option "Stop email notifications" or "Receive email notifications".

Perhaps, the email notifications are at the PSDN level rather than OpenEdge or other specific forums.

I hope this helps.

This thread is closed