Skip to content

Commit f025d7b

Browse files
committed
Return proper name to the docker image.
Pu spockbench as a first test Spockbench 1 f healthcheck 2 3
1 parent a48ad73 commit f025d7b

File tree

12 files changed

+214
-118
lines changed

12 files changed

+214
-118
lines changed

.github/workflows/spockbench.yml

Lines changed: 74 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,84 @@ 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 .
5657
58+
- name: Start docker cluster
59+
run: |
60+
cd ${GITHUB_WORKSPACE}/tests/docker/
61+
echo PG_VER=${{ matrix.pgver }} >> pgedge.env
62+
docker compose up --wait -d
63+
timeout-minutes: 20
64+
65+
- name: Run tests on all nodes
66+
run: |
67+
cd ${GITHUB_WORKSPACE}/tests/docker/
68+
69+
# Launch tests in background with per-node timeout and capture PIDs
70+
docker compose exec -T pgedge-n1 bash -c "~/tests/run-tests.sh" &
71+
PID1=$!
72+
docker compose exec -T pgedge-n2 bash -c "~/tests/run-tests.sh" &
73+
PID2=$!
74+
docker compose exec -T pgedge-n3 bash -c "~/tests/run-tests.sh" &
75+
PID3=$!
76+
77+
# Wait for all jobs and capture their exit codes
78+
wait $PID1
79+
EXIT1=$?
80+
wait $PID2
81+
EXIT2=$?
82+
wait $PID3
83+
EXIT3=$?
84+
85+
# Fail if any node failed
86+
if [ $EXIT1 -ne 0 ] || [ $EXIT2 -ne 0 ] || [ $EXIT3 -ne 0 ]; then
87+
echo "ERROR: One or more nodes failed"
88+
exit 1
89+
fi
90+
91+
echo "All nodes completed successfully"
92+
timeout-minutes: 10
93+
94+
- name: Collect node logs
95+
if: ${{ always() }}
96+
run: |
97+
cd ${GITHUB_WORKSPACE}/tests/docker/
98+
mkdir -p node-logs
99+
100+
# Collect PostgreSQL logs and spockbench output from each node
101+
for node in n1 n2 n3; do
102+
echo "Collecting logs from $node..."
103+
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
105+
docker compose logs pgedge-$node > node-logs/$node-container.log 2>&1 || true
106+
done
107+
108+
- name: Upload node logs
109+
if: ${{ always() }}
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: spockbench-node-logs-${{ matrix.pgver }}
113+
path: tests/docker/node-logs/
114+
if-no-files-found: ignore
115+
retention-days: 7
116+
117+
- name: Check spockbench output
118+
if: ${{ always() }}
119+
run: |
120+
cd ${GITHUB_WORKSPACE}/tests/docker
121+
./check-outputs.sh || true
122+
123+
- name: Cleanup spockbench docker container
124+
if: ${{ always() }}
125+
run: |
126+
cd ${GITHUB_WORKSPACE}/tests/docker/
127+
docker compose down || true
128+
57129
- name: Run regression tests
130+
if: ${{ always() }}
58131
run: |
59132
REG_CT_NAME="spock-regress-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
60133
echo "REG_CT_NAME=$REG_CT_NAME" >> "$GITHUB_ENV"
@@ -78,6 +151,7 @@ jobs:
78151
retention-days: 7
79152

