Subject | Re: [ib-support] IB Deadlock. |
---|---|
Author | Salim Naufal |
Post date | 2002-01-07T00:00:16Z |
Alessandro,
I ran into the same problem. This is the case:
Say that you have an accounting program and that program maintains the
ballance of a given account. After inserting an accounting voucher, an After
Insert trigger is fired and the ballance of the account is updated. In many
cases, two operators write vouchers that affect the same account (say the
bank account). When posting the voucher, we ran into deadlocks. We had two
choices, either rollback the transaction then retry or figure our a way to
remove the concurency from the operation. This is what we did:
We created a new table and changed the After Insert trigger to insert the
information in that table. Then on the Win2K server, we wrote a service that
periodically execute a stored procedure that scans this table, update the
account ballances and deletes the processed rows. You can elaborate on
this scheme in order to optimize it. It may not be the best way but it works
and is quite efficient.
Hope that helps
Salim
I ran into the same problem. This is the case:
Say that you have an accounting program and that program maintains the
ballance of a given account. After inserting an accounting voucher, an After
Insert trigger is fired and the ballance of the account is updated. In many
cases, two operators write vouchers that affect the same account (say the
bank account). When posting the voucher, we ran into deadlocks. We had two
choices, either rollback the transaction then retry or figure our a way to
remove the concurency from the operation. This is what we did:
We created a new table and changed the After Insert trigger to insert the
information in that table. Then on the Win2K server, we wrote a service that
periodically execute a stored procedure that scans this table, update the
account ballances and deletes the processed rows. You can elaborate on
this scheme in order to optimize it. It may not be the best way but it works
and is quite efficient.
Hope that helps
Salim
----- Original Message -----
From: Alessandro Ortuso
To: ib-support@yahoogroups.com
Sent: Thursday, January 03, 2002 7:26 PM
Subject: [ib-support] IB Deadlock.
Hi!
We have a quite big application that has this situation:
Program A inserts a number of records in the table T1 and a trigger on
the
AfterInsert update a value on the table T2 refering to the T1 record
Program B does about the same operations
These programs run at the same times in a transaction so the program B
could insert records in T1 (and updating the refering record in T2) that
are already modified from program A.
This is a tipical deadlock situation as A cannot insert in T1 as is
waiting
for B to finish and the same B for A.
How do you solve this problem?
Do you rollback program A so B can continue?
Do you have any other ideas?
TIA,
Alessandro
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.