Hi Bill,
you are right, isolation levels correspond to those taught in database courses and they are enforced via locking. Normally, the _isolationLevel parameter determines the types (none/shared/exclusive) and granularities(collection/doctype/document) of locks Tamino needs to ensure correct transaction behavior. The _lockMode parameter is an additional parameter for advanced users who exactly know what type of document locks their applications need. The _lockMode parameter overrides the document lock types as they would have been requested for the specified _isolationLevel.
Answering your questions in detail:
1. Running a query with _lockMode=unprotected means that Tamino does not acquire locks on documents, independent of the transaction’s _isolationLevel. As a user of this feature you must be aware, that Tamino in this case no longer ensures that documents read in the query are committed. However the application might know that it is committed/reliable, e.g. catalogue data that is not updated at all. Running a query with _lockMode=unprotected can result in better performance.
2. It is true, _lockMode=shared has no effect with _isolationLevel>=stableDocument. _lockMode=unprotected is not treated as a contradiction, see answer above.
3. It is possible to combine _isolationLevel=stableCursor with _lockMode. However, when using the _lockMode parameter, you switch off the “stableCursor” for that request. The _lockMode parameter always specifies transaction-wide locks on documents (or to acquire no document locks at all).
Only if you do not specify the _lockMode then a document lock can be released as soon as the document is no longer accessible from the cursor. Of course, this will only be done if the document is not locked by another cursor and if no other query with _lockMode=shared/protected had locked the document for the entire transaction.
Please note, with XQuery cursors “stableCursor” behaves like “stableDocument” in V411. In V414 this applies only for sensitive XQuery cursors.
4. _lockWait=yes is not only to block readers but also to block writers. Every writer needs exclusive locks on documents to be updated/inserted/deleted. Respective lock requests experience locking conflicts if concurrent transactions already hold shared locks on these documents.
In general, the _lockWait parameter specifies what Tamino shall do if a lock (shared or exclusive) cannot be granted immediately. In case of _lockWait=no Tamino returns an error (9155) otherwise Tamino waits until the lock will be granted.
For _isolationLevel=serializable Tamino acquires shared locks on entire doctypes. In this case it is not possible to modify the doctype extent, i.e. it is not possible to update any document, to delete any document or to insert a new document. With _lockWait=yes such modifying requests will wait until the shared lock on the affected doctype has been released.
Hope this helps,
Michael
#API-Management#Tamino#webMethods