Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Ingres Topics / June 2004

Tip: Looking for answers? Try searching our database.

Lock escalation to table level

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bishal - 29 Jun 2004 12:53 GMT
Hi,

I am using Ingres II on solaris. There has been a large no of
escalation to
table level locking which is resulting in deadlocks and lockwaits.
The error message in errlog.log shows
E_DM9044_ESCALATE_DEADLOCK Deadlock encountered while escalating to
table
level locking

In environment variable ING_SYSTEM_SET= set lockmode on session where
readlock = nolock, maxlock = 80.
The Locks per transaction(per_tx_limit) in cbf is 500

The escalation is pointing to a particular table where there is
continuous
inserts and updates which is scheduled in a batch. The table's
structure is btree.

I have increased the maxlocks to 400 and per_tx_limit to 1500 but
still i am getting this lock escalation in errlog

Any help to reduce the lock escalation would be greatly appreciated.

The locking summary is being attached to the forum which was before
increasing of maxlocks..

Locking System Summary=================================================

Total Locks 303132 Total Resources 303132
Locks per transaction 500
Lock hash table 60623 Locks in use 308
Resource hash table 60623 Resources in use 300
Total lock lists 5200 Lock lists in use
56

Locking System Statistics=================================================

Create lock list 17092927 Release lock list
17092776
Request lock 31240070 Re-request lock
3951814
Convert lock 46365434 Release lock
29143937
Escalate 16622 Lock wait
142451
Convert wait 923 Convert Deadlock 103
Deadlock Wakeups 275130 Max dlk queue len 9
Deadlock Search 74495 Deadlock 2
Cancel 30 Convert Search 999
Allocate CB 63790787 Deallocate CB 63791909
LBK Highwater 4 LLB Highwater 153
SBK Highwater 6 LKB Highwater 748
RBK Highwater 6 RSB Highwater 729
Max Local dlk srch 2 Dlk locks examined 74703
Max rsrc chain len 5 Max lock chain len 4
Callback Wakeups 0 Callbacks Invoked 0
Callbacks Ignored 0
Franky Leeuwerck - 30 Jun 2004 08:23 GMT
Dear Mr. Bishaljit Purkayasth,

There can be many reasons why you see this locking error messages.

Possible reasons can be :
- table is not regurarly modified (overflow) and optimized (QEP
statistics)
- there are too many rows in one page that gets accessed concurrently
- transaction lacks commits
- insufficient primary keys specificied ( or index keys ) in the
queries
- underlying database rules get locked or don't get processed fast
enough
- updates involves index key columns
- ...

Please post the output of 'help table the_name_of_your_table;' in an
sql session on the database.
And if possible the queries that your are talking about.

From tomorrow on, I'll be abroad and therefore will not be able to
attend this discussion thread for a few days.

Regards,

Franky Leeuwerck
Advanced Projects & Products
http://www.ap2.be
Roy Hann - 30 Jun 2004 10:02 GMT
> Hi,
>
[quoted text clipped - 19 lines]
>
> Any help to reduce the lock escalation would be greatly appreciated.

There is an almost unlimited number of possible causes of what you are
seeing.

The first thing you need to be sure of is that ING_SYSTEM_SET is actually
doing what you want.  Any session connecting to the Ingres installation from
another machine/installation will not use it.  Set system_maxlocks in the
DBMS server configuration(s) instead.

Secondly, it may well be that a session that uses more than 80 page locks
will also use more than 400 page locks.  A poorly restricted query with poor
or inappropriate statistics could easily do that.  I actually rather doubt
this is what is happening, because the LKB Highwater is just 748, which
suggests that relatively few locks are ever taken (assuming there are a
significant number of concurrent sessions).  That would tend to suggest that
either the optimizer is very good at predicting when a table lock will be
required (so that there is no need to escalate), or very few sessions are
locking extensively.  That could be because they are highly selective and
the physical keys are well-chosen, or it could be because a significant
number of sessions are ignoring ING_SYSTEM_SET as noted above.

Thirdly, the chances of a deadlock at escalation are greatly increased if
any locks are excessively prolonged.  You mention that this table is a
B-tree, and you also mention the inserts, which suggests to me that it might
be quite insert-intensive (since you bothered to mention the inserts).
Knowing programmers' and DBAs' fondness for surrogate keys, and given that
those are virtually always sequential, I would not be surprised to see
significant lock serialization on "last" page of the B-tree.  That would
prolong locks and lockwaits far beyond what you might guess, very quickly.

Fourth, you might be running into a bug (I forget the number).  You can test
for it very easily using this procedure:

- start a session
- update a row in some table (create a table for this if you need to)
- do not commit
- start another session
- select the same row from the same table (so the session waits)
- don't commit (you can't anyway)
- return to the first session
- select the row you just updated

Normally you should just see the updated row.  But if you have the bug you
will get a (spurious) deadlock error.

I can think of loads of other possible explanations but other demands on my
time prevent me from droning on here.

I also note that system has a stupendous surplus of locks configured
(303132, of which no more than 748 have been used since start-up).  Your
non-swappable locking segment is at least 134Mb and very likely bigger.
(Run iishowres -d to see what it is.)  I don't imagine that Barclays buy
machines that are short of memory, but it does suggest that someone needs to
give the system configuration a systematic sanity check.  The default
configuration makes very little sense, and this is just one example.

I don't know how serious this problem is for you, but given the large number
of possible causes it might be useful to arm yourself with all the tools and
techniques for diagnosing and fixing it.  Our "Advanced Ingres Programming"
course covers every Ingres-related performance problem you are likely to
see, systematically, in detail, with solutions.  You can find the course
outline on www.rationalcommerce.com under "Training".

Roy Hann (rhann at rationalcommerce dot com)
Rational Commerce Ltd.
www.rationalcommerce.com
"Ingres development, tuning, and training experts"

> The locking summary is being attached to the forum which was before
> increasing of maxlocks..
[quoted text clipped - 30 lines]
> Callback Wakeups 0 Callbacks Invoked 0
> Callbacks Ignored 0
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.