Re: Assertion failure while streaming toasted data

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: Assertion failure while streaming toasted data
Date: 2021-05-25 09:04:23
Message-ID: CAFiTN-swBQLCk5O8DA375S78UenxGsCqitRhk=BXgoDutGN5Gw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 25, 2021 at 1:59 PM Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> wrote:

>
> On Tue, May 25, 2021 at 1:49 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>>
>> On Tue, May 25, 2021 at 1:45 PM Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> wrote:
>> >
>> > I am not entirely sure if it works correctly. I'd tried something similar, but the downstream node using
>> > my output plugin gets NULL values for the toast columns. It's a bit hard to demonstrate that with the
>> > test_decoding plugin, but if you have some other mechanism to test that change with an actual downstream
>> > node receiving and applying changes, it will be useful to test with that.
>>
>> Okay, I will test that. Thanks.
>>
>
> I modified test_decoding to print the tuples (like in the non-streamed case) and included your proposed fix. PFA
>
> When the transaction is streamed, I see:
> ```
> + opening a streamed block for transaction
> + table public.toasted: INSERT: id[integer]:9001 other[text]:'bbb' data[text]:'ccc'
> + table public.toasted: INSERT: id[integer]:9002 other[text]:'ddd' data[text]:'eee'
> + table public.toasted: INSERT: id[integer]:9003 other[text]:'bar' data[text]:unchanged-toast-datum
> <snipped>
> ```
>
> For a non-streamed case, the `data[text]` column shows the actual data. That probably manifests into NULL data when downstream handles it.

Yes, I am able to reproduce this, basically, until we get the last
tuple of the multi insert we can not clear the toast data otherwise we
can never form a complete tuple. So the only possible fix I can think
of is to consider the multi-insert WAL without the final multi-insert
tuple as partial data then we will avoid streaming until we get the
complete WAL of one multi-insert. I am working on the patch to fix
this, I will share that in some time.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-05-25 09:04:40 Re: libpq_pipeline in tmp_install
Previous Message Paul Guo 2021-05-25 08:57:02 Re: pg_rewind fails if there is a read only file.