From e3b8514b476cbc303da258b8be703f135da3b0dd Mon Sep 17 00:00:00 2001 From: Andrey Lepikhov Date: Thu, 20 Oct 2022 09:36:21 +0500 Subject: [PATCH 1/6] Add schedule for regression tests. The real reason is to successfully pass the statement_timeout test in very slow environments. --- Makefile | 22 ++-------------------- regress_schedule | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 20 deletions(-) create mode 100644 regress_schedule diff --git a/Makefile b/Makefile index 3cdf520d..229b2591 100755 --- a/Makefile +++ b/Makefile @@ -11,26 +11,8 @@ OBJS = $(WIN32RES) \ TAP_TESTS = 1 -REGRESS = aqo_disabled \ - aqo_controlled \ - aqo_intelligent \ - aqo_forced \ - aqo_learn \ - schema \ - aqo_fdw \ - aqo_CVE-2020-14350 \ - gucs \ - forced_stat_collection \ - unsupported \ - clean_aqo_data \ - parallel_workers \ - plancache \ - statement_timeout \ - temp_tables \ - top_queries \ - relocatable\ - look_a_like \ - feature_subspace +REGRESS = feature_subspace +REGRESS_OPTS = --schedule=$(top_srcdir)/$(subdir)/regress_schedule fdw_srcdir = $(top_srcdir)/contrib/postgres_fdw stat_srcdir = $(top_srcdir)/contrib/pg_stat_statements diff --git a/regress_schedule b/regress_schedule new file mode 100644 index 00000000..ca4c45f9 --- /dev/null +++ b/regress_schedule @@ -0,0 +1,21 @@ +test: aqo_disabled +test: aqo_controlled +test: aqo_intelligent +test: aqo_forced +test: aqo_learn +test: schema +test: aqo_fdw +test: aqo_CVE-2020-14350 +test: gucs +test: forced_stat_collection +test: unsupported +test: clean_aqo_data +test: parallel_workers +test: plancache +# Performance-dependent test. Can be ignored if executes in containers or on slow machines +ignore: statement_timeout +test: statement_timeout +test: temp_tables +test: top_queries +test: relocatable +test: look_a_like From 78c6bdd12f6529bcf1594f66a72b4df01ea9af97 Mon Sep 17 00:00:00 2001 From: Marina Polyakova Date: Thu, 20 Oct 2022 08:57:21 +0300 Subject: [PATCH 2/6] Fix use of regress_schedule with USE_PGXS --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 229b2591..9e51b997 100755 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ OBJS = $(WIN32RES) \ TAP_TESTS = 1 REGRESS = feature_subspace -REGRESS_OPTS = --schedule=$(top_srcdir)/$(subdir)/regress_schedule +REGRESS_OPTS = --schedule=$(srcdir)/regress_schedule fdw_srcdir = $(top_srcdir)/contrib/postgres_fdw stat_srcdir = $(top_srcdir)/contrib/pg_stat_statements From 0d8662ef79c9adc5a06a213a18e1bb13fb61231d Mon Sep 17 00:00:00 2001 From: Marina Polyakova Date: Thu, 20 Oct 2022 09:52:05 +0300 Subject: [PATCH 3/6] Use an empty dummy test to define the variable REGRESS And therefore to run all regression tests. regress_schedule contains the full list of real tests. So all changes for real tests will be made in a general way in regress_schedule. --- Makefile | 4 +++- expected/aqo_dummy_test.out | 0 regress_schedule | 1 + sql/aqo_dummy_test.sql | 0 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 expected/aqo_dummy_test.out create mode 100644 sql/aqo_dummy_test.sql diff --git a/Makefile b/Makefile index 9e51b997..b07d7f86 100755 --- a/Makefile +++ b/Makefile @@ -11,7 +11,9 @@ OBJS = $(WIN32RES) \ TAP_TESTS = 1 -REGRESS = feature_subspace +# Use an empty dummy test to define the variable REGRESS and therefore run all +# regression tests. regress_schedule contains the full list of real tests. +REGRESS = aqo_dummy_test REGRESS_OPTS = --schedule=$(srcdir)/regress_schedule fdw_srcdir = $(top_srcdir)/contrib/postgres_fdw diff --git a/expected/aqo_dummy_test.out b/expected/aqo_dummy_test.out new file mode 100644 index 00000000..e69de29b diff --git a/regress_schedule b/regress_schedule index ca4c45f9..418e14ec 100644 --- a/regress_schedule +++ b/regress_schedule @@ -19,3 +19,4 @@ test: temp_tables test: top_queries test: relocatable test: look_a_like +test: feature_subspace diff --git a/sql/aqo_dummy_test.sql b/sql/aqo_dummy_test.sql new file mode 100644 index 00000000..e69de29b From 070d10a707966fb838671cba6e8e621f7678ca64 Mon Sep 17 00:00:00 2001 From: Andrey Lepikhov Date: Thu, 20 Oct 2022 11:35:21 +0500 Subject: [PATCH 4/6] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 7 ++++--- t/001_pgbench.pl | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index b4b3197e..519f2153 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -7,7 +7,7 @@ on: branches: [ master ] env: - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} jobs: build: @@ -17,19 +17,20 @@ jobs: steps: - name: pg run: | + sudo apt install libipc-run-perl echo "Deploying to production server on branch" $BRANCH_NAME git config --global user.email "ci@postgrespro.ru" git config --global user.name "CI PgPro admin" git clone https://github.com/postgres/postgres.git pg cd pg git checkout master - ./configure --prefix=`pwd`/tmp_install CFLAGS="-O3" + ./configure --prefix=`pwd`/tmp_install CFLAGS="-O3" --enable-tap-tests --enable-cassert COPT=-Werror git clone https://github.com/postgrespro/aqo.git contrib/aqo git -C contrib/aqo checkout $BRANCH_NAME patch -p1 --no-backup-if-mismatch < contrib/aqo/aqo_master.patch make -j4 > /dev/null && make -j4 -C contrib > /dev/null env CLIENTS=50 THREADS=50 make -C contrib/aqo check - + echo "Use AQO with debug code included" git clean -fdx git -C contrib/aqo clean -fdx diff --git a/t/001_pgbench.pl b/t/001_pgbench.pl index 893f58db..122fd911 100644 --- a/t/001_pgbench.pl +++ b/t/001_pgbench.pl @@ -336,7 +336,7 @@ "SELECT sum(executions_with_aqo) FROM test.aqo_query_stat"); # 25 trans * 10 clients * 4 query classes = 1000 + unique SELECT to pgbench_branches -is($res, 1001, 'Each query should be logged in LEARN mode'); +is($res, $ENV{CLIENTS}*100+1, 'Each query should be logged in LEARN mode'); $res = $node->safe_psql('postgres', "SELECT sum(executions_without_aqo) FROM test.aqo_query_stat"); is($res, 0, 'AQO has learned on the queries - 2'); From b020b16aaccba2df1d27ccfdc124c4f62b23c976 Mon Sep 17 00:00:00 2001 From: Marina Polyakova Date: Thu, 20 Oct 2022 11:15:57 +0300 Subject: [PATCH 5/6] Fix using of COPT=-Werror It is only used during build, not during configure. --- .github/workflows/c-cpp.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 519f2153..2281a25d 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -21,10 +21,11 @@ jobs: echo "Deploying to production server on branch" $BRANCH_NAME git config --global user.email "ci@postgrespro.ru" git config --global user.name "CI PgPro admin" + export COPT=-Werror git clone https://github.com/postgres/postgres.git pg cd pg git checkout master - ./configure --prefix=`pwd`/tmp_install CFLAGS="-O3" --enable-tap-tests --enable-cassert COPT=-Werror + ./configure --prefix=`pwd`/tmp_install CFLAGS="-O3" --enable-tap-tests --enable-cassert git clone https://github.com/postgrespro/aqo.git contrib/aqo git -C contrib/aqo checkout $BRANCH_NAME patch -p1 --no-backup-if-mismatch < contrib/aqo/aqo_master.patch From 7ea2fa861ddc54f1ebb067e138188643f5e195cf Mon Sep 17 00:00:00 2001 From: Marina Polyakova Date: Thu, 20 Oct 2022 10:59:05 +0300 Subject: [PATCH 6/6] Add not used function to check COPT=-Werror in CI --- auto_tuning.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auto_tuning.c b/auto_tuning.c index abb38a92..dfe95e67 100644 --- a/auto_tuning.c +++ b/auto_tuning.c @@ -33,6 +33,12 @@ static bool is_stable(double *elems, int nelems); static bool converged_cq(double *elems, int nelems); static bool is_in_infinite_loop_cq(double *elems, int nelems); +static bool +not_used_function(int parameter) +{ + return parameter % 2; +} + /* * Returns mean value of the array of doubles.