LOCK_DEBUG documentation

Greg Sabino Mullane <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.patches
Message-ID <20080520200758.03f89b2d@greg-laptop>
Documentation patch by Kevin L. McBride explaining LOCK_DEBUG options
in detail.

-- 
Greg Sabino Mullane
End Point Corporation


-- 
Sent via pgsql-patches mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches
config.sgml.patch (text/x-patch, 7.1 KB)
Index: config.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/config.sgml,v
retrieving revision 1.179
diff -c -c -r1.179 config.sgml
*** config.sgml	19 May 2008 18:08:15 -0000	1.179
--- config.sgml	21 May 2008 00:03:09 -0000
***************
*** 5084,5098 ****
  
       <varlistentry>
        <term><varname>trace_locks</varname> (<type>boolean</type>)</term>
        <term><varname>trace_lwlocks</varname> (<type>boolean</type>)</term>
        <term><varname>trace_userlocks</varname> (<type>boolean</type>)</term>
!       <term><varname>trace_lock_oidmin</varname> (<type>boolean</type>)</term>
!       <term><varname>trace_lock_table</varname> (<type>boolean</type>)</term>
        <term><varname>debug_deadlocks</varname> (<type>boolean</type>)</term>
        <term><varname>log_btree_build_stats</varname> (<type>boolean</type>)</term>
        <listitem>
         <para>
!         Various other code tracing and debugging options.
         </para>
        </listitem>
       </varlistentry>
--- 5084,5244 ----
  
       <varlistentry>
        <term><varname>trace_locks</varname> (<type>boolean</type>)</term>
+       <indexterm>
+        <primary><varname>trace_locks</> configuration parameter</primary>
+       </indexterm>
+       <listitem>
+        <para>
+         If on, emit information about lock usage.  Information dumped
+         includes the type of lock operation, the type of lock and the unique
+         identifier of the object being locked or unlocked.  Also included
+         are bitmasks for the lock types already granted on this object as
+         well as for the lock types awaited on this object.  For each lock
+         type a count of the number of granted locks and waiting locks is
+         also dumped as well as the totals.  An example of the log file output
+         is shown here:
+        </para>
+        <para>
+         LOG:  LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1)
+               grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
+               wait(0) type(AccessShareLock)
+        </para>
+        <para>
+         LOG:  GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1)
+               grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1
+               wait(0) type(AccessShareLock)
+ 
+        </para>
+        <para>
+         LOG:  UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1)
+               grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
+               wait(0) type(AccessShareLock)
+        </para>
+        <para>
+         LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
+               grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0
+               wait(0) type(INVALID)
+        </para>
+        <para>
+         Details of the structure being dumped may be found in
+         src/include/storage/lock.h
+        </para>
+        <para>
+         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
+         macro was defined when <productname>PostgreSQL</productname> was
+         compiled.
+        </para>
+       </listitem>
+      </varlistentry>
+ 
+      <varlistentry>
        <term><varname>trace_lwlocks</varname> (<type>boolean</type>)</term>
+       <indexterm>
+        <primary><varname>trace_lwlocks</> configuration parameter</primary>
+       </indexterm>
+       <listitem>
+        <para>
+         If on, emit information about lightweight lock usage.  Lightweight
+         locks are intended primarily to provide mutual exclusion of access
+         to shared-memory data structures.
+        </para>
+        <para>
+         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
+         macro was defined when <productname>PostgreSQL</productname> was
+         compiled.
+        </para>
+       </listitem>
+      </varlistentry>
+ 
+      <varlistentry>
        <term><varname>trace_userlocks</varname> (<type>boolean</type>)</term>
!       <indexterm>
!        <primary><varname>trace_userlocks</> configuration parameter</primary>
!       </indexterm>
!       <listitem>
!        <para>
!         If on, emit information about user lock usage.  Output is the same
!         as for <symbol>trace_locks</symbol>, only for user locks.
!        </para>
!        <para>
!         User locks were removed as of PostgreSQL version 8.2.  This option
!         currently has no effect.
!        </para>
!        <para>
!         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
!         macro was defined when <productname>PostgreSQL</productname> was
!         compiled.
!        </para>
!       </listitem>
!      </varlistentry>
! 
!      <varlistentry>
!       <term><varname>trace_lock_oidmin</varname> (<type>integer</type>)</term>
!       <indexterm>
!        <primary><varname>trace_lock_oidmin</> configuration parameter</primary>
!       </indexterm>
!       <listitem>
!        <para>
!         If set, do not trace locks for tables below this OID. (use to avoid
!         output on system tables)
!        </para>
!        <para>
!         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
!         macro was defined when <productname>PostgreSQL</productname> was
!         compiled.
!        </para>
!       </listitem>
!      </varlistentry>
! 
!      <varlistentry>
!       <term><varname>trace_lock_table</varname> (<type>integer</type>)</term>
!       <indexterm>
!        <primary><varname>trace_lock_table</> configuration parameter</primary>
!       </indexterm>
!       <listitem>
!        <para>
!         Unconditionally trace locks on this table (OID).
!        </para>
!        <para>
!         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
!         macro was defined when <productname>PostgreSQL</productname> was
!         compiled.
!        </para>
!       </listitem>
!      </varlistentry>
! 
!      <varlistentry>
        <term><varname>debug_deadlocks</varname> (<type>boolean</type>)</term>
+       <indexterm>
+        <primary><varname>debug_deadlocks</> configuration parameter</primary>
+       </indexterm>
+       <listitem>
+        <para>
+         If set, dumps information about all current locks when a
+         DeadLockTimeout occurs.
+        </para>
+        <para>
+         This parameter is only available if the <symbol>LOCK_DEBUG</symbol>
+         macro was defined when <productname>PostgreSQL</productname> was
+         compiled.
+        </para>
+       </listitem>
+      </varlistentry>
+ 
+      <varlistentry>
        <term><varname>log_btree_build_stats</varname> (<type>boolean</type>)</term>
+       <indexterm>
+        <primary><varname>log_btree_build_stats</> configuration parameter</primary>
+       </indexterm>
        <listitem>
         <para>
!         If set, logs system resource usage statistics (memory and CPU) on
!         various btree operations.
!        </para>
!        <para>
!         This parameter is only available if the <symbol>BTREE_BUILD_STATS</symbol>
!         macro was defined when <productname>PostgreSQL</productname> was
!         compiled.
         </para>
        </listitem>
       </varlistentry>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.