pgsql: Fix skip-empty-xacts with sequences in test_decoding

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix skip-empty-xacts with sequences in test_decoding
Date: 2022-02-12 23:00:03
Message-ID: E1nJ1N5-0000S4-UE@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix skip-empty-xacts with sequences in test_decoding

Regression tests need to use skip-empty-xacts = false, because there
might be accidental concurrent activity (like autovacuum), particularly
on slow machines. The tests added by 80901b3291 failed to do that in a
couple places, triggering occasional failures on buildfarm.

Fixing the tests however uncovered a bug in the code, because sequence
callbacks did not handle skip-empty-xacts properly. For trasactional
increments we need to check/update the xact_wrote_changes flag, and emit
the BEGIN if it's the first change in the transaction.

Reported-by: Andres Freund
Discussion: https://postgr.es/m/20220212220413.b25amklo7t4xb7ni%40alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b779d7d8fdae088d70da5ed9fcd8205035676df3

Modified Files
--------------
contrib/test_decoding/expected/sequence.out | 12 +++++-------
contrib/test_decoding/sql/sequence.sql | 8 ++++----
contrib/test_decoding/test_decoding.c | 22 ++++++++++++++++++++++
3 files changed, 31 insertions(+), 11 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2022-02-12 23:02:05 Re: pgsql: Add decoding of sequences to test_decoding
Previous Message Tom Lane 2022-02-12 22:16:03 Re: pgsql: Add suport for server-side LZ4 base backup compression.