From 65488bbd92ec0a7a09babd12c307d95dd606f8c3 Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 09:19:33 +0500 Subject: [PATCH 01/15] feat: update CI versions, add dynamic CMD for running compose on different versions --- .github/workflows/ci.yml | 21 +++++++++++++++++---- docker-compose.yml | 7 ++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed6bc77..697b8c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,14 @@ name: CI on: push: - branches: [master] pull_request: - branches: [master] + workflow_dispatch: + +# on: +# push: +# branches: [master] +# pull_request: +# branches: [master] jobs: test: @@ -13,12 +18,17 @@ jobs: strategy: matrix: # minimum and latest version of Go - go-version: ["1.21", "1.24"] + go-version: ["1.21", "1.25"] # all supported versions of Postgres - pg-version: [13, 14, 15, 16, 17] + pg-version: [13, 14, 15, 16, 17, 18] fail-fast: false env: PGLOGREPL_TEST_CONN_STRING: "postgres://pglogrepl:secret@127.0.0.1/pglogrepl?replication=database" + POSTGRES_VERSION: ${{ matrix.pg-version }} + POSTGRES_COMMAND: >- + ${{ matrix.pg-version >= 17 + && 'postgres -c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10' + || 'postgres -c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10 -c summarize_wal=on' }} steps: - name: Checkout Code uses: actions/checkout@v3 @@ -32,3 +42,6 @@ jobs: POSTGRES_VERSION: ${{ matrix.pg-version }} - name: Run tests run: go test -v -race ./... + - name: Tear down + if: always() + run: docker compose down -v postgres diff --git a/docker-compose.yml b/docker-compose.yml index 84418df..e8af7bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,12 @@ services: postgres: image: postgres:${POSTGRES_VERSION:-17}-alpine restart: always - command: ["-c", "wal_level=logical", "-c", "max_wal_senders=10", "-c", "max_replication_slots=10"] + command: ${POSTGRES_COMMAND} + # [ + # "-c", "wal_level=logical", + # "-c", "max_wal_senders=10", + # "-c", "max_replication_slots=10", + # ] environment: POSTGRES_USER: ${POSTGRES_USER:-pglogrepl} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-secret} From f5a5de3c441ea58e825551f7e05b20baa498e266 Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 09:27:55 +0500 Subject: [PATCH 02/15] fix: typo in CI CMD --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 697b8c8..4de3447 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,8 @@ jobs: POSTGRES_VERSION: ${{ matrix.pg-version }} POSTGRES_COMMAND: >- ${{ matrix.pg-version >= 17 - && 'postgres -c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10' - || 'postgres -c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10 -c summarize_wal=on' }} + && '-c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10' + || '-c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10 -c summarize_wal=on' }} steps: - name: Checkout Code uses: actions/checkout@v3 From d2c12432c6c2a84a8856a5c309656bd545af509e Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 09:32:03 +0500 Subject: [PATCH 03/15] fix: typo in CI (version chooser) --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4de3447..42e67a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,8 @@ jobs: POSTGRES_VERSION: ${{ matrix.pg-version }} POSTGRES_COMMAND: >- ${{ matrix.pg-version >= 17 - && '-c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10' - || '-c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10 -c summarize_wal=on' }} + && '-c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10 -c summarize_wal=on' + || '-c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10' }} steps: - name: Checkout Code uses: actions/checkout@v3 From 3a1d0e100fa058691a3499c9e7a3327b2f007c29 Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 09:38:10 +0500 Subject: [PATCH 04/15] fix: debug CI and compose file --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42e67a5..f0b12d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,12 @@ jobs: uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} + - name: Debug rendered compose config + run: | + echo "matrix.pg-version=${{ matrix.pg-version }}" + echo "POSTGRES_VERSION=$POSTGRES_VERSION" + printf 'POSTGRES_COMMAND=%s\n' "$POSTGRES_COMMAND" + docker compose config - name: Stand up Postgres ${{ matrix.pg-version }} run: docker compose up -d postgres env: @@ -44,4 +50,4 @@ jobs: run: go test -v -race ./... - name: Tear down if: always() - run: docker compose down -v postgres + run: docker compose down -v From 3350cfc28f831731d4bca318469fbd948ba2852e Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 09:43:07 +0500 Subject: [PATCH 05/15] fix: run tests with wal_level=replica --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0b12d7..825552a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: POSTGRES_VERSION: ${{ matrix.pg-version }} POSTGRES_COMMAND: >- ${{ matrix.pg-version >= 17 - && '-c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10 -c summarize_wal=on' + && '-c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10 -c summarize_wal=on' || '-c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10' }} steps: - name: Checkout Code From e8b315df9bce2d334122d5fd8ba87237027540be Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 09:48:13 +0500 Subject: [PATCH 06/15] fix: update CI actions versions --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 825552a..c473981 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,9 +31,9 @@ jobs: || '-c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10' }} steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} - name: Debug rendered compose config From f3672087322a916e33f8607642f74e1f37d556ea Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 10:01:57 +0500 Subject: [PATCH 07/15] fix: run compose with --force-recreate --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c473981..bca4cad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: printf 'POSTGRES_COMMAND=%s\n' "$POSTGRES_COMMAND" docker compose config - name: Stand up Postgres ${{ matrix.pg-version }} - run: docker compose up -d postgres + run: docker compose up -d --force-recreate postgres env: POSTGRES_VERSION: ${{ matrix.pg-version }} - name: Run tests From 2a7f33d4cf1c9a87fdde60787a5350e840c8bc7f Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 10:05:10 +0500 Subject: [PATCH 08/15] fix: do not use cache in setup-go action --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bca4cad..8a6c22d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,7 @@ jobs: uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} + cache: false - name: Debug rendered compose config run: | echo "matrix.pg-version=${{ matrix.pg-version }}" From a0818fe258f0420b3747391f6b1190f0508771c6 Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 10:10:34 +0500 Subject: [PATCH 09/15] fix: run tests with wal_level=logical --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a6c22d..ccd9d70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,8 @@ jobs: POSTGRES_VERSION: ${{ matrix.pg-version }} POSTGRES_COMMAND: >- ${{ matrix.pg-version >= 17 - && '-c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10 -c summarize_wal=on' - || '-c wal_level=replica -c max_wal_senders=10 -c max_replication_slots=10' }} + && '-c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10 -c summarize_wal=on' + || '-c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10' }} steps: - name: Checkout Code uses: actions/checkout@v6 @@ -36,7 +36,7 @@ jobs: uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} - cache: false + cache: true - name: Debug rendered compose config run: | echo "matrix.pg-version=${{ matrix.pg-version }}" @@ -44,7 +44,7 @@ jobs: printf 'POSTGRES_COMMAND=%s\n' "$POSTGRES_COMMAND" docker compose config - name: Stand up Postgres ${{ matrix.pg-version }} - run: docker compose up -d --force-recreate postgres + run: docker compose up -d postgres env: POSTGRES_VERSION: ${{ matrix.pg-version }} - name: Run tests From 8d0d70d5911bc8b1122e2f22ca1caa4ed5db6d05 Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 10:14:21 +0500 Subject: [PATCH 10/15] feat: update go to 1.25.0 --- go.mod | 11 +++++------ go.sum | 26 ++++++++++++-------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index ab8c1d7..110b573 100644 --- a/go.mod +++ b/go.mod @@ -1,21 +1,20 @@ module github.com/jackc/pglogrepl -go 1.21 +go 1.25.0 require ( github.com/jackc/pgio v1.0.0 - github.com/jackc/pgx/v5 v5.5.4 - github.com/stretchr/testify v1.8.4 + github.com/jackc/pgx/v5 v5.9.1 + github.com/stretchr/testify v1.11.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - golang.org/x/crypto v0.17.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/text v0.35.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 5f71e6b..6016bd0 100644 --- a/go.sum +++ b/go.sum @@ -6,12 +6,12 @@ github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.5.4 h1:Xp2aQS8uXButQdnCMWNmvx6UysWQQC+u1EoizjguY+8= -github.com/jackc/pgx/v5 v5.5.4/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= -github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= -github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.9.1 h1:uwrxJXBnx76nyISkhr33kQLlUqjv7et7b9FjCen/tdc= +github.com/jackc/pgx/v5 v5.9.1/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -23,14 +23,12 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= +golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From f41edc66a712dfe1a03543a79c438c0cc860ee8b Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 10:24:08 +0500 Subject: [PATCH 11/15] fix: running on go versions ["1.25", "1.26"] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ccd9d70..c7cefed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: # minimum and latest version of Go - go-version: ["1.21", "1.25"] + go-version: ["1.25", "1.26"] # all supported versions of Postgres pg-version: [13, 14, 15, 16, 17, 18] fail-fast: false From 1319a538ceff3af3d776dba6ea7e815482fbb33a Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 10:29:13 +0500 Subject: [PATCH 12/15] fix: debug incremental bb unit-tests --- pglogrepl_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pglogrepl_test.go b/pglogrepl_test.go index 54d4144..a521202 100644 --- a/pglogrepl_test.go +++ b/pglogrepl_test.go @@ -448,6 +448,7 @@ func TestBaseBackupIncremental(t *testing.T) { serverVersion, err := serverMajorVersion(conn) require.NoError(t, err) if serverVersion < 17 { + t.Logf("server version: %d\n", serverVersion) t.Skip() } From 542e9010bb610414665631db1e47f06aa637d1ae Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 10:32:26 +0500 Subject: [PATCH 13/15] fix: debug CI cache --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7cefed..643affd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} - cache: true + cache: false - name: Debug rendered compose config run: | echo "matrix.pg-version=${{ matrix.pg-version }}" From c3cdee90dd67b130d97d1b3fefa9227e1b83a6cb Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 10:36:46 +0500 Subject: [PATCH 14/15] fix: remove debug logs --- pglogrepl_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pglogrepl_test.go b/pglogrepl_test.go index a521202..54d4144 100644 --- a/pglogrepl_test.go +++ b/pglogrepl_test.go @@ -448,7 +448,6 @@ func TestBaseBackupIncremental(t *testing.T) { serverVersion, err := serverMajorVersion(conn) require.NoError(t, err) if serverVersion < 17 { - t.Logf("server version: %d\n", serverVersion) t.Skip() } From 3b2dbe8f529a4868cdf7a775d19a11eb1b7a8042 Mon Sep 17 00:00:00 2001 From: "alexey.zh" Date: Wed, 1 Apr 2026 10:44:52 +0500 Subject: [PATCH 15/15] fix: ci -> restore triggers --- .github/workflows/ci.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 643affd..70c5d14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,14 +2,9 @@ name: CI on: push: + branches: [master] pull_request: - workflow_dispatch: - -# on: -# push: -# branches: [master] -# pull_request: -# branches: [master] + branches: [master] jobs: test: