Re: BUG #13725: Logical Decoding - wrong results with large transactions and unfortunate timing - Mailing list pgsql-bugs

From
Subject Re: BUG #13725: Logical Decoding - wrong results with large transactions and unfortunate timing
Date
Msg-id CAPL_MpPTaxc6mU-bLYtxkG23qk5aNftd6Q9GbQdK3GtyT5JV-A@mail.gmail.com
Whole thread Raw
In response to Re: BUG #13725: Logical Decoding - wrong results with large transactions and unfortunate timing  (Andres Freund <andres@anarazel.de>)
Responses Re: BUG #13725: Logical Decoding - wrong results with large transactions and unfortunate timing  (<ofir.manor@gmail.com>)
List pgsql-bugs
>
>
> > 2. I have validated that a single call to pg_logical_slot_get_changes
> > returns a result set with duplicates, going back to the start (I've seen
> it
> > with a Java debugger, looping over the forward-only cursor of the SELECT
> > from the replication slot). That is the bug I'm reporting - not across
> > calls but within a single call.
>
> That'd be rather weird. I'll look into it, but due to the pgconf.eu
> conference this week I can't promise I'll get to it this week.
>
>
> Andres
>


Sure, triage can wait, make the most out of the conference and thanks for
the fast replies!
I did update the test case to prove that all output comes from a single
call. I added a different constant to each SQL query - the bash loop
iteration number:

for i in `seq 1 10000`; do
  echo SELECT $i ",v.* FROM pg_logical_slot_get_changes('test2_slot', NULL,
NULL) v;"
done | psql --quiet --tuples-only | cat --squeeze-blank > out2
cat out2 | wc -l

You can see all output comes with the same SQL (in this case, statement
419).
      419 | 1/76344D18 | 450880 | BEGIN 450880
      419 | 1/76344D18 | 450880 | table public.test: INSERT: id[integer]:1
v[character varying]:'3'
      419 | 1/76344DE0 | 450880 | table public.test: INSERT: id[integer]:2
v[character varying]:'6'
...
      419 | 1/76BD9348 | 450880 | table public.test: INSERT:
id[integer]:61439 v[character varying]:'184317'
      419 | 1/76BD93D8 | 450880 | table public.test: INSERT:
id[integer]:61440 v[character varying]:'184320'
      419 | 1/76344D18 | 450880 | table public.test: INSERT: id[integer]:1
v[character varying]:'3'
      419 | 1/76344DE0 | 450880 | table public.test: INSERT: id[integer]:2
v[character varying]:'6'
...

      419 | 1/7713BEB0 | 450880 | table public.test: INSERT:
id[integer]:99999 v[character varying]:'299997'
      419 | 1/7713BF40 | 450880 | table public.test: INSERT:
id[integer]:100000 v[character varying]:'300000'
      419 | 1/7713C028 | 450880 | COMMIT 450880

--

Ofir Manor

   Blog: http://ofirm.wordpress.com  <http://ofirm.wordpress.com>
LinkedIn: http://il.linkedin.com/in/ofirmanor

   Twitter: @ofirm   Mobile:   +972-54-7801286

pgsql-bugs by date:

Previous
From: nush2g8z@gmail.com
Date:
Subject: BUG #13730: RM0jVhDZdP
Next
From:
Date:
Subject: Re: BUG #13725: Logical Decoding - wrong results with large transactions and unfortunate timing