postgres-decoderbufs icon indicating copy to clipboard operation
postgres-decoderbufs copied to clipboard

Add PGXS "make installcheck" support

Open df7cb opened this issue 3 years ago • 11 comments

This enables running PG's standard testsuite with a PG server configured for decoderbufs.

Example on Debian:

$ sudo apt install postgresql-14-decoderbufs
$ pg_virtualenv -o shared_preload_libraries=decoderbufs -o wal_level=logical
Creating new PostgreSQL cluster 14/regress ...
$ make installcheck
/usr/lib/postgresql/14/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/lib/postgresql/14/bin'    --dbname=contrib_regression decoderbufs
(using postmaster on localhost, port 5433)
============== dropping database "contrib_regression" ==============
HINWEIS:  Datenbank »contrib_regression« existiert nicht, wird übersprungen
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries        ==============
test decoderbufs                  ... ok           30 ms

=====================
 All 1 tests passed.
=====================

$ exit
Dropping cluster 14/regress ...

Tested on apt.postgresql.org with PG 10+ on amd64/arm64/i386/ppc64el.

https://pgdgbuild.dus.dg-i.net/view/Testsuite/job/postgres-decoderbufs-autopkgtest/

df7cb avatar Jan 10 '22 14:01 df7cb

Is anyone listening here? PG 17 will be released on Thursday, and decoderbufs isn't ready yet:

make[1]: Verzeichnis „/home/myon/projects/postgresql/postgres-decoderbufs/postgres-decoderbufs“ wird betreten
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -Werror=implicit-function-declaration -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fno-omit-frame-pointer -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/home/myon/projects/postgresql/postgres-decoderbufs/postgres-decoderbufs=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fPIC -fvisibility=hidden -std=c11  -I/usr/local/include  -I. -I./ -I/usr/include/postgresql/17/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2   -c -o src/decoderbufs.o src/decoderbufs.c
src/decoderbufs.c: In function ‘pg_decode_change’:
src/decoderbufs.c:625:53: error: ‘HeapTupleData’ has no member named ‘tuple’
  625 |                            &change->data.tp.newtuple->tuple, tupdesc);
      |                                                     ^~
src/decoderbufs.c:631:53: error: ‘HeapTupleData’ has no member named ‘tuple’
  631 |                            &change->data.tp.newtuple->tuple, tupdesc);
      |                                                     ^~
src/decoderbufs.c:646:55: error: ‘HeapTupleData’ has no member named ‘tuple’
  646 |                              &change->data.tp.oldtuple->tuple, tupdesc);
      |                                                       ^~
src/decoderbufs.c:656:55: error: ‘HeapTupleData’ has no member named ‘tuple’
  656 |                              &change->data.tp.newtuple->tuple, tupdesc);
      |                                                       ^~
src/decoderbufs.c:662:55: error: ‘HeapTupleData’ has no member named ‘tuple’
  662 |                              &change->data.tp.newtuple->tuple, tupdesc);
      |                                                       ^~
src/decoderbufs.c:678:53: error: ‘HeapTupleData’ has no member named ‘tuple’
  678 |                            &change->data.tp.oldtuple->tuple, tupdesc);
      |                                                     ^~
make[1]: *** [<eingebaut>: src/decoderbufs.o] Fehler 1

df7cb avatar Sep 24 '24 19:09 df7cb

Paging @jpechane :)

Most attention is on pgoutput these days, though, and it's the recommended decoding plug-in when available.

gunnarmorling avatar Sep 24 '24 20:09 gunnarmorling

Is that the pgoutput.so shipped with contrib? That's available on every Debian install. If that is strictly better, we could also drop the Debian package of decoderbufs and go with pgoutput instead.

df7cb avatar Sep 24 '24 20:09 df7cb

@df7cb Hi, we definitely want to keep protobuf for some time. We'll make pgoutput default option sometimes during 3.x timeline and deprecate protbuf later depending on community feedback.

jpechane avatar Sep 26 '24 08:09 jpechane

@df7cb Please see https://issues.redhat.com/browse/DBZ-8275

jpechane avatar Sep 26 '24 09:09 jpechane

3.0.1 doesn't compile here against PG17:

src/decoderbufs.c: In function ‘pg_decode_change’:
src/decoderbufs.c:631:28: error: passing argument 3 of ‘tuple_to_tuple_msg’ from incompatible pointer type [-Wincompatible-pointer-types]
  631 |                            &change->data.tp.newtuple TUPLE_ACCESS, tupdesc);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                            |
      |                            HeapTupleData **
src/decoderbufs.c:396:61: note: expected ‘HeapTuple’ {aka ‘HeapTupleData *’} but argument is of type ‘HeapTupleData **’
  396 |                                Relation relation, HeapTuple tuple,
      |                                                   ~~~~~~~~~~^~~~~

Also, could you perhaps enable GitHub issues on this repository? It's the only one I know that has only pull requests enabled, but not issues.

df7cb avatar Oct 27 '24 11:10 df7cb

@df7cb We do use Jira exclusively. It would be a bit of complications for us to track issue accross mutliple issue trackers.

jpechane avatar Oct 28 '24 08:10 jpechane

@df7cb PR #32 should address the compilation error with PG17. I've tested this change on trixie with both PG16 and PG17 using the installcheck test that you've added in this PR.

bradfordboyle avatar Nov 13 '24 08:11 bradfordboyle

@df7cb Hi, I am sorry I am necormancing this PR. I'd like to get it in but if possible also add a github workflow that would run on each PR and push to main. The workflow would build the plguin and run the installcheck on it. Would it be possible?

jpechane avatar Nov 13 '24 09:11 jpechane

@df7cb PR #32 should address the compilation error with PG17. I've tested this change on trixie with both PG16 and PG17 using the installcheck test that you've added in this PR.

Thanks, the Debian packages are happy now.

df7cb avatar Nov 13 '24 10:11 df7cb

@df7cb Hi, I am sorry I am necormancing this PR. I'd like to get it in but if possible also add a github workflow that would run on each PR and push to main. The workflow would build the plguin and run the installcheck on it. Would it be possible?

There's various extensions doing that, for example https://github.com/df7cb/postgresql-unit/blob/master/.github/workflows/regression.yml

df7cb avatar Nov 13 '24 10:11 df7cb