473,770 Members | 2,144 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table Locks and Preventing Deadlock

I`m exporting data from many Lotus Notes databases to a DB2 database
using LotusScript. The LotusScript agents commit after EACH
update/insert. Nevertheless, I keep getting transaction rollbacks on
deadlock or timeout. When I get a snapshot for locks, I see that one
of the export agents is getting a table lock rather than a row lock.
I`m guessing this is what causes the time out. Questions: how do I
determine whether it`s a deadlock or a timeout? If it`s because of the
table locks, what can I do to prevent it?
LOCKLIST = 64000
DLCHKTIME = 15000
MAXLOCKS = 20
LOCKTIMEOUT = 45
Thanks.
Randy
Nov 12 '05 #1
11 14076
Ian
EoRaptor wrote:
I`m exporting data from many Lotus Notes databases to a DB2 database
using LotusScript. The LotusScript agents commit after EACH
update/insert. Nevertheless, I keep getting transaction rollbacks on
deadlock or timeout. When I get a snapshot for locks, I see that one
of the export agents is getting a table lock rather than a row lock.
I`m guessing this is what causes the time out. Questions: how do I
determine whether it`s a deadlock or a timeout? If it`s because of the
table locks, what can I do to prevent it?
LOCKLIST = 64000
DLCHKTIME = 15000
MAXLOCKS = 20
LOCKTIMEOUT = 45
Thanks.
Randy


You need to look at the reason code from the error:

SQL0911N, reason code 2 = deadlock
SQL0911N, reason code 68 = lock timeout
There are a number of parameters that you may need to consider:

LOCKTIMEOUT -- specifies the time lock waits will last before SQL0911N
LOCKLIST / MAXLOCKS -- controls the number of locks an application can
take before causing lock escalation
Good luck,
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #2
"EoRaptor" <rc*******@patm edia.net> wrote in message
news:fa******** *************** ***@posting.goo gle.com...
I`m exporting data from many Lotus Notes databases to a DB2 database
using LotusScript. The LotusScript agents commit after EACH
update/insert. Nevertheless, I keep getting transaction rollbacks on
deadlock or timeout. When I get a snapshot for locks, I see that one
of the export agents is getting a table lock rather than a row lock.
I`m guessing this is what causes the time out. Questions: how do I
determine whether it`s a deadlock or a timeout? If it`s because of the
table locks, what can I do to prevent it?
LOCKLIST = 64000
DLCHKTIME = 15000
MAXLOCKS = 20
LOCKTIMEOUT = 45
Thanks.
Randy


I am not sure this will help, but try increasing maxlocks to 60. This means
that lock escalation will only occur if the agent is using more than 60% of
the locklist.

However, locks are usually released at each commit, so I don't know why you
are getting lock escalation unless the LotusScript agent specifically asked
for a table lock in the program. You should be able to track lock
escalations in the snapshot if that is occurring.

Doing a commit after each update/insert is not very efficient, so I would
consider exporting the data from Lotus into ASCII or del format and using
the DB2 import command with the "INSERT_UPD ATE" option (Adds rows of
imported data to the target table, or updates existing rows of the target
table with matching primary keys) and set COMMITCOUNT to 100. This should
cut the elapsed time at least in half but still provide reasonable
concurrency with other applications.
Nov 12 '05 #3
"Mark A" <ma@switchboard .net> wrote in message news:<qu******* ***********@new s.uswest.net>.. .
I am not sure this will help, but try increasing maxlocks to 60. This means
that lock escalation will only occur if the agent is using more than 60% of
the locklist.

However, locks are usually released at each commit, so I don't know why you
are getting lock escalation unless the LotusScript agent specifically asked
for a table lock in the program. You should be able to track lock
escalations in the snapshot if that is occurring.

Doing a commit after each update/insert is not very efficient, so I would
consider exporting the data from Lotus into ASCII or del format and using
the DB2 import command with the "INSERT_UPD ATE" option (Adds rows of
imported data to the target table, or updates existing rows of the target
table with matching primary keys) and set COMMITCOUNT to 100. This should
cut the elapsed time at least in half but still provide reasonable
concurrency with other applications.


