Skip to content

Commit 4d85b7b

Browse files
committed
3
1 parent b3205bc commit 4d85b7b

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

.github/workflows/spockbench.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
- name: Build docker container
5151
run: |
5252
cd ${GITHUB_WORKSPACE}/
53+
# Build docker image once for specific version, needed for this test
5354
docker build \
5455
--build-arg PGVER=${{ matrix.pgver }} \
5556
-t spock -f tests/docker/Dockerfile-step-1.el9 .
@@ -58,16 +59,14 @@ jobs:
5859
run: |
5960
cd ${GITHUB_WORKSPACE}/tests/docker/
6061
echo PG_VER=${{ matrix.pgver }} >> pgedge.env
61-
env BASE_IMAGE=ghcr.io/pgedge/base-test-image:latest \
62-
docker compose up --build --wait -d
62+
docker compose up --wait -d
6363
timeout-minutes: 20
6464

6565
- name: Run tests on all nodes
6666
run: |
6767
cd ${GITHUB_WORKSPACE}/tests/docker/
6868
6969
# Launch tests in background with per-node timeout and capture PIDs
70-
# Each node gets 5 minutes max (more than RUNTIME=60s + overhead)
7170
docker compose exec -T pgedge-n1 bash -c "~/tests/run-tests.sh" &
7271
PID1=$!
7372
docker compose exec -T pgedge-n2 bash -c "~/tests/run-tests.sh" &
@@ -98,10 +97,11 @@ jobs:
9897
cd ${GITHUB_WORKSPACE}/tests/docker/
9998
mkdir -p node-logs
10099
101-
# Collect PostgreSQL logs from each node
100+
# Collect PostgreSQL logs and spockbench output from each node
102101
for node in n1 n2 n3; do
103102
echo "Collecting logs from $node..."
104103
docker compose cp pgedge-$node:/home/pgedge/pgedge/data/pg${{ matrix.pgver }}/log node-logs/$node-pg-log/ || true
104+
docker compose cp pgedge-$node:/home/pgedge/spock/spockbench-$node.out node-logs/ || true
105105
docker compose logs pgedge-$node > node-logs/$node-container.log 2>&1 || true
106106
done
107107
@@ -120,13 +120,14 @@ jobs:
120120
cd ${GITHUB_WORKSPACE}/tests/docker
121121
./check-outputs.sh || true
122122
123-
- name: Cleanup docker
123+
- name: Cleanup spockbench docker container
124124
if: ${{ always() }}
125125
run: |
126126
cd ${GITHUB_WORKSPACE}/tests/docker/
127127
docker compose down || true
128128
129129
- name: Run regression tests
130+
if: ${{ always() }}
130131
run: |
131132
REG_CT_NAME="spock-regress-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
132133
echo "REG_CT_NAME=$REG_CT_NAME" >> "$GITHUB_ENV"
@@ -150,6 +151,7 @@ jobs:
150151
retention-days: 7
151152

152153
- name: Run TAP tests
154+
if: ${{ always() }}
153155
run: |
154156
TAP_CT_NAME="spock-tap-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
155157
echo "TAP_CT_NAME=$TAP_CT_NAME" >> "$GITHUB_ENV"

src/spock_relcache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ spock_relation_open(uint32 remoteid, LOCKMODE lockmode)
156156
* value of the relreplident field. But it is just a cache ...
157157
*/
158158
relinfo->ri_RelationDesc->rd_rel->relreplident = REPLICA_IDENTITY_DEFAULT;
159+
relinfo->ri_RelationDesc->rd_indexvalid = false;
159160
entry->idxoid = RelationGetReplicaIndex(relinfo->ri_RelationDesc);
160161
Assert(entry->idxoid != InvalidOid);
161162
relinfo->ri_RelationDesc->rd_rel->relreplident = REPLICA_IDENTITY_FULL;

tests/docker/run-spock-regress.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
### Run the regression tests
44
###
55

