Giter VIP home page Giter VIP logo

slony1-engine's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

slony1-engine's Issues

Build failure with PG11: error: invalid type argument of '->'

Slony doesn't build against PG 11 beta1:

22:39:57 gcc -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wmissing-prototypes -Wmissing-declarations -I../.. -fpic -Wdate-time -D_FORTIFY_SOURCE=2  -I/usr/include/postgresql/11/server/ -I. -c -o slony1_funcs.o /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c: In function '_Slony_I_2_2_6_logTrigger':
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:567:25: error: invalid type argument of '->' (have 'FormData_pg_attribute {aka struct FormData_pg_attribute}')
22:39:57     if (tupdesc->attrs[i]->attisdropped)
22:39:57                          ^~
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:629:25: error: invalid type argument of '->' (have 'FormData_pg_attribute {aka struct FormData_pg_attribute}')
22:39:57     if (tupdesc->attrs[i]->attisdropped)
22:39:57                          ^~
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:724:25: error: invalid type argument of '->' (have 'FormData_pg_attribute {aka struct FormData_pg_attribute}')
22:39:57     if (tupdesc->attrs[i]->attisdropped)
22:39:57                          ^~
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:773:25: error: invalid type argument of '->' (have 'FormData_pg_attribute {aka struct FormData_pg_attribute}')
22:39:57     if (tupdesc->attrs[i]->attisdropped)
22:39:57                          ^~
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c: In function '_Slony_I_2_2_6_logApply':
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:1014:40: error: macro "AllocSetContextCreate" passed 5 arguments, but takes just 3
22:39:57                 ALLOCSET_DEFAULT_MAXSIZE);
22:39:57                                         ^
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:1009:24: error: 'AllocSetContextCreate' undeclared (first use in this function); did you mean 'SlabContextCreate'?
22:39:57     applyCacheContext = AllocSetContextCreate(
22:39:57                         ^~~~~~~~~~~~~~~~~~~~~
22:39:57                         SlabContextCreate
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:1009:24: note: each undeclared identifier is reported only once for each function it appears in
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:1192:37: warning: passing argument 3 of 'SPI_execp' from incompatible pointer type [-Wincompatible-pointer-types]
22:39:57       if (SPI_execp(plan, call_args, call_nulls, 0) < 0)
22:39:57                                      ^~~~~~~~~~
22:39:57 In file included from /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:26:0:
22:39:57 /usr/include/postgresql/11/server/executor/spi.h:92:12: note: expected 'const char *' but argument is of type '_Bool *'
22:39:57  extern int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls,
22:39:57             ^~~~~~~~~
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:1606:44: error: invalid type argument of '->' (have 'FormData_pg_attribute {aka struct FormData_pg_attribute}')
22:39:57        target_rel->rd_att->attrs[colnum - 1]->atttypmod;
22:39:57                                             ^~
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:1673:44: error: invalid type argument of '->' (have 'FormData_pg_attribute {aka struct FormData_pg_attribute}')
22:39:57        target_rel->rd_att->attrs[colnum - 1]->atttypmod;
22:39:57                                             ^~
22:39:57 /<<PKGBUILDDIR>>/src/backend/slony1_funcs.c:1770:44: error: invalid type argument of '->' (have 'FormData_pg_attribute {aka struct FormData_pg_attribute}')
22:39:57        target_rel->rd_att->attrs[colnum - 1]->atttypmod;
22:39:57                                             ^~
22:39:58 make[2]: *** [/<<PKGBUILDDIR>>/build-11/Makefile.port:18: slony1_funcs.o] Error 1

(Apologies if Github isn't the correct spot to report this, the Bugzilla on slony.info is down.)

Version check for flex broken

On Debian unstable, ./configure complains:

checking for flex... configure: WARNING:
*** The installed version of Flex, /usr/bin/flex, is too old to use with Slony-I.
*** Flex version 2.5.31 or later is required, but this is flex 2.6.4.
configure: WARNING:
*** The installed version of Flex, /usr/bin/lex, is too old to use with Slony-I.
*** Flex version 2.5.31 or later is required, but this is flex 2.6.4.
no
configure: WARNING:
*** Without Flex you will not be able to build Slony-I from CVS nor
*** change any of the scanner definition files.  You can obtain Flex from
*** a GNU mirror site.  (If you are using the official distribution of
*** Slony-I then you do not need to worry about this because the Flex
*** output is pre-generated.)

Flex output:

$ flex --version
flex 2.6.4

The version check in configure.ac is missing the case there X>2 or Y>5 for version "X.Y.Z":

          if echo "$pgac_flex_version" | sed ['s/[.a-z]/ /g'] | awk '{ if ([$]1 = 2 && [$]2 = 5 && [$]3 >= 31) exit 0; else exit 1;}'

PG 11 Fix

Seems that PG 11 is not supported fully.

PostgreSQL server info:
Version : 11.3
Release : 1PGDG.rhel7
From repo : pgdg11

Slony info:
Version : 2.2.7
Release : 2.rhel7
From repo : pgdg11

When trying to initialize master i've got a message:

slonik <<EOF

CLUSTER NAME = CLUSTER;
NODE 1 ADMIN CONNINFO = 'dbname=SL_MASTER user=slonik';
INIT CLUSTER ( ID = 1, COMMENT = 'Asterisk DB replication cluster' );

EOF

initialzing cluster
:4: Possible unsupported PostgreSQL version (110300) 11.3, defaulting to 8.4 support

Build fails with LTO

I tried to build with the following *FLAGS to optimize the build: -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing

Note the -Werror=* flags are used to help detect cases where the compiler tries to optimize by assuming UB cannot exist in the source code -- if it does exist, ordinarily the code would be miscompiled, and this says to make the miscompilation a fatal error.

I got this error:

x86_64-pc-linux-gnu-gcc -I/usr/include/postgresql-14/ -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -Wall -Wmissing-prototypes -Wmissing-declarations -fno-common -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -L/usr/lib64/postgresql-14/lib64/ -lpq  -Wl,-rpath,/usr/lib64/postgresql-14/lib64/ -o test-scanner test-scanner.c scanner.o
test-scanner.c: In function ‘main’:
test-scanner.c:18:9: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         fread(foo, sizeof(char), 65536, stdin);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test-scanner.c:6:17: error: type of ‘STMTS’ does not match original declaration [-Werror=lto-type-mismatch]
    6 | extern int      STMTS[1024];
      |                 ^
scanner.c:5:25: note: array types have different bounds
    5 | int                     STMTS[MAXSTATEMENTS];
      |                         ^
scanner.c:5:25: note: ‘STMTS’ was previously declared here
lto1: some warnings being treated as errors
lto-wrapper: fatal error: x86_64-pc-linux-gnu-gcc returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:19: test-scanner] Error 1

Downstream report: https://bugs.gentoo.org/855251
Full build log: build.log

slonik_build_env and pg_class.relhaspkey with PostgreSQL 11+

slonik_build_env uses pg_class.relhaspkey to find out if a table has a primary key.

SELECT pg_namespace.nspname || '.' || pg_class.relname,pg_class.relkind,pg_class.relhaspkey

This column was removed in pg 11 [1].

Could we modify the query to something like :

SELECT n.nspname || '.' || c.relname,c.relkind,
   EXISTS (SELECT 1 FROM pg_constraint WHERE contype='p' AND conrelid=c.oid) AS relhaspkey
FROM pg_namespace n ,pg_class c                                                    
WHERE c.reltype > 0                                                      
AND c.relnamespace = n.oid                         
AND (c.relkind = 'r' OR c.relkind = 'S')
AND n.nspname IN (" . join(',',@protected_schema) . ") 
AND n.oid = c.relnamespace;

[1] postgres/postgres@f66e8bf

Test 1 failing with PostgreSQL 12: ERROR: could not determine which collation to use for string comparison

Building and running tests against 12beta1, test 1 fails:

15:49:09 ############### test1 ###############
15:49:09 Creating new PostgreSQL cluster 12/regress ...
15:49:09 /usr/lib/postgresql/12/bin/initdb -D /var/lib/postgresql/12/regress --auth-local peer --auth-host md5 --username=postgres --pwfile=/tmp/pgpassword.JSQXnG --nosync
15:49:09 The files belonging to this database system will be owned by user "postgres".
15:49:09 This user must also own the server process.
15:49:09 
15:49:09 The database cluster will be initialized with locale "C.UTF-8".
15:49:09 The default database encoding has accordingly been set to "UTF8".
15:49:09 The default text search configuration will be set to "english".
15:49:09 
15:49:09 Data page checksums are disabled.
15:49:09 
15:49:09 fixing permissions on existing directory /var/lib/postgresql/12/regress ... ok
15:49:09 creating subdirectories ... ok
15:49:09 selecting dynamic shared memory implementation ... posix
15:49:09 selecting default max_connections ... 100
15:49:09 selecting default shared_buffers ... 128MB
15:49:09 selecting default timezone ... Etc/UTC
15:49:09 creating configuration files ... ok
15:49:09 running bootstrap script ... ok
15:49:10 performing post-bootstrap initialization ... ok
15:49:10 
15:49:10 Sync to disk skipped.
15:49:10 The data directory might become corrupt if the operating system crashes.
15:49:10 
15:49:10 Success. You can now start the database server using:
15:49:10 
15:49:10     pg_ctlcluster 12 regress start
15:49:10 
15:49:12 Ver Cluster Port Status Owner    Data directory                 Log file
15:49:12 12  regress 5432 online postgres /var/lib/postgresql/12/regress /var/log/postgresql/postgresql-12-regress.log
15:49:12 
15:49:12 test: test1
15:49:12 ----------------------------------------------------
15:49:12 
15:49:12   
15:49:12 test1 is a basic test that replication generally functions.  
15:49:12   
15:49:12 It creates three simple tables as one replication set, and replicates
15:49:12 them from one database to another.
15:49:12   
15:49:12 The tables are of the several interesting types:
15:49:12   
15:49:12 1.  table1 has a formal primary key
15:49:12 
15:49:12 2.  table2 lacks a formal primary key, but has a candidate primary key
15:49:12 
15:49:12 It tries replicating a third table, which has an invalid candidate
15:49:12 primary key (columns not defined NOT NULL), which should cause it to
15:49:12 be rejected.  That is done in a slonik TRY {} block.
15:49:12 
15:49:12 It also creates...
15:49:12 
15:49:12 5.  table4 which has columns of all sorts of vaguely esoteric types to
15:49:12 exercise that points, paths, bitmaps, mac addresses, and inet types
15:49:12 replicate properly.
15:49:12 
15:49:12 5.1  table5 has a composite primary key (on id1,id2,id3) where
15:49:12 the primary key attributes are strewn throughout the table.  This is
15:49:12 to make sure we have a case that exercises the logic that changed with
15:49:12 bug #18.
15:49:12 
15:49:12 6.  It does a test of the function generate_sync_event() to make sure
15:49:12 that it works as expected
15:49:12 
15:49:12 7.  It does a run of UPDATE FUNCTIONS against node 1.  This verifies
15:49:12 that there are at least no syntax errors in the stored function.
15:49:12 
15:49:12 8.  It uses a slon.conf file for node #2 to make sure that the logic
15:49:12 of the config file parser gets exercised.
15:49:12 
15:49:12 9.  It runs the cleanupEvent() function by hand
15:49:12 ----------------------------------------------------
15:49:12 Test by [email protected] to be summarized in /tmp/Slony-I-test-results.log
15:49:12 ./run_test.sh: 260: ./run_test.sh: /usr/lib/postgresql/12/bin/createlang: not found
15:49:12 ./run_test.sh: 294: ./run_test.sh: /usr/lib/postgresql/12/bin/createlang: not found
15:49:13 ./run_test.sh: ERROR: Slonik error see /tmp/slony-regress.7BFvxe/slonik.log for details
15:49:13 ./run_test.sh: 219: [: xSlonik: unexpected operator
15:49:13 ERROR:  schema "_Slony_Regress1" does not exist
15:49:13 LINE 1: select "_Slony_Regress1".getModuleversion() || '|' || "_Slon...
15:49:13                ^
15:49:13 
15:49:13 *** /var/log/postgresql/postgresql-12-regress.log (last 100 lines) ***
15:49:13 2019-06-03 13:49:10.484 UTC [16656] LOG:  starting PostgreSQL 12beta1 (Debian 12~beta1-1.pgdg+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-7) 8.3.0, 64-bit
15:49:13 2019-06-03 13:49:10.485 UTC [16656] LOG:  listening on IPv6 address "::1", port 5432
15:49:13 2019-06-03 13:49:10.485 UTC [16656] LOG:  listening on IPv4 address "127.0.0.1", port 5432
15:49:13 2019-06-03 13:49:10.485 UTC [16656] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
15:49:13 2019-06-03 13:49:10.496 UTC [16657] LOG:  database system was shut down at 2019-06-03 13:49:10 UTC
15:49:13 2019-06-03 13:49:10.499 UTC [16656] LOG:  database system is ready to accept connections
15:49:13 2019-06-03 13:49:13.160 UTC [16726] postgres@slonyregress1 ERROR:  could not determine which collation to use for string comparison
15:49:13 2019-06-03 13:49:13.160 UTC [16726] postgres@slonyregress1 HINT:  Use the COLLATE clause to set the collation explicitly.
15:49:13 2019-06-03 13:49:13.160 UTC [16726] postgres@slonyregress1 CONTEXT:  PL/pgSQL function "_Slony_Regress1".enablenode_int(integer) line 47 at assignment
15:49:13 	SQL statement "SELECT "_Slony_Regress1".enableNode_int (p_no_id)"
15:49:13 	PL/pgSQL function "_Slony_Regress1".enablenode(integer) line 30 at PERFORM
15:49:13 2019-06-03 13:49:13.160 UTC [16726] postgres@slonyregress1 STATEMENT:  lock table "_Slony_Regress1".sl_event_lock, "_Slony_Regress1".sl_config_lock;select "_Slony_Regress1".initializeLocalNode(1, 'Regress test node'); select "_Slony_Regress1".enableNode(1); 
15:49:13 2019-06-03 13:49:13.188 UTC [16737] postgres@slonyregress1 ERROR:  schema "_Slony_Regress1" does not exist at character 8
15:49:13 2019-06-03 13:49:13.188 UTC [16737] postgres@slonyregress1 STATEMENT:  select "_Slony_Regress1".getModuleversion() || '|' || "_Slony_Regress1".slonyVersionMajor() || '|' || "_Slony_Regress1".slonyVersionMinor() || '|' || "_Slony_Regress1".slonyVersionPatchlevel() || '|' || version() || '|';
15:49:13 Dropping cluster 12/regress ...
15:49:13 /tmp/slony-regress.7BFvxe/slonik.log:
15:49:13 <stdin>:2: PGRES_FATAL_ERROR lock table "_Slony_Regress1".sl_event_lock, "_Slony_Regress1".sl_config_lock;select "_Slony_Regress1".initializeLocalNode(1, 'Regress test node'); select "_Slony_Regress1".enableNode(1);  - ERROR:  could not determine which collation to use for string comparison
15:49:13 HINT:  Use the COLLATE clause to set the collation explicitly.
15:49:13 CONTEXT:  PL/pgSQL function "_Slony_Regress1".enablenode_int(integer) line 47 at assignment
15:49:13 SQL statement "SELECT "_Slony_Regress1".enableNode_int (p_no_id)"
15:49:13 PL/pgSQL function "_Slony_Regress1".enablenode(integer) line 30 at PERFORM
15:49:13 <stdin>:2: Possible unsupported PostgreSQL version (120000) 12.0, defaulting to 8.4 support

A new release would be appreciated so I can update the Debian package. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.