Thread: pgsql: Test decoding of two-phase transactions during the build of a co

pgsql: Test decoding of two-phase transactions during the build of a co

From
Amit Kapila
Date:
Test decoding of two-phase transactions during the build of a consistent snapshot.

Commit a271a1b50e added the capability to allow decoding at prepare time.
This adds an isolation testcase to test that decoding happens at commit
time when the consistent snapshot state is reached after prepare but
before commit prepared.

Author: Ajin Cherian
Reviewed-by: Amit Kapila
Discussion:
https://postgr.es/m/02DA5F5E-CECE-4D9C-8B4B-418077E2C010@postgrespro.ru
https://postgr.es/m/CAMGcDxeqEpWj3fTXwqhSwBdXd2RS9jzwWscO-XbeCfso6ts3+Q@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5a3574d7b33480de51692962e6fd25d00c05718a

Modified Files
--------------
contrib/test_decoding/Makefile                     |  3 +-
.../test_decoding/expected/twophase_snapshot.out   | 41 +++++++++++++++++
contrib/test_decoding/specs/twophase_snapshot.spec | 53 ++++++++++++++++++++++
3 files changed, 96 insertions(+), 1 deletion(-)


Amit Kapila <akapila@postgresql.org> writes:
> Test decoding of two-phase transactions during the build of a consistent snapshot.

It seems this test case isn't 100% stable:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=chipmunk&dt=2021-01-08%2023%3A56%3A57

========================== output_iso/regression.diffs ================
diff -U3 /home/pgbfarm/buildroot/HEAD/pgsql.build/contrib/test_decoding/expected/twophase_snapshot.out
/home/pgbfarm/buildroot/HEAD/pgsql.build/contrib/test_decoding/output_iso/results/twophase_snapshot.out
--- /home/pgbfarm/buildroot/HEAD/pgsql.build/contrib/test_decoding/expected/twophase_snapshot.out    2021-01-07
02:49:30.231809843+0200 
+++ /home/pgbfarm/buildroot/HEAD/pgsql.build/contrib/test_decoding/output_iso/results/twophase_snapshot.out
2021-01-0904:01:26.730510078 +0200 
@@ -26,6 +26,8 @@
 data

 BEGIN
+COMMIT
+BEGIN
 table public.do_write: INSERT: id[integer]:2
 COMMIT
 step s2cp: COMMIT PREPARED 'test1';
@@ -33,6 +35,10 @@
 data

 BEGIN
+COMMIT
+BEGIN
+COMMIT
+BEGIN
 table public.do_write: INSERT: id[integer]:1
 PREPARE TRANSACTION 'test1'
 COMMIT PREPARED 'test1'

I think we've seen this extra-transactions symptom before,
but I don't recall the details at this late hour.

            regards, tom lane



Re: pgsql: Test decoding of two-phase transactions during the build of a co

From
Amit Kapila
Date:
On Sat, Jan 9, 2021 at 11:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Amit Kapila <akapila@postgresql.org> writes:
> > Test decoding of two-phase transactions during the build of a consistent snapshot.
>
> It seems this test case isn't 100% stable:
>
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=chipmunk&dt=2021-01-08%2023%3A56%3A57
>
> ========================== output_iso/regression.diffs ================
> diff -U3 /home/pgbfarm/buildroot/HEAD/pgsql.build/contrib/test_decoding/expected/twophase_snapshot.out
/home/pgbfarm/buildroot/HEAD/pgsql.build/contrib/test_decoding/output_iso/results/twophase_snapshot.out
> --- /home/pgbfarm/buildroot/HEAD/pgsql.build/contrib/test_decoding/expected/twophase_snapshot.out       2021-01-07
02:49:30.231809843+0200
 
> +++ /home/pgbfarm/buildroot/HEAD/pgsql.build/contrib/test_decoding/output_iso/results/twophase_snapshot.out
2021-01-0904:01:26.730510078 +0200
 
> @@ -26,6 +26,8 @@
>  data
>
>  BEGIN
> +COMMIT
> +BEGIN
>  table public.do_write: INSERT: id[integer]:2
>  COMMIT
>  step s2cp: COMMIT PREPARED 'test1';
> @@ -33,6 +35,10 @@
>  data
>
>  BEGIN
> +COMMIT
> +BEGIN
> +COMMIT
> +BEGIN
>  table public.do_write: INSERT: id[integer]:1
>  PREPARE TRANSACTION 'test1'
>  COMMIT PREPARED 'test1'
>
> I think we've seen this extra-transactions symptom before,
> but I don't recall the details at this late hour.
>

I'll look into it.

-- 
With Regards,
Amit Kapila.



Re: pgsql: Test decoding of two-phase transactions during the build of a co

From
Amit Kapila
Date:
On Sat, Jan 9, 2021 at 12:18 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Sat, Jan 9, 2021 at 11:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >
> >
> > I think we've seen this extra-transactions symptom before,
> > but I don't recall the details at this late hour.
> >
>
> I'll look into it.
>

I think I know whats going on here. I have responded to the thread on
pgsql-hackers [1].

[1] - https://www.postgresql.org/message-id/CAA4eK1J5onGc-sHLj3moS247rJK6KpvM_wAfiOHs6YFnHHs3%2Bw%40mail.gmail.com

-- 
With Regards,
Amit Kapila.



Amit Kapila <amit.kapila16@gmail.com> writes:
> I think I know whats going on here. I have responded to the thread on
> pgsql-hackers [1].

Ah, yeah, the autovacuum theory fits the facts: chipmunk is pretty
slow, and it's not failed 100% of the time.

            regards, tom lane



Re: pgsql: Test decoding of two-phase transactions during the build of a co

From
Amit Kapila
Date:
On Sat, Jan 9, 2021 at 1:09 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Amit Kapila <amit.kapila16@gmail.com> writes:
> > I think I know whats going on here. I have responded to the thread on
> > pgsql-hackers [1].
>
> Ah, yeah, the autovacuum theory fits the facts: chipmunk is pretty
> slow, and it's not failed 100% of the time.
>

I have pushed the fix. It is difficult to reproduce the exact case but
I have reproduced it with a parallel empty xact and pushed the fix.

-- 
With Regards,
Amit Kapila.