What do you do with a long running rollback

Started by Chris Cawleyover 4 years ago5 messagesgeneral
Jump to latest
#1Chris Cawley
cj_cawley@yahoo.com

It's been like that for several days already.
ThanksChris

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Chris Cawley (#1)
Re: What do you do with a long running rollback

Chris Cawley <cj_cawley@yahoo.com> writes:

It's been like that for several days already.

Really? Rollback is O(1) in Postgres.

I could possibly believe that it's blocked on a lock, but even
that would be a bug, because transaction abort should never try
to take any new locks.

A perhaps-more-plausible theory is that you've enabled synchronous
commit but your replica is failing to ack the transmission of the
abort's WAL record.

What are you looking at exactly?

regards, tom lane

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Chris Cawley (#1)
Re: What do you do with a long running rollback

Chris Cawley <cj_cawley@yahoo.com> writes:

Here's the query :

| SELECT pid, age(clock_timestamp(), query_start), usename, query |
| | FROM pg_stat_activity |
| | WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| | ORDER BY query_start desc; |

Return output is pid | 4 days | user | ROLLBACK

I think the fault's in your query; it's presuming a long-obsolete
convention about how idle sessions are represented in pg_stat_activity.
These days you should be filtering on "state" or "wait_event_type".
This output is just telling you that the last thing that session
did, four days ago, was a ROLLBACK.

regards, tom lane

#4Dischner, Anton
Anton.Dischner@med.uni-muenchen.de
In reply to: Tom Lane (#2)
AW: What do you do with a long running rollback

Hi Tom,

do you see heavy disk activity?

best,

A

-----Ursprüngliche Nachricht-----
Von: Tom Lane <tgl@sss.pgh.pa.us>
Gesendet: Freitag, 26. November 2021 19:42
An: Chris Cawley <cj_cawley@yahoo.com>
Cc: pgsql-admin@lists.postgresql.org
Betreff: Re: What do you do with a long running rollback

Chris Cawley <cj_cawley@yahoo.com> writes:

It's been like that for several days already.

Really? Rollback is O(1) in Postgres.

I could possibly believe that it's blocked on a lock, but even that would be a bug, because transaction abort should never try to take any new locks.

A perhaps-more-plausible theory is that you've enabled synchronous commit but your replica is failing to ack the transmission of the abort's WAL record.

What are you looking at exactly?

regards, tom lane

#5Chris Cawley
cj_cawley@yahoo.com
In reply to: Dischner, Anton (#4)
Re: AW: What do you do with a long running rollback

Thanks for the support.  It looks like the transaction cleared off over the weekend.
Chris

On Monday, November 29, 2021, 05:13:28 AM EST, Dischner, Anton <anton.dischner@med.uni-muenchen.de> wrote:

Hi Tom,

do you see heavy disk activity?

best,

A

-----Ursprüngliche Nachricht-----
Von: Tom Lane <tgl@sss.pgh.pa.us>
Gesendet: Freitag, 26. November 2021 19:42
An: Chris Cawley <cj_cawley@yahoo.com>
Cc: pgsql-admin@lists.postgresql.org
Betreff: Re: What do you do with a long running rollback

Chris Cawley <cj_cawley@yahoo.com> writes:

It's been like that for several days already.

Really?  Rollback is O(1) in Postgres.

I could possibly believe that it's blocked on a lock, but even that would be a bug, because transaction abort should never try to take any new locks.

A perhaps-more-plausible theory is that you've enabled synchronous commit but your replica is failing to ack the transmission of the abort's WAL record.

What are you looking at exactly?

            regards, tom lane