Re: Fix showing XID of a spectoken lock in an incorrect field of pg_locks view.

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix showing XID of a spectoken lock in an incorrect field of pg_locks view.
Date: 2023-01-05 06:15:41
Message-ID: CAD21AoCO4NZZDCPJQfny8Ew1Y8xKNz-7KFzxak1SHeyu21uNdA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 4, 2023 at 6:42 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Wed, Jan 4, 2023 at 12:16 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> >
> > It seems to be confusing and the user won't get the result even if
> > they search it by transactionid = 741. So I've attached the patch to
> > fix it. With the patch, the pg_locks views shows like:
> >
> > locktype | database | relation | page | tuple | virtualxid |
> > transactionid | classid | objid | objsubid | virtualtransaction | pid
> > | mode | granted | fastpath | waitstart
> > -----------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+--------+---------------+---------+----------+-----------
> > spectoken | | | | | |
> > 746 | | 1 | | 3/4 | 535618 |
> > ExclusiveLock | t | f |
> > (1 row)
> >
>
> Is it a good idea to display spec token as objid, if so, how will
> users know? Currently for Advisory locks, we display values in
> classid, objid, objsubid different than the original meaning of fields
> but those are explained in docs [1]. Wouldn't it be better to mention
> this in docs?

Agreed. Attached the updated patch.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v2-0001-Fix-showing-transaction-id-of-a-spectoken-in-an-i.patch application/octet-stream 1.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2023-01-05 06:23:24 Re: Resolve UNKNOWN type to relevant type instead of text type while bulk update using values
Previous Message Sayyid Ali Sajjad Rizavi 2023-01-05 06:10:50 Resolve UNKNOWN type to relevant type instead of text type while bulk update using values