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
84 changes: 72 additions & 12 deletions .github/workflows/spockbench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,78 @@ jobs:
--build-arg PGVER=${{ matrix.pgver }} \
-t spock -f tests/docker/Dockerfile-step-1.el9 .

- name: Start docker cluster
run: |
cd ${GITHUB_WORKSPACE}/tests/docker/
echo PG_VER=${{ matrix.pgver }} >> pgedge.env
env BASE_IMAGE=ghcr.io/pgedge/base-test-image:latest \
docker compose up --build --wait -d
timeout-minutes: 20

- name: Run tests on all nodes
run: |
cd ${GITHUB_WORKSPACE}/tests/docker/

# Launch tests in background with per-node timeout and capture PIDs
# Each node gets 5 minutes max (more than RUNTIME=60s + overhead)
docker compose exec -T pgedge-n1 bash -c "~/tests/run-tests.sh" &
PID1=$!
docker compose exec -T pgedge-n2 bash -c "~/tests/run-tests.sh" &
PID2=$!
docker compose exec -T pgedge-n3 bash -c "~/tests/run-tests.sh" &
PID3=$!

# Wait for all jobs and capture their exit codes
wait $PID1
EXIT1=$?
wait $PID2
EXIT2=$?
wait $PID3
EXIT3=$?

# Fail if any node failed
if [ $EXIT1 -ne 0 ] || [ $EXIT2 -ne 0 ] || [ $EXIT3 -ne 0 ]; then
echo "ERROR: One or more nodes failed"
exit 1
fi

echo "All nodes completed successfully"
timeout-minutes: 10

- name: Collect node logs
if: ${{ always() }}
run: |
cd ${GITHUB_WORKSPACE}/tests/docker/
mkdir -p node-logs

# Collect PostgreSQL logs from each node
for node in n1 n2 n3; do
echo "Collecting logs from $node..."
docker compose cp pgedge-$node:/home/pgedge/pgedge/data/pg${{ matrix.pgver }}/log node-logs/$node-pg-log/ || true
docker compose logs pgedge-$node > node-logs/$node-container.log 2>&1 || true
done

- name: Upload node logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: spockbench-node-logs-${{ matrix.pgver }}
path: tests/docker/node-logs/
if-no-files-found: ignore
retention-days: 7

- name: Check spockbench output
if: ${{ always() }}
run: |
cd ${GITHUB_WORKSPACE}/tests/docker
./check-outputs.sh || true

- name: Cleanup docker
if: ${{ always() }}
run: |
cd ${GITHUB_WORKSPACE}/tests/docker/
docker compose down || true

- name: Run regression tests
run: |
REG_CT_NAME="spock-regress-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
Expand Down Expand Up @@ -102,15 +174,3 @@ jobs:
tests/logs/**
if-no-files-found: ignore
retention-days: 7

- name: Start docker
run: |
cd ${GITHUB_WORKSPACE}/tests/docker/
echo PG_VER=${{ matrix.pgver }} >> pgedge.env
docker compose up

- name: Check spockbench output
run: |
cd ${GITHUB_WORKSPACE}/tests/docker
./check-outputs.sh

19 changes: 14 additions & 5 deletions sql/spock--6.0.0-devel.sql
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,18 @@ RETURNS oid CALLED ON NULL INPUT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spoc
CREATE FUNCTION spock.repset_drop(set_name name, ifexists boolean DEFAULT false)
RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spock_drop_replication_set';

CREATE FUNCTION spock.repset_add_table(set_name name, relation regclass, synchronize_data boolean DEFAULT false,
columns text[] DEFAULT NULL, row_filter text DEFAULT NULL, include_partitions boolean default true)
RETURNS boolean CALLED ON NULL INPUT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spock_replication_set_add_table';
CREATE FUNCTION spock.repset_add_table(
set_name name,
relation regclass,
synchronize_data boolean DEFAULT false,
columns text[] DEFAULT NULL,
row_filter text DEFAULT NULL,
include_partitions boolean default true
)
RETURNS boolean
AS 'MODULE_PATHNAME', 'spock_replication_set_add_table'
LANGUAGE C CALLED ON NULL INPUT VOLATILE;

CREATE FUNCTION spock.repset_add_all_tables(set_name name, schema_names text[], synchronize_data boolean DEFAULT false)
RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'spock_replication_set_add_all_tables';
CREATE FUNCTION spock.repset_remove_table(set_name name, relation regclass, include_partitions boolean default true)
Expand Down Expand Up @@ -652,9 +661,9 @@ $$ LANGUAGE plpgsql;

-- Set delta_apply security label on specific column
CREATE FUNCTION spock.delta_apply(
rel regclass,
rel regclass,
att_name name,
to_drop boolean DEFAULT false
to_drop boolean DEFAULT false
) RETURNS boolean AS $$
DECLARE
label text;
Expand Down
5 changes: 2 additions & 3 deletions src/spock_apply_heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,7 @@ spock_apply_heap_insert(SpockRelation *rel, SpockTupleData *newtup)
remoteslot, &localslot,
true);

if (check_all_uc_indexes &&
!found)
if (check_all_uc_indexes && !found)
{
/*
* Handle the special case of looking through all unique indexes
Expand Down Expand Up @@ -1190,7 +1189,7 @@ spock_apply_heap_delete(SpockRelation *rel, SpockTupleData *oldtup)
{
HeapTuple remotetuple;
SpockExceptionLog *exception_log = &exception_log_ptr[my_exception_log_index];

elog(WARNING, "--> delete resolve");
/*
* The tuple to be deleted could not be found. Do nothing except for
* logging it in resolutions table.
Expand Down
2 changes: 1 addition & 1 deletion src/spock_conflict.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ spock_report_conflict(ConflictType conflict_type,
const char *idxname = "(unknown)";
const char *qualrelname;


elog(LOG, "spock_report_conflict called with conflict_type=%d", conflict_type);
/* Ignore update-update conflict for same origin */
if (conflict_type == CT_UPDATE_EXISTS)
{
Expand Down
20 changes: 11 additions & 9 deletions tests/docker/Dockerfile-base.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,33 @@ The image includes **all** libraries required to build PostgreSQL with maximum f

| Library | Purpose | Configure Flag |
|---------|---------|----------------|
| `zstd-devel` | Zstandard compression | `--with-zstd` |
| `libzstd-devel` | Zstandard compression | `--with-zstd` |
| `lz4-devel` | LZ4 compression | `--with-lz4` |
| `libicu-devel` | Unicode and internationalization | `--with-icu` |
| `libxml2-devel` | XML support | `--with-libxml` |
| `libxslt-devel` | XSLT transformations | `--with-libxslt` |
| `openssl-devel` | SSL/TLS connections | `--with-openssl` |
| `krb5-devel` | Kerberos authentication | `--with-gssapi` |
| `cyrus-sasl-gssapi` | SASL GSSAPI support | Related to GSSAPI |
| `openldap-devel` | LDAP authentication | `--with-ldap` |
| `pam-devel` | PAM authentication | `--with-pam` |
| `systemd-devel` | Systemd integration | `--with-systemd` |
| `python3-devel` | PL/Python language | `--with-python` |
| `readline-devel` | Enhanced psql CLI | Built-in |
| `llvm-devel` | JIT compilation | `--with-llvm` |
| `libuuid-devel` | UUID generation | `--with-uuid=ossp` |
| `libuuid-devel`, `uuid-devel` | UUID generation | `--with-uuid=ossp` |
| `libpq`, `libpq-devel` | PostgreSQL client library | Development headers |
| `jansson-devel` | JSON parsing | For extensions |
| `zlib-devel` | Compression library | Built-in |
| `pkgconfig` | Package config tool | Build system helper |

### 3. Testing Infrastructure

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

### 4. User Configuration

Expand All @@ -77,10 +83,7 @@ The image includes **all** libraries required to build PostgreSQL with maximum f
1. **System Packages** (~500MB compressed):
- Rocky Linux 9 base system updates
- Development Tools group install
- 40+ development packages and their dependencies

2. **Perl Modules** (via CPAN):
- `Test::More` - PostgreSQL TAP test framework
- 40+ development packages and their dependencies (all installed via dnf)

## Image Size and Optimization

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

## Usage Examples
Expand Down
Loading
Loading