Re: obtaining row locking information

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: obtaining row locking information
Date: 2005-08-12 03:27:25
Message-ID: 20050812.122725.104030712.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Hi,
>
> With a help from Bruce, I wrote a small function which returns row
> locking information(see attached file if you are interested). Here is
> a sample result:
>
> test=# select * from pgrowlocks('t1');
> locked_row | lock_type | locker | multi
> ------------+-----------+--------+-------
> (0,1) | Shared | 1 | t
> (0,3) | Exclusive | 575 | f
> (2 rows)
>
> I think it will be more usefull if actual xids are shown in the case
> "locker" is a multixid. It seems GetMultiXactIdMembers() does the
> job. Unfortunately that is a static funtcion, however. Is there any
> chance GetMultiXactIdMembers() becomes public funtion?

I enhanced pgrowlocks() to use GetMultiXactIdMembers() so that it
displays each xid belonging to particular multi xid (see attached
source code).

test=# select * from pgrowlocks('t1');
locked_row | lock_type | locker | multi | xids
------------+-----------+--------+-------+-----------
(0,1) | Shared | 3 | t | {646,647}
(1 row)

However even one of transactions, for example 647 commits, still it
shows as if 647 is a member of muitixid 3.

test=# select * from pgrowlocks('t1');
locked_row | lock_type | locker | multi | xids
------------+-----------+--------+-------+-----------
(0,1) | Shared | 3 | t | {646,647}
(1 row)

Am I missing something?
--
Tatsuo Ishii

Attachment Content-Type Size
unknown_filename text/plain 5.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-08-12 03:28:19 Re: ereport(ERROR) and files
Previous Message Bruce Momjian 2005-08-12 03:09:37 ereport(ERROR) and files