Re: Reorderbuffer crash during recovery

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reorderbuffer crash during recovery
Date: 2019-12-27 15:07:06
Message-ID: 20191227150706.GA24311@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 2019-Dec-27, vignesh C wrote:

> I felt amit solution also solves the problem. Attached patch has the
> fix based on the solution proposed.
> Thoughts?

This seems a sensible fix to me, though I didn't try to reproduce the
failure.

> @@ -2472,6 +2457,7 @@ ReorderBufferSerializeTXN(ReorderBuffer *rb, ReorderBufferTXN *txn)
> }
>
> ReorderBufferSerializeChange(rb, txn, fd, change);
> + txn->final_lsn = change->lsn;
> dlist_delete(&change->node);
> ReorderBufferReturnChange(rb, change);

Should this be done insider ReorderBufferSerializeChange itself, instead
of in its caller? Also, would it be sane to verify that the TXN
doesn't already have a newer final_lsn? Maybe as an Assert.

> @@ -188,8 +188,7 @@ typedef struct ReorderBufferTXN
> * * plain abort record
> * * prepared transaction abort
> * * error during decoding
> - * * for a crashed transaction, the LSN of the last change, regardless of
> - * what it was.
> + * * last serialized lsn
> * ----

I propose "for a transaction with serialized changes, the LSN of the
latest serialized one, unless one of the above cases."

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Zhihong Zhang 2019-12-27 17:28:38 RE: Indexing on JSONB field not working
Previous Message Juan José Santamaría Flecha 2019-12-27 12:41:03 Re: pg_upgrade

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2019-12-27 15:47:01 Re: use CLZ instruction in AllocSetFreeIndex()
Previous Message Tom Lane 2019-12-27 14:54:35 Re: use CLZ instruction in AllocSetFreeIndex()