aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-06-20 10:25:49 +0900
committerMichael Paquier <michael@paquier.xyz>2023-06-20 10:25:49 +0900
commitc360594155e5c0704a952d6b26a01bcbe07cd591 (patch)
tree736b1ee85b0b49afa45d06b6c5e419392f918d7d /src
parent896012b88396f45ce67bbc3fd15f72245f5239d1 (diff)
downloadpostgresql-c360594155e5c0704a952d6b26a01bcbe07cd591.tar.gz
postgresql-c360594155e5c0704a952d6b26a01bcbe07cd591.zip
Enable archiving in recovery TAP test 009_twophase.pl
This is a follow-up of f663b00, that has been committed to v13 and v14, tweaking the TAP test for two-phase transactions so as it provides coverage for the bug that has been fixed. This change is done in its own commit for clarity, as v15 and HEAD did not show the problematic behavior, still missed coverage for it. While on it, this adds a comment about the dependency of the last partial segment rename and RecoverPreparedTransactions() at the end of recovery, as that can be easy to miss. Author: Michael Paquier Reviewed-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/743b9b45a2d4013bd90b6a5cba8d6faeb717ee34.camel@cybertec.at Backpatch-through: 13
Diffstat (limited to 'src')
-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 6438016d421..885a12a1148 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7899,7 +7899,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 4a79c5ebfdb..2b46a4d1a48 100644
--- a/src/test/recovery/t/009_twophase.pl
+++ b/src/test/recovery/t/009_twophase.pl
@@ -29,7 +29,9 @@ sub configure_and_reload
# Setup london node
my $node_london = get_new_node("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