Skip to content

Commit c500aff

Browse files
YuweiXiaoclaude
andcommitted
ci: add PostgreSQL 17 to CI and Docker build matrices
- Add PG17 to pg_version matrix in CI regression and daemon E2E tests - Add PG17 to postgres matrix in Docker build and merge jobs - Add pg_duckpipe_17 bake target in docker-bake.hcl - Fix launch_worker to use WaitForBackgroundWorkerStartup: ensures the postmaster has actually forked the worker before returning, preventing a race where start_worker() reports success but the worker hasn't started yet (observed on slow CI runners) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e287bdf commit c500aff

4 files changed

Lines changed: 27 additions & 5 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
strategy:
3939
fail-fast: false
4040
matrix:
41-
pg_version: [18]
41+
pg_version: [17, 18]
4242

4343
steps:
4444
- name: Checkout code
@@ -118,7 +118,7 @@ jobs:
118118
strategy:
119119
fail-fast: false
120120
matrix:
121-
pg_version: [18]
121+
pg_version: [17, 18]
122122

123123
steps:
124124
- name: Checkout code

.github/workflows/docker.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
name: Build Docker image for Postgres ${{ matrix.postgres }} on ${{ matrix.runner }}
2929
strategy:
3030
matrix:
31-
postgres: ["18"]
31+
postgres: ["17", "18"]
3232
runner: ["ubuntu-24.04", "ubuntu-24.04-arm"]
3333

3434
runs-on: ${{ matrix.runner }}
@@ -113,7 +113,7 @@ jobs:
113113
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
114114
strategy:
115115
matrix:
116-
postgres: ["18"]
116+
postgres: ["17", "18"]
117117

118118
runs-on: ubuntu-24.04
119119
needs: docker_build

docker/docker-bake.hcl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ target "pg_duckpipe" {
2626
tags = ["${REPO}:${PG_VERSION}-dev"]
2727
}
2828

29+
target "pg_duckpipe_17" {
30+
inherits = ["pg_duckpipe"]
31+
args = {
32+
PG_VERSION = "17"
33+
}
34+
}
35+
2936
target "pg_duckpipe_18" {
3037
inherits = ["pg_duckpipe"]
3138
args = {

duckpipe-pg/src/api.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,22 @@ fn launch_worker(group_name: &str) -> bool {
302302
worker.bgw_main_arg = pg_sys::ObjectIdGetDatum(pg_sys::MyDatabaseId) as pg_sys::Datum;
303303
worker.bgw_notify_pid = pg_sys::MyProcPid;
304304

305-
pg_sys::RegisterDynamicBackgroundWorker(&mut worker, std::ptr::null_mut())
305+
let mut handle: *mut pg_sys::BackgroundWorkerHandle = std::ptr::null_mut();
306+
if !pg_sys::RegisterDynamicBackgroundWorker(&mut worker, &mut handle) {
307+
return false;
308+
}
309+
310+
// Wait for the postmaster to actually start the worker process.
311+
// Without this, RegisterDynamicBackgroundWorker may return true
312+
// (slot reserved) but the worker hasn't been forked yet.
313+
if !handle.is_null() {
314+
let mut pid: pg_sys::pid_t = 0;
315+
let status = pg_sys::WaitForBackgroundWorkerStartup(handle, &mut pid);
316+
pg_sys::pfree(handle as *mut std::ffi::c_void);
317+
status == pg_sys::BgwHandleStatus::BGWH_STARTED
318+
} else {
319+
true
320+
}
306321
}
307322
}
308323

0 commit comments

Comments
 (0)