agora inbox for pgsql-bugs@postgresql.org  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: edwin.polkerman@splendiddata.com
Subject: BUG #19647: Difference in pg_basebackup behaviour between PostgreSQL <= 16 and >= 17 with pgactive extension
Date: Sun, 30 Aug 2026 17:08:49 +0000
Message-ID: <19647-d18354ebe2134a6d@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      19647
Logged by:          Edwin Polkerman
Email address:      edwin.polkerman@splendiddata.com
PostgreSQL version: 15.19
Operating system:   Linux (See details)
Description:        

Operating system:
I have tested this on SUSE15 SP7 x86_64 and ppc64le, RHEL8/9 x86_64 and
ppc64le, RHEL10 x86_64, Rocky Linux 8/9/10 x86_64 and every time having the
same results.

The start situation is a postgresql instance (data checksums on) with
extension pgactive (version 2.1.8) installed in a database (CREATE EXTENSION
pgactive;), in "shared_preload_libraries" and added to new parameter
"output_plugin_libraries". Following step is to take an base backup with
pg_basebackup.

In PostgreSQL versions 18.6 and 17.11 this succeeds without any problem.
However in PostgreSQL versions 16.15, 15.19 and 14.24 the backup process
fails.

FAIL SITUATION:

postgres=# select version();
                                      version
--------------------------------------------------------------------------------------
 PostgreSQL 15.19 on x86_64-pc-linux-gnu, compiled by gcc (SUSE Linux)
14.3.0, 64-bit
(1 row)

postgres=# select name, setting, category, short_desc from pg_settings where
name='data_checksums';
      name      | setting |    category    |
short_desc
----------------+---------+----------------+--------------------------------------------------------------
 data_checksums | on      | Preset Options | Shows whether data checksums
are turned on for this cluster.
(1 row)

For database app extension pgactive is installed and configured:

postgres=# \c app

app=# SELECT * from pgactive.pgactive_nodes;
-[ RECORD 1
]------+------------------------------------------------------------------------
node_sysid         | 7679811947370996481
node_timeline      | 0
node_dboid         | 16669
node_status        | r
node_name          | endpoint1-app
node_dsn           | user_mapping=splendid
pgactive_foreign_server=pgactive_server_endpoint1
node_init_from_dsn |
node_read_only     | f
node_seq_id        | 1
-[ RECORD 2
]------+------------------------------------------------------------------------
node_sysid         | 7679811972576347006
node_timeline      | 0
node_dboid         | 16386
node_status        | r
node_name          | endpoint2-app
node_dsn           | user_mapping=splendid
pgactive_foreign_server=pgactive_server_endpoint2
node_init_from_dsn | user_mapping=splendid
pgactive_foreign_server=pgactive_server_endpoint1
node_read_only     | f
node_seq_id        | 2

Creating an base backup:
> pg_basebackup -p 5442 -D /basebackup/backup/15/pg_basebackup_pg15pgactive
-X s -P -v -R
pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 0/44000028 on timeline 1
pg_basebackup: starting background WAL receiver
pg_basebackup: created temporary replication slot "pg_basebackup_14961"
pg_basebackup: error: COPY stream ended before last file was finished617_vm)
pg_basebackup: removing data directory
"/basebackup/backup/15/pg_basebackup_pg15pgactive"

Logging from the database server shows following:
2026-08-30 16:31:45 CEST   pid:14641 xid:0 ip: LOG:  checkpoint starting:
force wait
2026-08-30 16:31:45 CEST   pid:14641 xid:0 ip: LOG:  checkpoint complete:
wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled;
write=0.003 s, sync=0.001 s, total=0.009 s; sync files=0, longest=0.000 s,
average=0.000 s; distance=16383 kB, estimate=16383 kB
2026-08-30 16:31:48 CEST [unknown] postgres pid:14959 xid:0 ip:[local]
ERROR:  invalid segment number 0 in file "pgactive.stat"
2026-08-30 16:31:48 CEST [unknown] postgres pid:14959 xid:0 ip:[local]
STATEMENT:  BASE_BACKUP ( LABEL 'pg_basebackup base backup',  PROGRESS,
WAIT 0,  MANIFEST 'yes',  TARGET 'client')
2026-08-30 16:31:48 CEST [unknown] postgres pid:14961 xid:0 ip:[local] LOG:
unexpected EOF on standby connection
2026-08-30 16:31:48 CEST [unknown] postgres pid:14961 xid:0 ip:[local]
STATEMENT:  START_REPLICATION SLOT "pg_basebackup_14961" 0/44000000 TIMELINE
1

