From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Magnus Hagander <magnus@hagander.net>
Subject: pg_basebackup fails on databases with high OIDs
Date: Mon, 6 Jan 2020 09:07:26 +0100
Message-ID: <dea47fc8-6c89-a2b1-07e3-754ff1ab094b@2ndquadrant.com> (raw)
This is a new bug in PG12. When you have a database with an OID above
INT32_MAX (signed), then pg_basebackup fails thus:
pg_basebackup: error: could not get write-ahead log end position from
server: ERROR: value "3000000000" is out of range for type integer
The cause appears to be commit 6b9e875f7286d8535bff7955e5aa3602e188e436.
A possible fix is attached. An alternative to using
OidInputFunctionCall() would be exporting something like oidin_subr().
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachments:0001-Fix-base-backup-with-database-OIDs-larger-than-INT32.patch (text/plain, 1.2K) download
From 19ee6b09568b4247c33c2920277dde2fbd3f0ac4 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Sun, 29 Dec 2019 20:15:50 +0100
Subject: [PATCH] Fix base backup with database OIDs larger than INT32_MAX
---
src/backend/replication/basebackup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.cindex a73893237a..0e3e0c7a38 100644--- a/src/backend/replication/basebackup.c+++ b/src/backend/replication/basebackup.c@@ -38,6 +38,7 @@
#include "storage/ipc.h"
#include "storage/reinit.h"
#include "utils/builtins.h"
+#include "utils/fmgroids.h"
#include "utils/ps_status.h"
#include "utils/relcache.h"
#include "utils/timestamp.h"
@@ -1316,7 +1317,7 @@ sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
if (!sizeonly)
sent = sendFile(pathbuf, pathbuf + basepathlen + 1, &statbuf,
- true, isDbDir ? pg_atoi(lastDir + 1, sizeof(Oid), 0) : InvalidOid);+ true, isDbDir ? DatumGetObjectId(OidInputFunctionCall(F_OIDIN, unconstify(char *, lastDir + 1), 0, -1)) : InvalidOid);
if (sent || sizeonly)
{
--
2.24.1
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-hackers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, magnus@hagander.net
Subject: Re: pg_basebackup fails on databases with high OIDs
In-Reply-To: <dea47fc8-6c89-a2b1-07e3-754ff1ab094b@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox