LockDump
Dump the FairCom Server internal lock table.
Short Name
ctLOKDMP()
Type
Low-Level function
Declaration
COUNT LockDump(COUNT refno, pTEXT dumpname, COUNT mode)
Description
LockDump() creates a diagnostic dump of the FairCom Server internal lock table. refno indicates whether locks for a particular file or user are to be dumped or whether all locks are to be dumped. mode indicates whether the dump is organized by file or by user number. dumpname is the name of a text file to which the contents of the dump will be appended.
The possible legal combinations of the mode and refno parameters are as follows:
refno |
mode |
Interpretation |
---|---|---|
ctLOKDMPallfiles ctLOKDMPdatafiles ctLOKDMPindexfiles filno |
ctLOKDMPfile |
Dump all locks by file. Dump all locks on data files. Dump all locks on index files. Dump locks for file filno. |
ctLOKDMPallusers ctLOKDMPcaller userno |
ctLOKDMPuser |
Dump all locks by user. Dump locks for user calling LockDump(). Dump locks for user userno. |
In all but one case of the above combinations the caller of LockDump() does not have to have any files open, although it is no problem if the caller does have files open. In the case of ctLOKDMPfile/filno, the caller must have opened a file with file number filno. The userno referenced in the last combination is the thread ID assigned by the FairCom Server. This thread ID is listed when ctadmn is used to list users logged on to the FairCom Server. In addition to dumping the location of the lock and the type of lock, users waiting for a lock are also listed.
Lock Dump Contents
=================================================
All Files Lock Dump at Fri May 04 13:00:12 2007
----------------
----------------
SOMEFILE.FCS>>
0000-013c9a16x T221 write/1: W060 W254 W740 W763 W758
0000-002916abx T758 write/1: W774 W772 W771 W775 W773 W778 W779 W776 W071
cumulative lock attempts: 4002(616) blocked: 21(0) dead-lock: 0 denied: 0
Current file lock count: 0
----------------
cumulative I/O: read ops: 0 bytes: 0 write ops: 5 bytes: 16768
.
.
.
.
List of connected clients
-------------------------
User# 00002: (Node name not set)
User# 00012: (Node name not set)
=================================================
Description
In the example above, there are two records with locks held in SOMEFILE.FCS. Each record is listed with it’s locked file offset value, the thread ID of the user holding the lock, the type of lock, and a listing of thread IDs waiting for the record lock to be released. The waiting thread IDs are further delineated with a prefix indicating the type of lock they are waiting to obtain, write (W) or read (R) locks.
Types of Locks
There are several types of record locks that can be reported. The most common of these are:
File Lock Info
Cumulative I/O
List of Connected Clients
A list of all connected clients is appended to the end of the lock dump output. This assists the correlation of known user threads at the application level to threads with potential blocked locks.
Note: On Windows, the list of connected clients includes the IP address in addition to the user name and node name.
Return
The common error code returns are:
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful lock dump. |
12 |
FNOP_ERR |
Could not open the dumpname text file. |
22 |
FNUM_ERR |
mode is ctLOKDMPfile and refno (filno) is out of range. |
26 |
FACS_ERR |
mode is ctLOKDMPfile and refno (filno) does not reference an opened file for the caller. |
116 |
IMOD_ERR |
Bad mode or combination of mode and refno. |
454 |
NSUP_ERR |
The call is not made to a FairCom Server; or the caller is not part of the ADMIN group; or DIAGNOSTICS LOCK_DUMP is not in the configuration file. |
See c-tree Error Codes for a complete listing of valid c-tree error values.
Example
COUNT retval;
TEXT dumpname[20]="AllUserLocks.dmp"
retval = LockDump(ctLOKDMPallusers, dumpname, ctLOKDMPuser);
switch (retval) {
case NO_ERROR:
break;
case NUSUP_ERR:
terminate("LockDump not supported .");
default:
terminate("LockDump error.");
}
Limitations
Note: Dumping large quantities of locks in a very active system could affect performance.
Because of potential performance impact, a FairCom Server will ONLY support the LockDump() call if either of the following conditions is met:
Related Topics