Skip to content

Commit cd96f2b

Browse files
committed
Support 64 bit XIDs.
1 parent 5e37fc6 commit cd96f2b

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

backup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static void pg_start_backup(const char *label, bool smooth, pgBackup *backup);
6464
static void pg_stop_backup(pgBackup *backup);
6565
static bool pg_is_standby(void);
6666
static void get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup);
67-
static void get_xid(PGresult *res, uint32 *xid);
67+
static void get_xid(PGresult *res, TransactionId *xid);
6868
static void pg_ptrack_clear(void);
6969
static bool pg_ptrack_support(void);
7070
static bool pg_ptrack_enable(void);
@@ -1042,14 +1042,14 @@ get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup)
10421042
* Get XID from result of txid_current() after pg_stop_backup().
10431043
*/
10441044
static void
1045-
get_xid(PGresult *res, uint32 *xid)
1045+
get_xid(PGresult *res, TransactionId *xid)
10461046
{
10471047
if (res == NULL || PQntuples(res) != 1 || PQnfields(res) != 1)
10481048
elog(ERROR,
10491049
"result of txid_current() is invalid: %s",
10501050
PQerrorMessage(connection));
10511051

1052-
if (sscanf(PQgetvalue(res, 0, 0), "%u", xid) != 1)
1052+
if (sscanf(PQgetvalue(res, 0, 0), XID_FMT, xid) != 1)
10531053
{
10541054
elog(ERROR,
10551055
"result of txid_current() is invalid: %s",

catalog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ catalog_read_ini(const char *path)
337337
{ 's', 0, "stop-lsn" , NULL, SOURCE_ENV },
338338
{ 't', 0, "start-time" , NULL, SOURCE_ENV },
339339
{ 't', 0, "end-time" , NULL, SOURCE_ENV },
340-
{ 'u', 0, "recovery-xid" , NULL, SOURCE_ENV },
340+
{ 'U', 0, "recovery-xid" , NULL, SOURCE_ENV },
341341
{ 't', 0, "recovery-time" , NULL, SOURCE_ENV },
342342
{ 'I', 0, "data-bytes" , NULL, SOURCE_ENV },
343343
{ 'u', 0, "block-size" , NULL, SOURCE_ENV },

pg_probackup.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
#define DIR_PERMISSION (0700)
4646
#define FILE_PERMISSION (0600)
4747

48+
#ifndef PGPRO_EE
49+
#define XID_FMT "%u"
50+
#endif
51+
4852
/* backup mode file */
4953
typedef struct pgFile
5054
{
@@ -119,7 +123,7 @@ typedef struct pgBackup
119123
time_t start_time;
120124
time_t end_time;
121125
time_t recovery_time;
122-
uint32 recovery_xid;
126+
TransactionId recovery_xid;
123127

124128
/* Different sizes (-1 means nothing was backed up) */
125129
/*
@@ -159,7 +163,7 @@ typedef struct pgRecoveryTarget
159163
bool time_specified;
160164
time_t recovery_target_time;
161165
bool xid_specified;
162-
unsigned int recovery_target_xid;
166+
TransactionId recovery_target_xid;
163167
bool recovery_target_inclusive;
164168
} pgRecoveryTarget;
165169

restore.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ checkIfCreateRecoveryConf(const char *target_time,
775775
const char *target_inclusive)
776776
{
777777
time_t dummy_time;
778-
unsigned int dummy_xid;
778+
TransactionId dummy_xid;
779779
bool dummy_bool;
780780
pgRecoveryTarget *rt;
781781

@@ -798,7 +798,11 @@ checkIfCreateRecoveryConf(const char *target_time,
798798
if (target_xid)
799799
{
800800
rt->xid_specified = true;
801-
if (parse_uint32(target_xid, &dummy_xid))
801+
#ifdef PGPRO_EE
802+
if (parse_uint64(target_xid, &dummy_xid))
803+
#else
804+
if (parse_uint32(target_xid, &dummy_xid))
805+
#endif
802806
rt->recovery_target_xid = dummy_xid;
803807
else
804808
elog(ERROR, "cannot create recovery.conf with %s", target_xid);

0 commit comments

Comments
 (0)