Thanks. I hesitate to increase MAXLOCKS because I have 4 Lotus Notes
agents running at the same time -- each agent exporting 1 LN DB at a
time. Still, I'll give it a try -- can always change it back. Also, it
does look like it's a lock escalation issue. When I look at the
snapshot, I see that one of the agents has gotten a table IX lock.
Still, I don't know why that isn't released after the commit.
As for commit frequency and ascii import, this is an on-going process.
Each LN DB updates the DB2 tables once per day. The Notes databases
are our production application -- workflow for immigration
applications. So, I'm using agents to automate the process. FWIW,
before I started having these rollbacks, the agents were processing
about 150 Lotus Notes documents per second -- perfectly acceptable.
Again, thanks.
Nov 12 '05 #4
Ian <ia*****@mobile audio.com> wrote in message news:<40******* ***@corp.newsgr oups.com>...
You need to look at the reason code from the error:

SQL0911N, reason code 2 = deadlock
SQL0911N, reason code 68 = lock timeout
There are a number of parameters that you may need to consider:

LOCKTIMEOUT -- specifies the time lock waits will last before SQL0911N
LOCKLIST / MAXLOCKS -- controls the number of locks an application can
take before causing lock escalation


Ah ha! So they are all deadlocks. Using snapshot for locks, I found
that one agent is getting its locks escalated -- an IX table lock. My
LOCKLIST is 96000 and MAXLOCKS is 20. I'll try some fiddling to see
what happens.
Thanks.
Randy
Nov 12 '05 #5
"EoRaptor" <rc*******@patm edia.net> wrote in message
news:fa******** *************** ***@posting.goo gle.com...
"Mark A" <ma@switchboard .net> wrote in message news:<qu******* ***********@new s.uswest.net>.. .
I am not sure this will help, but try increasing maxlocks to 60. This means that lock escalation will only occur if the agent is using more than 60% of the locklist.

However, locks are usually released at each commit, so I don't know why you are getting lock escalation unless the LotusScript agent specifically asked for a table lock in the program. You should be able to track lock
escalations in the snapshot if that is occurring.

Doing a commit after each update/insert is not very efficient, so I would consider exporting the data from Lotus into ASCII or del format and using the DB2 import command with the "INSERT_UPD ATE" option (Adds rows of
imported data to the target table, or updates existing rows of the target table with matching primary keys) and set COMMITCOUNT to 100. This should cut the elapsed time at least in half but still provide reasonable
concurrency with other applications.


Thanks. I hesitate to increase MAXLOCKS because I have 4 Lotus Notes
agents running at the same time -- each agent exporting 1 LN DB at a
time. Still, I'll give it a try -- can always change it back. Also, it
does look like it's a lock escalation issue. When I look at the
snapshot, I see that one of the agents has gotten a table IX lock.
Still, I don't know why that isn't released after the commit.
As for commit frequency and ascii import, this is an on-going process.
Each LN DB updates the DB2 tables once per day. The Notes databases
are our production application -- workflow for immigration
applications. So, I'm using agents to automate the process. FWIW,
before I started having these rollbacks, the agents were processing
about 150 Lotus Notes documents per second -- perfectly acceptable.
Again, thanks.


I don't understand why you would be hesitant to increase MAXLOCKS. The worst
that will happen is that you will prevent escalation to table locks. If you
are running 4 agents at a time against the same table, you don't want
escalation. The only time you might want escalation is when you have single
job running against the table, and you need it to run faster by not having
to obtain (and maybe release) row locks for each row.

