Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ jobs:
- name: Run the suite matrix on PG ${{ matrix.pg }}
run: |
set -euo pipefail
# PGC_SKIP_TIMING drops the three wall-clock suites: a shared runner
# PGC_SKIP_TIMING drops the four wall-clock suites: a shared runner
# cannot hold a ratio still, and a gate that reds for reasons unrelated
# to the change is worse than one that does not run. They stay in the
# local matrix, which is where those numbers mean anything.
Expand Down
4 changes: 3 additions & 1 deletion bench/build_citus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ echo "== building Citus $TAG against $("$PG_CONFIG" --version) ($PG_CONFIG)"

# Benchmark arms must run on a non-assert PostgreSQL. An assert build's numbers
# are invalid, so refuse one the way the rest of the bench tooling does.
if "$PG_CONFIG" --configure | grep -q -- '--enable-cassert'; then
# grep -c, not grep -q; see test/lib.sh's pgc_is_columnar_scan.
_cfg="$("$PG_CONFIG" --configure 2>/dev/null || true)"
if [ "$(grep -c -- '--enable-cassert' <<<"$_cfg" || true)" != 0 ]; then
echo "REFUSING: $PG_CONFIG is an assert build; benchmark numbers from it are invalid" >&2
exit 1
fi
Expand Down
4 changes: 3 additions & 1 deletion bench/build_timescaledb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ echo "== building TimescaleDB $VERSION against $("$PG_CONFIG" --version) ($PG_CO

# Benchmark arms must run on a non-assert PostgreSQL. An assert build's numbers
# are invalid, so refuse one the way the rest of the bench tooling does.
if "$PG_CONFIG" --configure | grep -q -- '--enable-cassert'; then
# grep -c, not grep -q; see test/lib.sh's pgc_is_columnar_scan.
_cfg="$("$PG_CONFIG" --configure 2>/dev/null || true)"
if [ "$(grep -c -- '--enable-cassert' <<<"$_cfg" || true)" != 0 ]; then
echo "REFUSING: $PG_CONFIG is an assert build; benchmark numbers from it are invalid" >&2
exit 1
fi
Expand Down
4 changes: 3 additions & 1 deletion bench/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ pg_present() { [ -x "$PREFIX_ROOT/$1/bin/pg_config" ]; }
# built with cassert would produce benchmark numbers that are quietly wrong, and
# nothing else on the box would notice.
pg_is_assert() {
"$PREFIX_ROOT/$1/bin/pg_config" --configure 2>/dev/null | grep -q -- '--enable-cassert'
# grep -c, not grep -q; see test/lib.sh's pgc_is_columnar_scan.
_cfg="$("$PREFIX_ROOT/$1/bin/pg_config" --configure 2>/dev/null || true)"
[ "$(grep -c -- '--enable-cassert' <<<"$_cfg" || true)" != 0 ]
}

