Skip to content

Commit 1ed3b02

Browse files
committed
3
1 parent b3205bc commit 1ed3b02

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

.github/workflows/spockbench.yml

Lines changed: 7 additions & 4 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,8 +59,7 @@ 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
@@ -98,10 +98,11 @@ jobs:
9898
cd ${GITHUB_WORKSPACE}/tests/docker/
9999
mkdir -p node-logs
100100
101-
# Collect PostgreSQL logs from each node
101+
# Collect PostgreSQL logs and spockbench output from each node
102102
for node in n1 n2 n3; do
103103
echo "Collecting logs from $node..."
104104
docker compose cp pgedge-$node:/home/pgedge/pgedge/data/pg${{ matrix.pgver }}/log node-logs/$node-pg-log/ || true
105+
docker compose cp pgedge-$node:/home/pgedge/spock/spockbench-$node.out node-logs/ || true
105106
docker compose logs pgedge-$node > node-logs/$node-container.log 2>&1 || true
106107
done
107108
@@ -120,13 +121,14 @@ jobs:
120121
cd ${GITHUB_WORKSPACE}/tests/docker
121122
./check-outputs.sh || true
122123
123-
- name: Cleanup docker
124+
- name: Cleanup spockbench docker container
124125
if: ${{ always() }}
125126
run: |
126127
cd ${GITHUB_WORKSPACE}/tests/docker/
127128
docker compose down || true
128129
129130
- name: Run regression tests
131+
if: ${{ always() }}
130132
run: |
131133
REG_CT_NAME="spock-regress-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
132134
echo "REG_CT_NAME=$REG_CT_NAME" >> "$GITHUB_ENV"
@@ -150,6 +152,7 @@ jobs:
150152
retention-days: 7
151153

152154
- name: Run TAP tests
155+
if: ${{ always() }}
153156
run: |
154157
TAP_CT_NAME="spock-tap-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
155158
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: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ 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.
@@ -153,11 +150,6 @@ psql -h /tmp <<_EOF_
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)