forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf54d062
committed
Fix ALTER TABLE ... SET TABLESPACE for unlogged relations.
Changing the tablespace of an unlogged relation did not WAL log thecreation and content of the init fork. Thus, after a standby ispromoted, unlogged relation cannot be accessed anymore, with errorslike:ERROR: 58P01: could not open file "pg_tblspc/...": No such file or directoryAdditionally the init fork was not synced to disk, independent of theconfigured wal_level, a relatively small durability risk.Investigation of that problem also brought to light that, even forpermanent relations, the creation of !main forks was not WAL logged,i.e. no XLOG_SMGR_CREATE record were emitted. That mostly turns out notto be a problem, because these files were created when the actualrelation data is copied; nonexistent files are not treated as an errorcondition during replay. But that doesn't work for empty files, andgenerally feels a bit haphazard. Luckily, outside init and main forks,empty forks don't occur often or are not a problem.Add the required WAL logging and syncing to disk.Reported-By: Michael PaquierAuthor: Michael Paquier and Andres FreundDiscussion: 20151210163230.GA11331@alap3.anarazel.deBackpatch: 9.1, where unlogged relations were introduced1 parent085423e commitf54d062
1 file changed
+22
-2
lines changedLines changed: 22 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
45 | 46 |
| |
46 | 47 |
| |
47 | 48 |
| |
| |||
9659 | 9660 |
| |
9660 | 9661 |
| |
9661 | 9662 |
| |
| 9663 | + | |
| 9664 | + | |
| 9665 | + | |
| 9666 | + | |
| 9667 | + | |
| 9668 | + | |
| 9669 | + | |
| 9670 | + | |
| 9671 | + | |
9662 | 9672 |
| |
9663 | 9673 |
| |
9664 | 9674 |
| |
| |||
9878 | 9888 |
| |
9879 | 9889 |
| |
9880 | 9890 |
| |
| 9891 | + | |
9881 | 9892 |
| |
9882 | 9893 |
| |
9883 | 9894 |
| |
| |||
9890 | 9901 |
| |
9891 | 9902 |
| |
9892 | 9903 |
| |
| 9904 | + | |
| 9905 | + | |
| 9906 | + | |
| 9907 | + | |
| 9908 | + | |
| 9909 | + | |
| 9910 | + | |
| 9911 | + | |
9893 | 9912 |
| |
9894 | 9913 |
| |
9895 | 9914 |
| |
9896 | 9915 |
| |
9897 |
| - | |
| 9916 | + | |
| 9917 | + | |
9898 | 9918 |
| |
9899 | 9919 |
| |
9900 | 9920 |
| |
| |||
9949 | 9969 |
| |
9950 | 9970 |
| |
9951 | 9971 |
| |
9952 |
| - | |
| 9972 | + | |
9953 | 9973 |
| |
9954 | 9974 |
| |
9955 | 9975 |
| |
|
0 commit comments
Comments
(0)