Subject | MultiThreading and Firebird |
---|---|
Author | Jaume Llunell Gómez |
Post date | 2012-10-16T15:21:07Z |
Hi,
I'm testing delphi OmniThreadLibrary with Firebird 2.5.1 and FibPlus 7.0.
I'm doing a writing test, trying to find the best way to do multithreading
writing tasks, for example:
With two different threads, with two different connections and transactions
doing an update to the same record:
for i = 0 to 1000 do begin
....
UPDATE TABLE1 SET FIELD1= FIELD1+1 WHERE ID = 1
transaction.commitretaining;
end
As i expected, i get a lot of deadlocks, even with isc_tpb_read_committed
and isc_tpb_wait in the transactions.
Is there any transaction isolation mode that could achieve this, like
in-memory multithreading with critical sections for global variables? Or
any way to do a lot of multithreading writes trying to avoid deadlocks?
For now, the only way that works correctly is with an autonomous
transaction inside a procedure, but i would like not to put autonomous
transactions in all my
Thank you very much.
[Non-text portions of this message have been removed]
I'm testing delphi OmniThreadLibrary with Firebird 2.5.1 and FibPlus 7.0.
I'm doing a writing test, trying to find the best way to do multithreading
writing tasks, for example:
With two different threads, with two different connections and transactions
doing an update to the same record:
for i = 0 to 1000 do begin
....
UPDATE TABLE1 SET FIELD1= FIELD1+1 WHERE ID = 1
transaction.commitretaining;
end
As i expected, i get a lot of deadlocks, even with isc_tpb_read_committed
and isc_tpb_wait in the transactions.
Is there any transaction isolation mode that could achieve this, like
in-memory multithreading with critical sections for global variables? Or
any way to do a lot of multithreading writes trying to avoid deadlocks?
For now, the only way that works correctly is with an autonomous
transaction inside a procedure, but i would like not to put autonomous
transactions in all my
Thank you very much.
[Non-text portions of this message have been removed]