The ERROR message shows file pgactive.stat, which is probably placed by the
pgactive extension in the "global" directory in PGDATA
Stopped the server and run pg_checksum to verify:
> pg_checksums -c /var/pgpure/postgres/15/cluster2/
pg_checksums: error: invalid segment number 0 in file name
"/var/pgpure/postgres/18/cluster2//global/pgactive.stat"

As said, this behaviour is seen for 16.15, 15.19 and 14.24.

GOOD SITUATION:
postgres=# select version();
                                   version
-------------------------------------------------------------------------------------
 PostgreSQL 18.6 on x86_64-pc-linux-gnu, compiled by gcc (SUSE Linux)
14.3.0, 64-bit
(1 row)

postgres=# select name, setting, category, short_desc from pg_settings where
name='data_checksums';
      name      | setting |    category    |
short_desc
----------------+---------+----------------+--------------------------------------------------------------
 data_checksums | on      | Preset Options | Shows whether data checksums
are turned on for this cluster.
(1 row)

For database app extension pgactive is installed and configured:
postgres=# \c app

app=# SELECT * from pgactive.pgactive_nodes;
-[ RECORD 1
]------+------------------------------------------------------------------------
node_sysid         | 7678809857720063909
node_timeline      | 0
node_dboid         | 16702
node_status        | r
node_name          | endpoint1-app
node_dsn           | user_mapping=splendid
pgactive_foreign_server=pgactive_server_endpoint1
node_init_from_dsn |
node_read_only     | f
node_seq_id        | 1
-[ RECORD 2
]------+------------------------------------------------------------------------
node_sysid         | 7678809889904381387
node_timeline      | 0
node_dboid         | 16386
node_status        | r
node_name          | endpoint2-app
node_dsn           | user_mapping=splendid
pgactive_foreign_server=pgactive_server_endpoint2
node_init_from_dsn | user_mapping=splendid
pgactive_foreign_server=pgactive_server_endpoint1
node_read_only     | f
node_seq_id        | 2

Creating an base backup:
pg_basebackup -p 5442 -D /basebackup/backup/18/pg_basebackup_pg18pgactive -X
s -P -v -R
pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 0/55000028 on timeline 1
pg_basebackup: starting background WAL receiver
pg_basebackup: created temporary replication slot "pg_basebackup_141732"
372246/372246 kB (100%), 1/1 tablespace
pg_basebackup: write-ahead log end point: 0/55000120
pg_basebackup: waiting for background process to finish streaming ...
pg_basebackup: syncing data to disk ...
pg_basebackup: renaming backup_manifest.tmp to backup_manifest
pg_basebackup: base backup completed

For PostgreSQL 18.6 and 17.11 the backup completes without any problems.

The strange thing is that also here pg_checksums reports about file
pgactive.stat???
> pg_checksums -c /var/pgpure/postgres/18/cluster2/
pg_checksums: error: invalid segment number 0 in file name
"/var/pgpure/postgres/15/cluster2//global/pgactive.stat"







view thread (7+ messages)  latest in thread

Message-ID: <19647-d18354ebe2134a6d@postgresql.org>
Permalink:  ../19647-d18354ebe2134a6d@postgresql.org/
Also on:    postgresql.org/message-id/19647-d18354ebe2134a6d@postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, edwin.polkerman@splendiddata.com
  Subject: Re: BUG #19647: Difference in pg_basebackup behaviour between PostgreSQL <= 16 and >= 17 with pgactive extension
  In-Reply-To: <19647-d18354ebe2134a6d@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox