forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf36d137
Fix corruption of templates after CREATE DATABASE .. STRATEGY WAL_LOG
WAL_LOG does a scan of the template's pg_class to determine the set ofrelations that need to be copied from a template database to the newone. However, as coded in9c08aea, this copy strategy would load thepages of pg_class without considering it as a permanent relation,causing the loaded pages to never be flushed when they should. Anymodification of the template's pg_class, mostly through DDLs, would thenbe missed, causing corruptions.STRATEGY = WAL_LOG is the default over FILE_COPY since it has beenintroduced, so any changes done to pg_class on a database template wouldbe gone. Updates of database templates should be a rare thing, so theimpact of this bug should be hopefully limited. The pre-14 defaultstrategy FILE_COPY is safe, and can be used as a workaround.Ryo Matsumura has found and analyzed the issue, and Nathan has written atest able to reproduce the failure (with few tweaks from me).Backpatch down to 15, where STRATEGY = WAL_LOG has been introduced.Author: Nathan Bossart, Ryo MatsumuraReviewed-by: Dilip Kumar, Michael PaquierDiscussion:https://postgr.es/m/TYCPR01MB6868677E499C9AD5123084B5E8A39@TYCPR01MB6868.jpnprd01.prod.outlook.comBackpatch-through: 151 parent47c670b commitf36d137
File tree
3 files changed
+47
-1
lines changed- src
- backend/commands
- test/recovery
- t
3 files changed
+47
-1
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
296 | 296 |
| |
297 | 297 |
| |
298 | 298 |
| |
299 |
| - | |
| 299 | + | |
300 | 300 |
| |
301 | 301 |
| |
302 | 302 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
| 42 | + | |
42 | 43 |
| |
43 | 44 |
| |
44 | 45 |
|
Lines changed: 45 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + |
0 commit comments
Comments
(0)