Dead lock occurs even update on different fields

I have been trying to develop replication from a Firebird database to other. I simply add a new field to tables named replication_flag.

My replication program starts a read committed transaction, select rows, update this replication_flag field of rows then then commits or rollbacks.

My production client(s) does not update this replication_flag field and uses read committed isolation. My only one replication client only update this replication_flag field and does not update any other fields.

I still see dead locks and do not understand why. How can I avoid dead locks?

Upvotes: 2

Views: 527

Answers (1)

JPB31
JPB31

Reputation: 128

It seems that your replication app use a large transaction updating each record of each table. Probably, at the end, the whole database has been "locked".

You should consider using transactions by table or record packets. it's also possible to use a read-only transaction to read, and use an other transaction to write, with frequent commit, that allow other transactions to update the record.

An interesting slideshow: http://slideplayer.us/slide/1651121/

Upvotes: 1

Related Questions