aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/access/transam/xlog.c6
-rw-r--r--src/test/recovery/t/009_twophase.pl4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index b2430f617c0..8b0710abe60 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -5689,7 +5689,11 @@ StartupXLOG(void)
TrimCLOG();
TrimMultiXact();
- /* Reload shared-memory state for prepared transactions */
+ /*
+ * Reload shared-memory state for prepared transactions. This needs to
+ * happen before renaming the last partial segment of the old timeline as
+ * it may be possible that we have to recovery some transactions from it.
+ */
RecoverPreparedTransactions();
/* Shut down xlogreader */
diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl
index e1273fd0f12..64c300db2bb 100644
--- a/src/test/recovery/t/009_twophase.pl
+++ b/src/test/recovery/t/009_twophase.pl
@@ -32,7 +32,9 @@ sub configure_and_reload
# Setup london node
my $node_london = PostgreSQL::Test::Cluster->new("london");
-$node_london->init(allows_streaming => 1);
+# Archiving is used to provide coverage with the creation of .partial segments
+# done at the end of recovery and the recovery of two-phase transactions.
+$node_london->init(allows_streaming => 1, has_archiving => 1);
$node_london->append_conf(
'postgresql.conf', qq(
max_prepared_transactions = 10