150 rows per second is pitiful performance, but if your volume is low, then
it doesn't matter.
Nov 12 '05 #6
"Mark A" <ma@switchboard .net> wrote in message news:<Hf******* *********@news. uswest.net>...
I don't understand why you would be hesitant to increase MAXLOCKS. The worst
that will happen is that you will prevent escalation to table locks. If you
are running 4 agents at a time against the same table, you don't want
escalation. The only time you might want escalation is when you have single
job running against the table, and you need it to run faster by not having
to obtain (and maybe release) row locks for each row.

150 rows per second is pitiful performance, but if your volume is low, then
it doesn't matter.


Is there a way to just turn off the bloody lock escalation?? Right
now, LOCKLIST is at 128000 and MAXLOCKS is at 60. Nevertheless, if I
run two or more agents(four are supposed to run), one of them ends up
getting a table lock -- at least that's what seems to be happening.
All agents are exactly the same and nowhere do I ask for a table lock.
Each agent has a maximum of 6 connections at any one time but it is a
certainty that NO agent will require any record written to, or held
by, any other agent (the combined primary key consists of the Lotus
Notes document ID and the Notes database replica ID and each agent
works wholly within one database and processes one document at a
time).
As far as performance, the bottleneck is on the Lotus Notes side...
exporting data to a text file isn't really any faster than the 150
records/sec direct export to DB2.
Thanks for your thoughts.
Randy
Nov 12 '05 #7
rc*******@patme dia.net (EoRaptor) wrote:
The LotusScript agents commit after EACH update/insert.


As Mark was saying, the lock escalation seems to make little sense -
are your insert/update statements doing row-at-a-time processing, or
set-based (e.g. INSERT SELECT)? If the latter, how many rows is your
largest insert or update statement processing?
Jeremy Rickard
Nov 12 '05 #8
rc*******@patme dia.net (EoRaptor) wrote in message news:<fa******* *************** ****@posting.go ogle.com>...
I`m exporting data from many Lotus Notes databases to a DB2 database
using LotusScript. The LotusScript agents commit after EACH
update/insert. Nevertheless, I keep getting transaction rollbacks on
deadlock or timeout. When I get a snapshot for locks, I see that one
of the export agents is getting a table lock rather than a row lock.
I`m guessing this is what causes the time out. Questions: how do I
determine whether it`s a deadlock or a timeout? If it`s because of the
table locks, what can I do to prevent it?


Your later posts show that you are getting deadlocks.

Why not attack the root cause of the deadlocks?

How are you doing the updates?
With Cursor ?
With searched-update? (check your indexes).
What is your db2level and operating-system? If v7.x consider DB2_RR_TO_RS=YE S

Are your inserts just plain INSERT ...VALUES?
Or are they INSERT INTO...SELECT ...FROM...WHERE ?

Are you committing after each insert, *and* after each update ?
Nov 12 '05 #9
Ian
EoRaptor wrote:
"Mark A" <ma@switchboard .net> wrote in message news:<Hf******* *********@news. uswest.net>...

I don't understand why you would be hesitant to increase MAXLOCKS. The worst
that will happen is that you will prevent escalation to table locks. If you
are running 4 agents at a time against the same table, you don't want
escalation. The only time you might want escalation is when you have single
job running against the table, and you need it to run faster by not having
to obtain (and maybe release) row locks for each row.

150 rows per second is pitiful performance, but if your volume is low, then
it doesn't matter.

Is there a way to just turn off the bloody lock escalation?? Right
now, LOCKLIST is at 128000 and MAXLOCKS is at 60. Nevertheless, if I
run two or more agents(four are supposed to run), one of them ends up
getting a table lock -- at least that's what seems to be happening.
All agents are exactly the same and nowhere do I ask for a table lock.
Each agent has a maximum of 6 connections at any one time but it is a
certainty that NO agent will require any record written to, or held
by, any other agent (the combined primary key consists of the Lotus
Notes document ID and the Notes database replica ID and each agent
works wholly within one database and processes one document at a
time).


Unfortunately you can't disable lock escalation entirely, without
resorting to locking the entire table for each transaction (this
would negatively affect concurrency :-)