check_pg() {
Expand Down
9 changes: 6 additions & 3 deletions test/arrow_import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,12 @@ idx_count() { # force an index scan
SELECT count(*) FROM ix_tgt WHERE id BETWEEN 100 AND 199;" | tail -1
}
idx_plan_is_index_scan() {
q "$IDX_SETUP
EXPLAIN (COSTS OFF) SELECT count(*) FROM ix_tgt WHERE id BETWEEN 100 AND 199;" \
| grep -qi 'Index.*Scan' && echo yes || echo no
# grep -c on a captured value, not a pipe into grep -q; see lib.sh's
# pgc_is_columnar_scan for the mechanism and the measurement.
local _plan
_plan="$(q "$IDX_SETUP
EXPLAIN (COSTS OFF) SELECT count(*) FROM ix_tgt WHERE id BETWEEN 100 AND 199;")"
[ "$(grep -ci 'Index.*Scan' <<<"$_plan" || true)" != 0 ] && echo yes || echo no
}
seq_count() { # force a sequential scan
q "SET enable_indexscan = off; SET enable_bitmapscan = off;
Expand Down
6 changes: 5 additions & 1 deletion test/concurrency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ LOGFILE="$WORKDIR/server.log"
# postmaster.
port_is_free() { # port -> 0 if nothing is listening on it
if command -v ss >/dev/null 2>&1; then
! ss -Htln "sport = :$1" 2>/dev/null | grep -q ":$1"
# grep -c on a captured value, not a pipe into grep -q. A spurious
# EPIPE here answers "nothing is listening" for a port that IS taken,
# and the suite then starts a cluster on an occupied port.
_pif="$(ss -Htln "sport = :$1" 2>/dev/null || true)"
[ "$(grep -c ":$1" <<<"$_pif" || true)" = 0 ]
else
# fall back to a connect probe: a refused connection means free
! (exec 3<>"/dev/tcp/127.0.0.1/$1") 2>/dev/null
Expand Down
9 changes: 6 additions & 3 deletions test/entry_point_privilege.sh
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,12 @@ as_ep() { # as_ep <sql> -> the SQLSTATE, or the literal noerror
local out
out="$(env PATH="$PGC_BINDIR:$PATH" psql -h 127.0.0.1 -p "$PGC_PORT" -U t_ep -d "$PGC_DB" \
-At -v VERBOSITY=sqlstate -v ON_ERROR_STOP=0 -c "$1" 2>&1)"
printf '%s\n' "$out" | sed -n 's/^.*ERROR:[[:space:]]*\([0-9A-Z]\{5\}\).*$/\1/p' | head -1 \
| grep -q . && printf '%s\n' "$out" | sed -n 's/^.*ERROR:[[:space:]]*\([0-9A-Z]\{5\}\).*$/\1/p' | head -1 \
|| echo noerror
# Extract once into a variable rather than twice through a pipeline whose
# STATUS is the answer: `... | grep -q .` reports "no sqlstate" whenever the
# writer takes EPIPE, and this function's answer is a SQLSTATE.
local _sqlstate
_sqlstate="$(sed -n 's/^.*ERROR:[[:space:]]*\([0-9A-Z]\{5\}\).*$/\1/p' <<<"$out" | head -1)"
if [ -n "$_sqlstate" ]; then printf '%s\n' "$_sqlstate"; else echo noerror; fi
}

# The premise that makes every SQLSTATE arm below mean anything: this role can
Expand Down
23 changes: 17 additions & 6 deletions test/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1249,9 +1249,17 @@ check_ratio_needs_quiet_machine() { # <name> <a> <b> <bound>
# EXPLAIN without ANALYZE is enough: the line comes from the plan rather than the
# run, so the assertion costs a plan and does not execute the query.
pgc_is_columnar_scan() { # query -> yes|no
env PATH="$PGC_BINDIR:$PATH" psql -h 127.0.0.1 -p "$PGC_PORT" -U postgres \
-d "$PGC_DB" -At -c "EXPLAIN (COSTS OFF) $1" 2>/dev/null \
| grep -q 'Columnar Projected Columns' && echo yes || echo no
# grep -c, NOT grep -q. grep -q exits the moment it matches, psql is still
# writing, and under a suite's `set -o pipefail` the pipeline reports failure
# though the pattern WAS present -- so this helper answers "no" for a plan that
# contains the line. Latent rather than live at EXPLAIN size (0 wrong in 200
# trials at 1.9KB) but with no floor in the mechanism: measured 1/200 wrong at
# 8.9KB and 40/40 at 289KB, on a loaded machine. grep -c reads to EOF.
local _plan
_plan="$(env PATH="$PGC_BINDIR:$PATH" psql -h 127.0.0.1 -p "$PGC_PORT" -U postgres \
-d "$PGC_DB" -At -c "EXPLAIN (COSTS OFF) $1" 2>/dev/null)"
[ "$(grep -c 'Columnar Projected Columns' <<<"$_plan" || true)" != 0 ] \
&& echo yes || echo no
}

# Does this query's plan drive the per-row fetch path?
Expand All @@ -1278,9 +1286,12 @@ pgc_is_columnar_scan() { # query -> yes|no
# report "no" for a query that does exercise the cache. Measured: an UPDATE over
# 2,000 rows made 20,366 fetch_row calls under a Custom Scan plan (#797).
pgc_uses_row_fetch() { # setup query -> yes|no
env PATH="$PGC_BINDIR:$PATH" psql -h 127.0.0.1 -p "$PGC_PORT" -U postgres \
-d "$PGC_DB" -At -c "$1" -c "EXPLAIN (COSTS OFF) $2" 2>/dev/null \
| grep -q 'Index Scan using' && echo yes || echo no
# grep -c, not grep -q; see pgc_is_columnar_scan above for the measurement.
local _plan
_plan="$(env PATH="$PGC_BINDIR:$PATH" psql -h 127.0.0.1 -p "$PGC_PORT" -U postgres \
-d "$PGC_DB" -At -c "$1" -c "EXPLAIN (COSTS OFF) $2" 2>/dev/null)"
[ "$(grep -c 'Index Scan using' <<<"$_plan" || true)" != 0 ] \
&& echo yes || echo no
}

# Order-independent set hash of an arbitrary query's result. The row is cast to
Expand Down
10 changes: 7 additions & 3 deletions test/native_groupagg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ groupvec_off() { psql_run "ALTER DATABASE $PGC_DB SET pgcolumnar.enable_group_ve
# "Columnar Vectorized Group Keys"; no other node emits it, so a positive grep is
# proof of the node rather than an absence test that a fallback would also pass.
pgc_is_groupvec() { # query -> yes|no
env PATH="$PGC_BINDIR:$PATH" psql -h 127.0.0.1 -p "$PGC_PORT" -U postgres \
-d "$PGC_DB" -At -c "EXPLAIN (COSTS OFF) $1" 2>/dev/null \
| grep -q 'Columnar Vectorized Group Keys' && echo yes || echo no
# grep -c on a captured plan, not a pipe into grep -q; see lib.sh's
# pgc_is_columnar_scan for the mechanism and the measurement.
local _plan
_plan="$(env PATH="$PGC_BINDIR:$PATH" psql -h 127.0.0.1 -p "$PGC_PORT" -U postgres \
-d "$PGC_DB" -At -c "EXPLAIN (COSTS OFF) $1" 2>/dev/null)"
[ "$(grep -c 'Columnar Vectorized Group Keys' <<<"$_plan" || true)" != 0 ] \
&& echo yes || echo no
}

# toggle_diff LABEL "QUERY on t_col": same query, path off vs on, byte-exact.
Expand Down
6 changes: 5 additions & 1 deletion test/native_groupagg_batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ q1() { q "$1" | tail -1; }
# Keys" is emitted by no other node, so a positive grep proves the node rather
# than an absence test a fallback would also satisfy.
is_groupvec() { # query -> yes|no
q "EXPLAIN (COSTS OFF) $1" | grep -q 'Columnar Vectorized Group Keys' \
# grep -c on a captured value, not a pipe into grep -q; see lib.sh's
# pgc_is_columnar_scan for the mechanism and the measurement.
local _plan
_plan="$(q "EXPLAIN (COSTS OFF) $1")"
[ "$(grep -c 'Columnar Vectorized Group Keys' <<<"$_plan" || true)" != 0 ] \
&& echo yes || echo no
}

Expand Down
16 changes: 12 additions & 4 deletions test/native_vecskip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ explain_of() {
-d "$PGC_DB" -At -c "EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, SUMMARY OFF) $1" 2>/dev/null
}
is_scalar_scan() {
explain_of "$1" | grep -q 'Columnar Projected Columns' && echo yes || echo no
# grep -c, not grep -q: see lib.sh's pgc_is_columnar_scan for why and for the
# measurement. This file holds the worst instance of the shape -- the arm at
# "premise: and it is not the scalar scan" WANTS "no", so a spurious EPIPE
# answer makes that premise pass for the wrong reason. Vacuity, not a red.
[ "$(explain_of "$1" | grep -c 'Columnar Projected Columns' || true)" != 0 ] \
&& echo yes || echo no
}

# The node, before any counter is read out of it.
Expand Down Expand Up @@ -99,13 +104,16 @@ explain_agg() {
# this query falls back to the scalar scan -- which DOES print the line, so the
# check below would pass while testing nothing at all.
check "premise: the aggregate arm really is a vectorized aggregate" \
"$(explain_agg "$AGGQ" | grep -q 'Columnar Vectorized Aggregates' && echo yes || echo no)" \
"$([ "$(explain_agg "$AGGQ" | grep -c 'Columnar Vectorized Aggregates' || true)" != 0 ] \
&& echo yes || echo no)" \
"yes"
check "premise: and it is not the scalar scan" \
"$(explain_agg "$AGGQ" | grep -q 'Columnar Projected Columns' && echo yes || echo no)" "no"
"$([ "$(explain_agg "$AGGQ" | grep -c 'Columnar Projected Columns' || true)" != 0 ] \
&& echo yes || echo no)" "no"

check "the vectorized aggregate reports Columnar Vectors Skipped" \
"$(explain_agg "$AGGQ" | grep -q 'Columnar Vectors Skipped' && echo yes || echo no)" \
"$([ "$(explain_agg "$AGGQ" | grep -c 'Columnar Vectors Skipped' || true)" != 0 ] \
&& echo yes || echo no)" \
"yes"

# Boundary and cross-vector ranges still return exactly the heap rows.
Expand Down
4 changes: 3 additions & 1 deletion test/objstore_s3_read.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ pg_restart_env "AWS_ENDPOINT_URL='https://127.0.0.1:$S3_PORT'" \
"AWS_ACCESS_KEY_ID='$AKID'" "AWS_SECRET_ACCESS_KEY='$SECRET'" \
"AWS_REGION='$REGION'"
MOD_SO="$(pgc_pg "$PGC_BINDIR/pg_config --pkglibdir" | tail -1)/pgcolumnar_objstore.so"
if pgc_pg "ldd '$MOD_SO'" 2>/dev/null | grep -q libssl; then
# grep -c, not grep -q; see lib.sh's pgc_is_columnar_scan.
_ldd_out="$(pgc_pg "ldd '$MOD_SO'" 2>/dev/null || true)"
if [ "$(grep -c libssl <<<"$_ldd_out" || true)" != 0 ]; then
HTTPS_WANT="08006"
else
HTTPS_WANT="0A000"
Expand Down
9 changes: 6 additions & 3 deletions test/parquet_import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,12 @@ idx_count() { # force an index scan
SELECT count(*) FROM ix_tgt WHERE id BETWEEN 100 AND 199;" | tail -1
}
idx_plan_is_index_scan() {
q "$IDX_SETUP
EXPLAIN (COSTS OFF) SELECT count(*) FROM ix_tgt WHERE id BETWEEN 100 AND 199;" \
| grep -qi 'Index.*Scan' && echo yes || echo no
# grep -c on a captured value, not a pipe into grep -q; see lib.sh's
# pgc_is_columnar_scan for the mechanism and the measurement.
local _plan
_plan="$(q "$IDX_SETUP
EXPLAIN (COSTS OFF) SELECT count(*) FROM ix_tgt WHERE id BETWEEN 100 AND 199;")"
[ "$(grep -ci 'Index.*Scan' <<<"$_plan" || true)" != 0 ] && echo yes || echo no
}
seq_count() { # force a sequential scan
q "SET enable_indexscan = off; SET enable_bitmapscan = off;
Expand Down
Loading
Loading