Update without LockMode = Deadlock?!?

Hi, i’m doing some high concurrency test with tamino 4.4, using java API.

With high concurrency, I have got a lot of deadlock errors, no matter the Isolation Degree. The only way to avoid this, is using LockMode = Protected for updates.

However, in the Transactions Guide of Documentation, LockMode Parameter descriptions, i can read this:

It’s a documentation error or I’m doing something wrong?

It’s possible doing updates safely (No deadlocks risk) without lockMode ?

The lockMode paremeter does the same that the IsolationLevel parameter in tamino api 4.2 (method SetIsolationLevel of class TConnection)?

Hi Flush,

the additional rules refers to the fact that updated documents in any case need to be locked with an exclusive lock, independent of how the lockMode parameter is set.

To the best of my knowledge the Java API’s “IsolationLevel” parameter gets mapped to the X-Machine’s “_lockMode” and the Java API’s “IsolationDegree” gets mapped to X-Machine’s “IsolationLevel”.

The answer to your other questions depend on the type of update you are requesting. Is it an update where the new document content is written via a _process command or is it an XQuery update?

In the first case, only the updated document gets locked with an exclusive lock and a deadlock should only occur if applications access documents in different order with incompatible locks.

In the XQuery case you need to be aware that the XQuery update is executed in two steps. The first step reads the documents to be updated and those that are needed to calculate the new values. During that phase, the query is considered to be a plain query, i.e. documents are only locked with a shared lock (dirty read is not allowed for XQuery updates). The second phase then calculates the changes and updates the documents which are to be updated. Where needed, the previously acquired locks will be upgraded to exclusive locks. This procedure can cause deadlocks, which can be prevented with the lockMode=protected directive. In this case, all the documents read in the first step are immediately locked with an exclusive lock.

Hope this helps,

Michael