forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf663b00
committed
Fix failure at promotion with 2PC transactions and archiving enabled
When archiving is enabled, a promotion request would fail with thefollowing error when some 2PC transaction needs to be recovered fromWAL, preventing the promotion to complete:FATAL: requested WAL segment pg_wal/000000010000000000000001 has already been removedThe origin of the problem is that the last partial segment of the oldtimeline is renamed before recovering the 2PC data viaRecoverPreparedTransactions() at the end of recovery, causing the FATALbecause the segment wanted is now renamed with a .partial suffix. Thiscommit reorders a bit the end-of-recovery actions so as the execution ofrecovery_end_command, the cleanup of the old segments of the oldtimeline (RemoveNonParentXlogFiles) and the last partial segment renameare done after the 2PC transaction data is recovered withRecoverPreparedTransactions(). This makes the order of theseend-of-recovery actions more consistent with ~15, at the exception ofthe end-of-recovery checkpoint that still needs to happen before all theactions reordered here in v13 and v14, contrary to what 15~ does.v15 and newer versions have "fixed" this problem somewhat accidentallywith811051c, where the end-of-recovery actions got reordered. In thiscase, the recovery of 2PC transactions happens before the renaming ofthe last partial segment of the old timeline.v13 and v14 are the versions that can easily see this problem as per therefactoring of38a9573 where XLogReaderState is reset inXLogBeginRead() before reading the 2PC transaction data. v11 and v12could also see this problem, but may finish by reading the 2PC data fromsome of the WAL buffers instead. Perhaps something could be done forthese two branches, but I am not really excited about doing something onthese per the lack of complaints and per the fact that v11 is soon goingto be EOL'd soon (there is always a risk of breaking something).Note that the TAP test 009_twophase.pl is able to exhibit the issue ifit enables archiving on the primary node, which does not impact the testcoverage as restore_command would remain unused. This is something thatshould be changed on v15 and HEAD as well, so this will be changed in aseparate commit for clarity.Author: Julian MarkwortReviewed-by: Kyotaro Horiguchi, Michael PaquierDiscussion:https://postgr.es/m/743b9b45a2d4013bd90b6a5cba8d6faeb717ee34.camel@cybertec.atBackpatch-through: 131 parent73f1c17 commitf663b00
1 file changed
+51
-51
lines changedLines changed: 51 additions & 51 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8016 | 8016 |
| |
8017 | 8017 |
| |
8018 | 8018 |
| |
| 8019 | + | |
| 8020 | + | |
| 8021 | + | |
| 8022 | + | |
| 8023 | + | |
| 8024 | + | |
| 8025 | + | |
| 8026 | + | |
| 8027 | + | |
| 8028 | + | |
| 8029 | + | |
| 8030 | + | |
| 8031 | + | |
| 8032 | + | |
| 8033 | + | |
| 8034 | + | |
| 8035 | + | |
| 8036 | + | |
| 8037 | + | |
| 8038 | + | |
| 8039 | + | |
| 8040 | + | |
| 8041 | + | |
| 8042 | + | |
| 8043 | + | |
| 8044 | + | |
| 8045 | + | |
| 8046 | + | |
| 8047 | + | |
| 8048 | + | |
| 8049 | + | |
| 8050 | + | |
| 8051 | + | |
| 8052 | + | |
| 8053 | + | |
| 8054 | + | |
| 8055 | + | |
| 8056 | + | |
| 8057 | + | |
| 8058 | + | |
| 8059 | + | |
| 8060 | + | |
| 8061 | + | |
| 8062 | + | |
| 8063 | + | |
| 8064 | + | |
| 8065 | + | |
| 8066 | + | |
| 8067 | + | |
| 8068 | + | |
| 8069 | + | |
8019 | 8070 |
| |
8020 | 8071 |
| |
8021 | 8072 |
| |
| |||
8097 | 8148 |
| |
8098 | 8149 |
| |
8099 | 8150 |
| |
8100 |
| - | |
8101 |
| - | |
8102 |
| - | |
8103 |
| - | |
8104 |
| - | |
8105 |
| - | |
8106 |
| - | |
8107 |
| - | |
8108 |
| - | |
8109 |
| - | |
8110 |
| - | |
8111 |
| - | |
8112 |
| - | |
8113 |
| - | |
8114 |
| - | |
8115 |
| - | |
8116 |
| - | |
8117 |
| - | |
8118 |
| - | |
8119 |
| - | |
8120 |
| - | |
8121 |
| - | |
8122 |
| - | |
8123 |
| - | |
8124 |
| - | |
8125 |
| - | |
8126 |
| - | |
8127 |
| - | |
8128 |
| - | |
8129 |
| - | |
8130 |
| - | |
8131 |
| - | |
8132 |
| - | |
8133 |
| - | |
8134 |
| - | |
8135 |
| - | |
8136 |
| - | |
8137 |
| - | |
8138 |
| - | |
8139 |
| - | |
8140 |
| - | |
8141 |
| - | |
8142 |
| - | |
8143 |
| - | |
8144 |
| - | |
8145 |
| - | |
8146 |
| - | |
8147 |
| - | |
8148 |
| - | |
8149 |
| - | |
8150 |
| - | |
8151 | 8151 |
| |
8152 | 8152 |
| |
8153 | 8153 |
| |
|
0 commit comments
Comments
(0)