pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Andy Fan <zhihui.fan1213@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Check what has been done for a uncommitted prepared transaction
Date: Fri, 15 May 2020 08:48:08 +0200
Message-ID: <cf943035f9f49415936d5df350cb671ab2f6eed9.camel@cybertec.at> (raw)
In-Reply-To: <CAKU4AWoH7AJS=tknH6DL3fOS_BT-O0ZT60aOTUrY4M9je8p85g@mail.gmail.com>
References: <CAKU4AWpyT1NMKjuX0myda8Q2SukrA7JROtjVcv9tNxqAptuwKQ@mail.gmail.com>
	<20200514080447.GE166343@paquier.xyz>
	<CAKU4AWqroPUW9GOLLycJxZTW-+qNRLf_8L59jXwXZ4ZmJcnU7A@mail.gmail.com>
	<1e39c06492fe7ee13946d648b5f4749d116b077e.camel@cybertec.at>
	<CAKU4AWoH7AJS=tknH6DL3fOS_BT-O0ZT60aOTUrY4M9je8p85g@mail.gmail.com>

On Fri, 2020-05-15 at 08:09 +0800, Andy Fan wrote:
> On Thu, May 14, 2020 at 9:33 PM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> > On Thu, 2020-05-14 at 16:26 +0800, Andy Fan wrote:
> > > Thanks,  actually I don't know how to use prepared transaction and how it works.
> > > I care about this because there is a long prepared transaction exists in our customer,
> > > and we want to know what this transaction has done(like any data it changed). 
> > > All the things I know is the data comes from pg_prepared_xact, but it doesn't help a lot. 
> > 
> > Idf you have the transaction ID from "pg_prepared_xact", you could check
> > what locks are held:
> > 
> > SELECT * FROM pg_locks WHERE transactionid = ...;
> > 
> > Than might give you a clue.
> > 
> 
> Thanks a lot.   this transaction only lock a transactionid lock,   so I assume there is nothing
> is done in this transaction. 
> 
> 
>   locktype    | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid  |     mode      | granted | fastpath
> ---------------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+------+---------------+---------+----------
>  transactionid |          |          |      |       |            |    1181845808 |         |       |          | -1/1181845808      |      | ExclusiveLock | t       | f
> (1 row)

Looks like it, yes.
Roll it back then.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (7+ messages)

Message-ID: <cf943035f9f49415936d5df350cb671ab2f6eed9.camel@cybertec.at>
Permalink:  ../cf943035f9f49415936d5df350cb671ab2f6eed9.camel@cybertec.at/
Also on:    postgresql.org/message-id/cf943035f9f49415936d5df350cb671ab2f6eed9.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, zhihui.fan1213@gmail.com, michael@paquier.xyz
  Subject: Re: Check what has been done for a uncommitted prepared transaction
  In-Reply-To: <cf943035f9f49415936d5df350cb671ab2f6eed9.camel@cybertec.at>
  References: <CAKU4AWpyT1NMKjuX0myda8Q2SukrA7JROtjVcv9tNxqAptuwKQ@mail.gmail.com> <20200514080447.GE166343@paquier.xyz> <CAKU4AWqroPUW9GOLLycJxZTW-+qNRLf_8L59jXwXZ4ZmJcnU7A@mail.gmail.com> <1e39c06492fe7ee13946d648b5f4749d116b077e.camel@cybertec.at> <CAKU4AWoH7AJS=tknH6DL3fOS_BT-O0ZT60aOTUrY4M9je8p85g@mail.gmail.com> <cf943035f9f49415936d5df350cb671ab2f6eed9.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox