Unanswered: Can Proxy Tables lead to possible deadlock ?
I've build a process that transfers data from a source server(ASE) to a destination one (IQ). When running it I receive, rarely but rather constant, a deadlock error.
I have a table on ASE and created a proxy table in IQ that points to it.
The flow is as follows :
1. An external source inserts data into ASE table.
2. The copy process (running on IQ), checks if data is available in ASE (looks in the ProxyTable from IQ), and, if yes, copies it from the actual table from ASE (bulk insert using : insert into location) into another table on IQ.
3. If the copy succeeded, from the same same IQ process I invoke a "delete" cmd on the proxyTable (with the purpose of erasing the data from the ASE source table), to clear off the data that has been copied.
Is it possible that the process which inserts data, first gets a lock on the ASE table (and in background this perhaps implies a request for a lock on proxy table from IQ ?), and at the same time the deletion process from IQ has a lock on the proxyTable (and waits for a lock on Original ASE table, which is already taken) ?
This is the only scenario I can think of that can cause a deadlock to arise, both processes having one lock and waiting for the other.
How does the locking mechanism work when dealing with proxy tables.
Eventually it had nothing to do with the proxy table. I've re-factored the code and managed to make all (insert, delete) operations on the original table (via remote procedure calls) and the deadlock was still there.
Solved it by asking for an exclusive lock before performing the deletion.