Re: Avoid streaming the transaction which are skipped (in corner cases)

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Avoid streaming the transaction which are skipped (in corner cases)
Date: 2022-12-02 11:28:30
Message-ID: CAExHW5tSvhOjErMtqPVhtMAcU4kB7cnjuoSOjWaPt0PvnJMpLQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Dilip,

On Tue, Nov 29, 2022 at 9:38 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> >
> > You are right we need this in ReorderBufferProcessPartialChange() as
> > well. I will fix this in the next version.
>
> Fixed this in the attached patch.
>

I focused my attention on SnapBuildXactNeedsSkip() usages and I see
they are using different end points of WAL record
1 decode.c logicalmsg_decode 594
SnapBuildXactNeedsSkip(builder, buf->origptr)))
2 decode.c DecodeTXNNeedSkip 1250 return
(SnapBuildXactNeedsSkip(ctx->snapshot_builder, buf->origptr) ||
3 reorderbuffer.c AssertTXNLsnOrder 897 if
(SnapBuildXactNeedsSkip(ctx->snapshot_builder,
ctx->reader->EndRecPtr))
4 reorderbuffer.c ReorderBufferCanStartStreaming 3922
!SnapBuildXactNeedsSkip(builder, ctx->reader->EndRecPtr))
5 snapbuild.c SnapBuildXactNeedsSkip 429
SnapBuildXactNeedsSkip(SnapBuild *builder, XLogRecPtr ptr)

The first two are using origin ptr and the last two are using end ptr.
you have fixed the fourth one. Do we need to fix the third one as
well?

Probably we need to create two wrappers (macros) around
SnapBuildXactNeedsSkip(), one which accepts a XLogRecordBuffer and
other which accepts XLogReaderState. Then use those. That way at least
we have logic unified as to which XLogRecPtr to use.

--
Best Wishes,
Ashutosh Bapat

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2022-12-02 11:33:33 Re: Fix gin index cost estimation
Previous Message Hayato Kuroda (Fujitsu) 2022-12-02 11:27:19 RE: Perform streaming logical transactions by background workers and parallel apply