Finding the locks that belong to an agent
To diagnose lock contention problems between agents within Db2, it may be necessary to find and analyze all locks for a particular agent. To find these locks, only the RLPL records are needed.
To become oriented, find the lock request for the request's skeleton cursor table (CT) lock. The RLPL for this lock request contains the plan name in the resource name field. The resource name field begins at offset X'48' from the beginning of the RLPL and consists of a four-byte hash field, followed by a one-byte length field, followed by the 31-byte resource name field that contains the plan name. Therefore, you should find the plan name at offset X'4D' from the beginning of the RLPL. To find this lock request, scan the RLPL records looking for the plan name.
- The two-byte work unit number (RLPWUN) at offset X'2A'.
- The four-byte work unit ID address at offset X'2C'. This is the ACE or EB address.
- The two-byte owning work unit number (RLPOWN) at offset X'36'.
- The four-byte owning work unit address (RLPOWNID) at offset X'38'. This is an ACE address.
For a given work number (RLPWUN) span and the work unit ID address in the owning work unit (RLPOWU) remains the same.
For a given request, the work number, work unit ID address, and owning work unit address can change, depending on the overall processing involved for the request.
Within a work number span, the last associated RLPL is an UNLOCK request to release all locks held. This RLPL can be identified by:
- A four-byte token field (RLPLTOKN) at offset X'44' of all zeros.
- A 36-byte resource name field at offset X'48' of all zeros.
- A one-byte function field (RLPLFUNC) at offset X'80' that contains X'03', UNLOCK.
- A one-byte duration field (RLPLDURA) duration field in byte X'82' with a value equal to or higher than the duration of any prior lock requests.
- A corresponding
owning work unit address
(RLPOWNID) at offset X'38'.
After finding the RLPL for the plan request, find the work unit number and the owning work unit address. It might now be necessary to go backwards in the CTRACE to find the first occurrence of the work number/RLPOWU combination. If the preceding trace entries are to be ignored, then scan forward using the work number and RLPOWU. The last entry in the CTRACE for this combination should be an UNLOCK request to release all locks.
Usually, entries follow this request, but they have a different work number/RLPOWU combination. Repeat the process for these combinations.