6-
7-
export PG_CONFIG=/home/pgedge/pgedge/pg${PGVER}/bin/pg_config
8-
export PATH=/home/pgedge/pgedge/pg${PGVER}/bin:$PATH
9-
export LD_LIBRARY_PATH=/home/pgedge/pgedge/pg${PGVER}/lib/:$LD_LIBRARY_PATH
6+
source "${HOME}/.bashrc"
107

118
# PGVER should be previously set in the environment
129
if [ -z "${PGVER}" ]

tests/docker/run-spock-tap.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
### Run selected TAP tests iteratively
44
###
55

6-
7-
export PG_CONFIG=/home/pgedge/pgedge/pg${PGVER}/bin/pg_config
8-
export PATH=/home/pgedge/pgedge/pg${PGVER}/bin:$PATH
9-
export LD_LIBRARY_PATH=/home/pgedge/pgedge/pg${PGVER}/lib/:$LD_LIBRARY_PATH
6+
source "${HOME}/.bashrc"
107

118
# PGVER should be previously set in the environment
129
if [ -z "${PGVER}" ]

tests/docker/run-tests.sh

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,27 +137,19 @@ fi
137137
spockbench -h /tmp -i -s $SCALEFACTOR $PGDATABASE
138138

139139
psql -h /tmp <<_EOF_
140-
-- SET spock.enable_ddl_replication = 'on';
141-
-- SET spock.include_ddl_repset = 'on';
142-
143140
/*
144141
* To use delta_apply we should add NOT NULL constraint on such a column first.
145142
* Do it on each node - remember, we don't have Auto-DDL enabled.
146143
*/
147-
-- ALTER TABLE pgbench_accounts ALTER COLUMN abalance SET NOT NULL;
148-
-- ALTER TABLE pgbench_branches ALTER COLUMN bbalance SET NOT NULL;
149-
-- ALTER TABLE pgbench_tellers ALTER COLUMN tbalance SET NOT NULL;
144+
ALTER TABLE pgbench_accounts ALTER COLUMN abalance SET NOT NULL;
145+
ALTER TABLE pgbench_branches ALTER COLUMN bbalance SET NOT NULL;
146+
ALTER TABLE pgbench_tellers ALTER COLUMN tbalance SET NOT NULL;
150147
151148
/*
152149
* Each node adds test tables to replication sets. Hence, further DML will be
153150
* propagated by LR to other nodes
154151
*/
155152
SELECT spock.repset_add_all_tables('default', '{public}');
156-
157-
158-
-- SELECT spock.delta_apply('pgbench_accounts', 'abalance', false);
159-
-- SELECT spock.delta_apply('pgbench_branches', 'bbalance', false);
160-
-- SELECT spock.delta_apply('pgbench_tellers', 'tbalance', false);
161153
_EOF_
162154

163155
# ==========Spockbench tests ==========
@@ -168,6 +160,21 @@ spockbench -h /tmp --spock-num-nodes=3 --spock-node=${HOSTNAME:0-1} \
168160
-s $SCALEFACTOR -T $RUNTIME -R $RATE -P 5 -j $THREADS -c $CONNECTIONS \
169161
-n --spock-tx-mix=550,225,225 $PGDATABASE
170162

163+
# To be sure each spockbench client finalised their job
164+
# There are still races possible. Should it be OK for our testing purposes?
165+
sleep 5
166+
167+
# To be sure that conflict resolution has happened we need to wait until the
168+
# following transaction arrives
169+
echo "Begin after-Spockbench sync"
170+
for peer in "${peer_names[@]}"; do
171+
lsn=$(psql -A -t -h $peer -c "SELECT spock.sync_event()")
172+
echo "Wait until XLogRecord $lsn arrives and applies from $peer to $HOSTNAME"
173+
psql -A -t -h /tmp -c \
174+
"CALL spock.wait_for_sync_event(true, '$peer', '$lsn'::pg_lsn, 30)"
175+
done
176+
echo "Finish after-Spockbench sync"
177+
171178
spockbench-check $PGDATABASE > /home/pgedge/spock/spockbench-$HOSTNAME.out
172179
# Check only this node's output file, not all nodes
173180
grep -q "ERROR" /home/pgedge/spock/spockbench-$HOSTNAME.out && exit 1 || exit 0

0 commit comments

Comments
 (0)