Skip to content

Commit d1d23f6

Browse files
committed
move warmup part to a separate file; fix CI
1 parent 0e31816 commit d1d23f6

File tree

3 files changed

+11
-28
lines changed

3 files changed

+11
-28
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ jobs:
3434
#for f in ~/postgres_dba/sql/*; do psql test -f "$f">/dev/null; done
3535
#echo "\set postgres_dba_wide false" > ~/.psqlrc
3636
#for f in ~/postgres_dba/sql/*; do psql test -f "$f">/dev/null; done
37-
diff -b test/regression/1_basic.out <(psql test -f ~/postgres_dba/sql/1_basic.sql | grep Role)
38-
diff -b test/regression/a1_alignment_padding.out <(psql test -f ~/postgres_dba/sql/a1_alignment_padding.sql | grep align)
37+
diff -b test/regression/1_basic.out <(psql test -f warmup.psql -f ~/postgres_dba/sql/1_basic.sql | grep Role)
38+
diff -b test/regression/a1_alignment_padding.out <(psql test -f warmup.psql -f ~/postgres_dba/sql/a1_alignment_padding.sql | grep align)

init/generate.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
# Generate start.psql based on the contents of "sql" directory
33
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44

5+
WARMUP="warmup.psql"
56
OUT="start.psql"
67

8+
echo "" > "$WARMUP"
9+
echo "" > "$OUT"
10+
711
cd "$DIR/.."
8-
cat > "$OUT" <<- VersCheck
12+
cat > "$WARMUP" <<- VersCheck
913
-- check if "\if" is supported (psql 10+)
1014
\if false
1115
\echo cannot work, you need psql version 10+ (Postgres server can be older)
@@ -33,6 +37,9 @@ select regexp_replace(version(), '^PostgreSQL (\d+\.\d+).*$', e'\\\\1')::numeric
3337
reset client_min_messages;
3438
\endif
3539
VersCheck
40+
41+
echo "\\i $WARMUP" >> "$OUT"
42+
3643
echo "\\echo '\\033[1;35mMenu:\\033[0m'" >> "$OUT"
3744
for f in ./sql/*.sql
3845
do

start.psql

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
1-
-- check if "\if" is supported (psql 10+)
2-
\if false
3-
\echo cannot work, you need psql version 10+ (Postgres server can be older)
4-
select 1/0;
5-
\endif
6-
7-
select regexp_replace(version(), '^PostgreSQL (\d+\.\d+).*$', e'\\1')::numeric >= 10 as postgres_dba_pgvers_10plus \gset
8-
\if :postgres_dba_pgvers_10plus
9-
\set postgres_dba_last_wal_receive_lsn pg_last_wal_receive_lsn
10-
\set postgres_dba_last_wal_replay_lsn pg_last_wal_replay_lsn
11-
\set postgres_dba_is_wal_replay_paused pg_is_wal_replay_paused
12-
\else
13-
\set postgres_dba_last_wal_receive_lsn pg_last_xlog_receive_location
14-
\set postgres_dba_last_wal_replay_lsn pg_last_xlog_replay_location
15-
\set postgres_dba_is_wal_replay_paused pg_is_xlog_replay_paused
16-
\endif
171

18-
-- TODO: improve work with custom GUCs for Postgres 9.5 and older
19-
select regexp_replace(version(), '^PostgreSQL (\d+\.\d+).*$', e'\\1')::numeric >= 9.6 as postgres_dba_pgvers_96plus \gset
20-
\if :postgres_dba_pgvers_96plus
21-
select coalesce(current_setting('postgres_dba.wide', true), 'off') = 'on' as postgres_dba_wide \gset
22-
\else
23-
set client_min_messages to 'fatal';
24-
select :postgres_dba_wide as postgres_dba_wide \gset
25-
reset client_min_messages;
26-
\endif
2+
\i warmup.psql
273
\echo '\033[1;35mMenu:\033[0m'
284
\echo ' 1 – Node Information: master/replica, lag, DB size, tmp files, etc'
295
\echo ' 2 – Table Size'

0 commit comments

Comments
 (0)