Re: Reorderbuffer crash during recovery

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: vignesh C <vignesh21(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-30 05:47:08
Message-ID: CAA4eK1LMgD5J8GpkLc2pAw9Opfe8KDz1OoY3eFSDQuZOQBU2Ng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Fri, Dec 27, 2019 at 8:37 PM Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
>
> 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?
>

makes sense. But, I think we should add a comment specifying the
reason why it is important to set final_lsn while serializing the
change.

> Also, would it be sane to verify that the TXN
> doesn't already have a newer final_lsn? Maybe as an Assert.
>

I don't think this is a good idea because we update the final_lsn with
commit_lsn in ReorderBufferCommit after which we can try to serialize
the remaining changes. Instead, we should update it only if the
change_lsn value is greater than final_lsn.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Загороднев Роман Евгеньевич 2019-12-30 11:46:05 RE: pg_upgrade
Previous Message Jeff Janes 2019-12-29 21:17:14 Re: BUG #16098: unexplained autovacuum to prevent wraparound

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2019-12-30 06:43:04 Re: Yet another fast GiST build
Previous Message Amit Kapila 2019-12-30 05:10:39 Re: [HACKERS] Block level parallel vacuum