If you have increased locklist (from 64000 to 128000) and maxlocks
(from 20 to 60), and are still having a problem, are you sure that
the changes have gone into effect? Keep in mind that the database
may need to be deactivated/reactivated for any changes to take effect
(I don't think you mentioned if you're on V7.x or V8.1).

Are you _sure_ your app is actually committing after each insert
or update? What is the scope of the update statements -- if each
update is updating a HUGE (with a 500 Mb locklist, and 60% available
per application you could lock well over 8,000,000 rows), maybe
something in your app is not right.

You should check the db2diag.log for more information. It will contain
information about lock escalations (like how many row locks were held
when escalation was triggered) as well as deadlocks. This may give you
a clue about an error in the app doing the migration. Trapping the SQL
will also help. As will running the app single threaded and monitoring
closely to see what's going on.

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1942
by: Vincento Harris | last post by:
Hi There is an application that runs on sql server. The application selects/updates some few tables frequently Once there is even a select on this table .It blocks other users sometimes for very long. Is there anything that can be done to reduce this? The table has 18000 rows and does not seem to have an index I thought indexing might help but 18000 rows without an index is no reason for 30 minutes of lock time. I will appreciate...
1
1821
by: cloverme | last post by:
The database is configured for single publisher, many subscribers, merge replication. The maintenance plan started to fail a couple of months ago and the database would not get backed up. After clearing all the locks, I am able to backup the database manually. The locks return again and I'm not able to backup the database with the maintenance plan. How can I get around the lock issue or solve it so that I can backup the database again?...
1
4003
by: dawatson833 | last post by:
I want to set an alert for a specific table whenever an event has caused a deadlock to occur on the table. I understand how to set up an alert. But I don't know which error number to use for the New Alert error number property for a deadlock. Or how to specify a deadlock on a specific table. Thanks, DW
3
3108
by: Uwe C. Schroeder | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. I have the following little stored proc: CREATE OR REPLACE FUNCTION public.ib_nextval(varchar) RETURNS varchar AS 'DECLARE
8
2105
by: Noni Ledford | last post by:
Hi - I have a database on a network, and each user logins using a shortcut from his PC to the shared database. There is a table created by a make-table query that locks up whenever more than one user is in the database. It doesn't matter that the users open completely different clients, forms, etc, as long as there are more than one user opens the database this table locks up. And the function that recalculates the amount doesn't work. ...
1
2648
by: leon | last post by:
Hi all, I have an .mdb file (access database) which has been set to table level locking (i.e. not just records in question, but the whole table). The database is also in sharing mode (ie. not exclusive)... here is my problem: i have an application that accesses the aforementioned database from Jet ODBC driver and runs a query which implicitly locks the whole table -
2
7656
by: Jürgen Devlieghere | last post by:
Hi, We are creating event-driven multi-threaded applications on a daily basis. To help us solving deadlocks, we implemented a CriticalSection class that does dead-lock detection: an attempt to Enter() the critical section that would cause a deadlock logs the complete deadlock loop (thread / Critical section) and raises an exception. It has helped us a lot in the past. However, to prevent further deadlocks, and to get a higher...
0
1069
by: chenchutnv | last post by:
Hi, Please Give Some Examples For Table Locks And Releasing The Table. Let Me Know Clearly Abot The 'tablockx' Command.and How To Release The Table And Syntex For That......my Intention Is If One User Access The Table I Want To Restrict The Accessing From Other Users...give Me The Ex.... If Anybody Know. Thanking You, Venkat
1
1479
by: TimHop12 | last post by:
Hello, I ran into a problem, where I am not sure how sql server is reacting - There is a table dbo.T1 with columns (OWNER, DATA)- now I have 3 stored procs - dbo.Begin, dbo.Copy, dbo.END. There is a process running which reads a file (file contains - OWNER and DATA) and calls these procs in the sequence dbo.Begin, dbo.Copy, dbo.END. dbo.Begin proc deletes the data from dbo.T1 table where OWNER='X' dbo.Copy proc copies the data to...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.