80153
- name: Run TAP tests
154+
if: ${{ always() }}
81155
run: |
82156
TAP_CT_NAME="spock-tap-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
83157
echo "TAP_CT_NAME=$TAP_CT_NAME" >> "$GITHUB_ENV"
@@ -102,38 +176,3 @@ jobs:
102176
tests/logs/**
103177
if-no-files-found: ignore
104178
retention-days: 7
105-
106-
- name: Start docker cluster
107-
run: |
108-
cd ${GITHUB_WORKSPACE}/tests/docker/
109-
echo PG_VER=${{ matrix.pgver }} >> pgedge.env
110-
env BASE_IMAGE=ghcr.io/pgedge/base-debug-image:latest \
111-
docker-compose up --wait -d --build
112-
timeout-minutes: 20
113-
114-
- name: Run tests on all nodes
115-
run: |
116-
cd ${GITHUB_WORKSPACE}/tests/docker/
117-
docker-compose exec -T pgedge-n1 bash -c "~/tests/run-tests.sh" &
118-
PID1=$!
119-
docker-compose exec -T pgedge-n2 bash -c "~/tests/run-tests.sh" &
120-
PID2=$!
121-
docker-compose exec -T pgedge-n3 bash -c "~/tests/run-tests.sh" &
122-
PID3=$!
123-
wait $PID1
124-
wait $PID2
125-
wait $PID3
126-
timeout-minutes: 30
127-
128-
- name: Check spockbench output
129-
if: ${{ always() }}
130-
run: |
131-
cd ${GITHUB_WORKSPACE}/tests/docker
132-
./check-outputs.sh || true
133-
134-
- name: Cleanup docker
135-
if: ${{ always() }}
136-
run: |
137-
cd ${GITHUB_WORKSPACE}/tests/docker/
138-
docker-compose down || true
139-

sql/spock--6.0.0-devel.sql

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,18 @@ RETURNS oid CALLED ON NULL INPUT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spoc
281281
CREATE FUNCTION spock.repset_drop(set_name name, ifexists boolean DEFAULT false)
282282
RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spock_drop_replication_set';
283283

284-
CREATE FUNCTION spock.repset_add_table(set_name name, relation regclass, synchronize_data boolean DEFAULT false,
285-
columns text[] DEFAULT NULL, row_filter text DEFAULT NULL, include_partitions boolean default true)
286-
RETURNS boolean CALLED ON NULL INPUT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spock_replication_set_add_table';
284+
CREATE FUNCTION spock.repset_add_table(
285+
set_name name,
286+
relation regclass,
287+
synchronize_data boolean DEFAULT false,
288+
columns text[] DEFAULT NULL,
289+
row_filter text DEFAULT NULL,
290+
include_partitions boolean default true
291+
)
292+
RETURNS boolean
293+
AS 'MODULE_PATHNAME', 'spock_replication_set_add_table'
294+
LANGUAGE C CALLED ON NULL INPUT VOLATILE;
295+
287296
CREATE FUNCTION spock.repset_add_all_tables(set_name name, schema_names text[], synchronize_data boolean DEFAULT false)
288297
RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spock_replication_set_add_all_tables';
289298
CREATE FUNCTION spock.repset_remove_table(set_name name, relation regclass, include_partitions boolean default true)
@@ -652,9 +661,9 @@ $$ LANGUAGE plpgsql;
652661

653662
-- Set delta_apply security label on specific column
654663
CREATE FUNCTION spock.delta_apply(
655-
rel regclass,
664+
rel regclass,
656665
att_name name,
657-
to_drop boolean DEFAULT false
666+
to_drop boolean DEFAULT false
658667
) RETURNS boolean AS $$
659668
DECLARE
660669
label text;

src/spock_apply_heap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,7 @@ spock_apply_heap_insert(SpockRelation *rel, SpockTupleData *newtup)
928928
remoteslot, &localslot,
929929
true);
930930

931-
if (check_all_uc_indexes &&
932-
!found)
931+
if (check_all_uc_indexes && !found)
933932
{
934933
/*
935934
* Handle the special case of looking through all unique indexes

src/spock_conflict.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ spock_report_conflict(ConflictType conflict_type,
348348
const char *idxname = "(unknown)";
349349
const char *qualrelname;
350350

351-
352351
/* Ignore update-update conflict for same origin */
353352
if (conflict_type == CT_UPDATE_EXISTS)
354353
{

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/Dockerfile-base.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,33 @@ The image includes **all** libraries required to build PostgreSQL with maximum f
3535

3636
| Library | Purpose | Configure Flag |
3737
|---------|---------|----------------|
38-
| `zstd-devel` | Zstandard compression | `--with-zstd` |
38+
| `libzstd-devel` | Zstandard compression | `--with-zstd` |
3939
| `lz4-devel` | LZ4 compression | `--with-lz4` |
4040
| `libicu-devel` | Unicode and internationalization | `--with-icu` |
4141
| `libxml2-devel` | XML support | `--with-libxml` |
4242
| `libxslt-devel` | XSLT transformations | `--with-libxslt` |
4343
| `openssl-devel` | SSL/TLS connections | `--with-openssl` |
4444
| `krb5-devel` | Kerberos authentication | `--with-gssapi` |
45+
| `cyrus-sasl-gssapi` | SASL GSSAPI support | Related to GSSAPI |
4546
| `openldap-devel` | LDAP authentication | `--with-ldap` |
4647
| `pam-devel` | PAM authentication | `--with-pam` |
4748
| `systemd-devel` | Systemd integration | `--with-systemd` |
4849
| `python3-devel` | PL/Python language | `--with-python` |
4950
| `readline-devel` | Enhanced psql CLI | Built-in |
5051
| `llvm-devel` | JIT compilation | `--with-llvm` |
51-
| `libuuid-devel` | UUID generation | `--with-uuid=ossp` |
52+
| `libuuid-devel`, `uuid-devel` | UUID generation | `--with-uuid=ossp` |
53+
| `libpq`, `libpq-devel` | PostgreSQL client library | Development headers |
54+
| `jansson-devel` | JSON parsing | For extensions |
55+
| `zlib-devel` | Compression library | Built-in |
56+
| `pkgconfig` | Package config tool | Build system helper |
5257

5358
### 3. Testing Infrastructure
5459

55-
- **Perl Testing Framework**: `perl-IPC-Run`, `Test::More` for PostgreSQL TAP tests
56-
- **SSH Configuration**: Pre-configured SSH keys for multi-node testing scenarios
60+
- **Perl Testing Framework**: `perl-IPC-Run`, `perl-Test-Simple` (includes Test::More) for PostgreSQL TAP tests
61+
- **SSH Configuration**: Pre-configured SSH keys and `openssh-clients`, `openssh-server` for multi-node testing scenarios
5762
- **Network Tools**: `nc` (netcat), `bind-utils` (dig, nslookup) for connectivity testing
5863
- **Process Tools**: `procps` for monitoring and debugging
64+
- **Utility Tools**: `curl`, `unzip` for downloading and extracting archives
5965

6066
### 4. User Configuration
6167

@@ -77,10 +83,7 @@ The image includes **all** libraries required to build PostgreSQL with maximum f
7783
1. **System Packages** (~500MB compressed):
7884
- Rocky Linux 9 base system updates
7985
- Development Tools group install
80-
- 40+ development packages and their dependencies
81-
82-
2. **Perl Modules** (via CPAN):
83-
- `Test::More` - PostgreSQL TAP test framework
86+
- 40+ development packages and their dependencies (all installed via dnf)
8487

8588
## Image Size and Optimization
8689

@@ -96,7 +99,6 @@ This large size is **intentional and appropriate** for a development/testing bas
9699
```dockerfile
97100
dnf clean all
98101
rm -rf /var/cache/dnf/* /tmp/* /var/tmp/*
99-
rm -rf /root/.cpanm
100102
```
101103

102104
## Usage Examples

tests/docker/Dockerfile-step-1.el9

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# further details.
3838
# ==============================================================================
3939

40-
ARG BASE_IMAGE=base-test-image:latest
40+
ARG BASE_IMAGE=ghcr.io/pgedge/base-test-image:latest
4141
FROM ${BASE_IMAGE}
4242

4343
# ==============================================================================
@@ -92,6 +92,22 @@ RUN set -eux && \
9292
COPY . /home/pgedge/spock
9393
COPY --chmod=755 tests/docker/*.sh /home/pgedge/
9494

95+
# ==============================================================================
96+
# Clone & Install Spockbench Testing Framework (needs root privileges)
97+
# ==============================================================================
98+
99+
# Clone spockbench for testing workloads
100+
# TODO: Pin to specific tag/commit for reproducibility
101+
RUN set -eux && \
102+
git clone --branch delta-apply-update --depth 1 \
103+
https://github.com/pgEdge/spockbench.git /home/pgedge/spockbench && \
104+
echo "export SPOCKBENCH_SOURCE_DIR=/home/pgedge/spockbench" >> /home/pgedge/.bashrc
105+
106+
RUN set -eux && \
107+
cd /home/pgedge/spockbench && \
108+
python3 setup.py install && \
109+
echo "Spockbench installation complete"
110+
95111
# Set proper ownership
96112
RUN chown -R pgedge:pgedge /home/pgedge/
97113

@@ -119,17 +135,6 @@ RUN set -eux && \
119135
git clone --branch "${LATEST_TAG}" --depth 1 \
120136
https://github.com/postgres/postgres.git /home/pgedge/postgres
121137

122-
# ==============================================================================
123-
# Clone Spockbench Testing Framework
124-
# ==============================================================================
125-
126-
# Clone spockbench for testing workloads
127-
# TODO: Pin to specific tag/commit for reproducibility
128-
RUN set -eux && \
129-
git clone --branch delta-apply-update --depth 1 \
130-
https://github.com/pgEdge/spockbench.git /home/pgedge/spockbench && \
131-
echo "export SPOCKBENCH_SOURCE_DIR=/home/pgedge/spockbench" >> /home/pgedge/.bashrc
132-
133138
# ==============================================================================
134139
# Apply Spock Patches to PostgreSQL
135140
# ==============================================================================
@@ -183,13 +188,13 @@ RUN set -eux && \
183188
echo "========================================" && \
184189
echo "Building PostgreSQL (${MAKE_JOBS} jobs)" && \
185190
echo "========================================" && \
186-
make -j${MAKE_JOBS} && \
187-
make -C contrib -j${MAKE_JOBS} && \
191+
make -j${MAKE_JOBS} > /dev/null && \
192+
make -C contrib -j${MAKE_JOBS} > /dev/null && \
188193
echo "========================================" && \
189194
echo "Installing PostgreSQL" && \
190195
echo "========================================" && \
191-
make install && \
192-
make -C contrib install && \
196+
make install > /dev/null && \
197+
make -C contrib install > /dev/null && \
193198
echo "PostgreSQL installation complete"
194199

195200
# ==============================================================================
@@ -202,21 +207,12 @@ RUN set -eux && \
202207
echo "========================================" && \
203208
echo "Building Spock Extension" && \
204209
echo "========================================" && \
205-
make clean && \
206-
make -j${MAKE_JOBS} && \
207-
make install && \
210+
make clean > /dev/null && \
211+
make -j${MAKE_JOBS} > /dev/null && \
212+
make install > /dev/null && \
208213
echo "export SPOCK_SOURCE_DIR=/home/pgedge/spock" >> /home/pgedge/.bashrc && \
209214
echo "Spock installation complete"
210215

211-
# ==============================================================================
212-
# Install spockbench
213-
# ==============================================================================
214-
215-
RUN set -eux && \
216-
cd /home/pgedge/spockbench && \
217-
sudo python3 setup.py install && \
218-
echo "Spockbench installation complete"
219-
220216
# ==============================================================================
221217
# Runtime Configuration
222218
# ==============================================================================

tests/docker/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ services:
3131
- ./cores/n1:/cores
3232
- .:/home/pgedge/tests
3333
healthcheck:
34-
test: ["CMD", "pg_isready", "-h", "/tmp", "-U", "admin"]
34+
test: ["CMD-SHELL", "pg_isready -h /tmp -p $$DBPORT -U $$DBUSER -d $$DBNAME && test -f /tmp/spock_init_complete"]
3535
interval: 10s
3636
timeout: 5s
3737
retries: 5
@@ -72,7 +72,7 @@ services:
7272
- ./cores/n2:/cores
7373
- .:/home/pgedge/tests
7474
healthcheck:
75-
test: ["CMD", "pg_isready", "-h", "/tmp", "-U", "admin"]
75+
test: ["CMD-SHELL", "pg_isready -h /tmp -p $$DBPORT -U $$DBUSER -d $$DBNAME && test -f /tmp/spock_init_complete"]
7676
interval: 10s
7777
timeout: 5s
7878
retries: 5
@@ -113,7 +113,7 @@ services:
113113
- ./cores/n3:/cores
114114
- .:/home/pgedge/tests
115115
healthcheck:
116-
test: ["CMD", "pg_isready", "-h", "/tmp", "-U", "admin"]
116+
test: ["CMD-SHELL", "pg_isready -h /tmp -p $$DBPORT -U $$DBUSER -d $$DBNAME && test -f /tmp/spock_init_complete"]
117117
interval: 10s
118118
timeout: 5s
119119
retries: 5

0 commit comments

Comments
 (0)