summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/access/transam/xlog.c2
-rw-r--r--src/test/recovery/t/003_recovery_targets.pl4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 20c797939cb..fe0baf70da7 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -5162,7 +5162,7 @@ readRecoveryCommandFile(void)
else if (strcmp(item->name, "recovery_target_xid") == 0)
{
errno = 0;
- recoveryTargetXid = (TransactionId) strtoul(item->value, NULL, 0);
+ recoveryTargetXid = (TransactionId) pg_strtouint64(item->value, NULL, 0);
if (errno == EINVAL || errno == ERANGE)
ereport(FATAL,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
diff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.pl
index fd759525d38..f21d3412027 100644
--- a/src/test/recovery/t/003_recovery_targets.pl
+++ b/src/test/recovery/t/003_recovery_targets.pl
@@ -50,6 +50,10 @@ sub test_recovery_standby
my $node_master = get_new_node('master');
$node_master->init(has_archiving => 1, allows_streaming => 1);
+# Bump the transaction ID epoch. This is useful to stress the portability
+# of recovery_target_xid parsing.
+system_or_bail('pg_resetxlog', '-e', '1', $node_master->data_dir);
+
# Start it
$node_master->start;