Skip to content

Commit 37dc965

Browse files
authored
Merge branch 'stable13' into s13-ci-whooks
2 parents 52c9bba + bd3585b commit 37dc965

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

.github/workflows/c-cpp.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
- name: "Prepare PG directory"
5454
run: |
5555
cd $PG_DIR
56+
5657
cp -r ../aqo contrib/aqo
5758
patch -p1 --no-backup-if-mismatch < contrib/aqo/$CORE_PATCH_NAME
5859
echo "COPT=-Werror" >> $GITHUB_ENV

.github/workflows/installchecks.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
3434
branch_name="REL_${vers_number}_STABLE"
3535
echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
36+
3637
- name: "Set master branch name, if needed"
3738
if: env.PG_MAJOR_VERSION == ''
3839
run: |
@@ -78,6 +79,7 @@ jobs:
7879
- name: "Compilation"
7980
run: |
8081
cd $PG_DIR
82+
8183
echo "COPT: $COPT"
8284
echo "CONFIGURE_OPTS: $CONFIGURE_OPTS"
8385
./configure $CONFIGURE_OPTS CFLAGS="-O2" > /dev/null
@@ -98,20 +100,23 @@ jobs:
98100
- name: installcheck_disabled
99101
run: |
100102
cd $PG_DIR
103+
101104
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'off'"
102105
psql -c "SELECT pg_reload_conf()"
103106
make installcheck-world
104107
105108
- name: installcheck_disabled_forced_stat
106109
run: |
107110
cd $PG_DIR
111+
108112
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
109113
psql -c "SELECT pg_reload_conf()"
110114
make installcheck-world
111115
112116
- name: installcheck_frozen
113117
run: |
114118
cd $PG_DIR
119+
115120
psql -c "ALTER SYSTEM SET aqo.mode = 'frozen'"
116121
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
117122
psql -c "SELECT pg_reload_conf()"
@@ -154,10 +159,10 @@ jobs:
154159
155160
# Save Artifacts
156161
- name: Archive artifacts
157-
if: ${{ failure() }}
162+
if: ${{ always() }}
158163
uses: actions/upload-artifact@v3
159164
with:
160-
name: ${{ env.AQO_VERSION }}-${{ env.CORE_BRANCH_NAME }}-${{ env.BRANCH_NAME }}-artifacts
165+
name: ${{ env.AQO_VERSION }}-${{ env.PG_BRANCH }}-${{ env.CORE_PATCH_NAME }}-artifacts
161166
path: |
162167
${{ env.PG_DIR }}/src/test/regress/regression.diffs
163168
${{ env.PG_DIR }}/logfile.log

expected/statement_timeout.out

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SET statement_timeout = 80; -- [0.1s]
3535
SELECT *, pg_sleep(0.1) FROM t;
3636
NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data.
3737
ERROR: canceling statement due to statement timeout
38+
RESET statement_timeout;
3839
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;'); -- haven't any partial data
3940
check_estimated_rows
4041
----------------------
@@ -46,6 +47,7 @@ SET statement_timeout = 350;
4647
SELECT *, pg_sleep(0.1) FROM t;
4748
NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data.
4849
ERROR: canceling statement due to statement timeout
50+
RESET statement_timeout;
4951
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
5052
check_estimated_rows
5153
----------------------
@@ -64,6 +66,7 @@ SELECT *, pg_sleep(0.1) FROM t;
6466
5 |
6567
(5 rows)
6668

69+
RESET statement_timeout;
6770
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
6871
check_estimated_rows
6972
----------------------
@@ -84,6 +87,7 @@ SET statement_timeout = 80;
8487
SELECT *, pg_sleep(0.1) FROM t; -- Not learned
8588
NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data.
8689
ERROR: canceling statement due to statement timeout
90+
RESET statement_timeout;
8791
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
8892
check_estimated_rows
8993
----------------------
@@ -94,6 +98,7 @@ SET statement_timeout = 350;
9498
SELECT *, pg_sleep(0.1) FROM t; -- Learn!
9599
NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data.
96100
ERROR: canceling statement due to statement timeout
101+
RESET statement_timeout;
97102
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
98103
check_estimated_rows
99104
----------------------
@@ -111,6 +116,7 @@ SELECT *, pg_sleep(0.1) FROM t; -- Get reliable data
111116
5 |
112117
(5 rows)
113118

119+
RESET statement_timeout;
114120
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
115121
check_estimated_rows
116122
----------------------
@@ -134,18 +140,19 @@ SELECT count(*) FROM aqo_data; -- Must be zero
134140
SELECT x, pg_sleep(0.1) FROM t WHERE x > 0;
135141
NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data.
136142
ERROR: canceling statement due to statement timeout
143+
RESET statement_timeout;
137144
SELECT count(*) FROM aqo_data; -- Must be one
138145
count
139146
-------
140147
1
141148
(1 row)
142149

150+
DROP TABLE t;
151+
DROP FUNCTION check_estimated_rows;
143152
SELECT true AS success FROM aqo_reset();
144153
success
145154
---------
146155
t
147156
(1 row)
148157

149-
DROP TABLE t;
150158
DROP EXTENSION aqo;
151-
DROP FUNCTION check_estimated_rows;

regress_schedule

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ test: plancache
1515
test: update_functions
1616
# Performance-dependent test. Can be ignored if executes in containers or on slow machines
1717
ignore: statement_timeout
18+
test: statement_timeout
1819
test: temp_tables
1920
test: top_queries
2021
test: relocatable

sql/statement_timeout.sql

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,22 @@ SET aqo.learn_statement_timeout = 'on';
3232

3333
SET statement_timeout = 80; -- [0.1s]
3434
SELECT *, pg_sleep(0.1) FROM t;
35+
36+
RESET statement_timeout;
3537
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;'); -- haven't any partial data
3638

3739
-- Don't learn because running node has smaller cardinality than an optimizer prediction
3840
SET statement_timeout = 350;
3941
SELECT *, pg_sleep(0.1) FROM t;
42+
43+
RESET statement_timeout;
4044
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
4145

4246
-- We have a real learning data.
4347
SET statement_timeout = 800;
4448
SELECT *, pg_sleep(0.1) FROM t;
49+
50+
RESET statement_timeout;
4551
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
4652

4753
-- Force to make an underestimated prediction
@@ -52,24 +58,33 @@ SELECT true AS success FROM aqo_reset();
5258

5359
SET statement_timeout = 80;
5460
SELECT *, pg_sleep(0.1) FROM t; -- Not learned
61+
62+
RESET statement_timeout;
5563
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
5664

5765
SET statement_timeout = 350;
5866
SELECT *, pg_sleep(0.1) FROM t; -- Learn!
67+
68+
RESET statement_timeout;
5969
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
6070

6171
SET statement_timeout = 550;
6272
SELECT *, pg_sleep(0.1) FROM t; -- Get reliable data
73+
74+
RESET statement_timeout;
6375
SELECT check_estimated_rows('SELECT *, pg_sleep(0.1) FROM t;');
6476

6577
-- Interrupted query should immediately appear in aqo_data
6678
SELECT true AS success FROM aqo_reset();
6779
SET statement_timeout = 500;
6880
SELECT count(*) FROM aqo_data; -- Must be zero
6981
SELECT x, pg_sleep(0.1) FROM t WHERE x > 0;
82+
83+
RESET statement_timeout;
7084
SELECT count(*) FROM aqo_data; -- Must be one
7185

72-
SELECT true AS success FROM aqo_reset();
7386
DROP TABLE t;
74-
DROP EXTENSION aqo;
7587
DROP FUNCTION check_estimated_rows;
88+
89+
SELECT true AS success FROM aqo_reset();
90+
DROP EXTENSION aqo;

0 commit comments

Comments
 (0)