forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1a2c17f
committed
Fix pg_upgrade to not fail when new-cluster TOAST rules differ from old.
This patch essentially reverts commit4c6780f, in favor of a muchsimpler solution for the case where the new cluster would choose to createa TOAST table but the old cluster doesn't have one: just don't create aTOAST table.The existing code failed in at least two different ways if the situationarose: (1) ALTER TABLE RESET didn't grab an exclusive lock, so that thelock sanity check in create_toast_table failed; (2) pg_upgrade did notprovide a pg_type OID for the new toast table, so that the crosscheck inTypeCreate failed. While both these problems were introduced by laterpatches, they show that the hack being used to cause TOAST table creationis overwhelmingly fragile (and untested). I also note that before theTypeCreate crosscheck was added, the code would have resulted in assigningan indeterminate pg_type OID to the toast table, possibly causing a laterOID conflict in that catalog; so that it didn't really work even whencommitted.If we simply don't create a TOAST table, there will only be a problem ifthe code tries to store a tuple that's wider than a page, and fieldcompression isn't sufficient to get it under a page. Given that the TOASTcreation threshold is intended to be about a quarter of a page, it's veryhard to believe that cross-version differences in the do-we-need-a-toast-table heuristic could result in an observable problem. So let's justfollow the old version's conclusion about whether a TOAST table is needed.(If we ever do change needs_toast_table() so much that this conclusiondoesn't apply, we can devise a solution at that time, and hopefully doit in a less klugy way than4c6780f did.)Back-patch to 9.3, like the previous patch.Discussion: <8110.1462291671@sss.pgh.pa.us>1 parent0f97c72 commit1a2c17f
File tree
5 files changed
+22
-111
lines changed- src
- backend/catalog
- bin/pg_upgrade
- include/catalog
5 files changed
+22
-111
lines changedLines changed: 21 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
166 | 166 |
| |
167 | 167 |
| |
168 | 168 |
| |
| 169 | + | |
| 170 | + | |
| 171 | + | |
169 | 172 |
| |
170 | 173 |
| |
| 174 | + | |
171 | 175 |
| |
172 | 176 |
| |
173 | 177 |
| |
174 | 178 |
| |
175 | 179 |
| |
176 | 180 |
| |
177 |
| - | |
| 181 | + | |
| 182 | + | |
178 | 183 |
| |
179 |
| - | |
180 |
| - | |
181 |
| - | |
182 |
| - | |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
190 | 197 |
| |
191 |
| - | |
| 198 | + | |
| 199 | + | |
192 | 200 |
| |
193 |
| - | |
194 |
| - | |
195 |
| - | |
196 |
| - | |
197 |
| - | |
198 |
| - | |
199 |
| - | |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 |
| - | |
207 |
| - | |
208 |
| - | |
209 |
| - | |
210 |
| - | |
211 |
| - | |
212 |
| - | |
213 | 201 |
| |
214 | 202 |
| |
215 | 203 |
| |
|
Lines changed: 0 additions & 69 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 |
| - | |
16 | 15 |
| |
17 | 16 |
| |
18 | 17 |
| |
| |||
69 | 68 |
| |
70 | 69 |
| |
71 | 70 |
| |
72 |
| - | |
73 |
| - | |
74 |
| - | |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
81 |
| - | |
82 |
| - | |
83 |
| - | |
84 |
| - | |
85 |
| - | |
86 |
| - | |
87 |
| - | |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
117 |
| - | |
118 |
| - | |
119 |
| - | |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
124 |
| - | |
125 |
| - | |
126 |
| - | |
127 |
| - | |
128 |
| - | |
129 |
| - | |
130 |
| - | |
131 |
| - | |
132 |
| - | |
133 |
| - | |
134 |
| - | |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
139 |
| - |
Lines changed: 1 addition & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
332 | 332 |
| |
333 | 333 |
| |
334 | 334 |
| |
335 |
| - | |
| 335 | + | |
336 | 336 |
| |
337 | 337 |
| |
338 | 338 |
| |
339 | 339 |
| |
340 |
| - | |
341 |
| - | |
342 | 340 |
| |
343 | 341 |
| |
344 | 342 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
353 | 353 |
| |
354 | 354 |
| |
355 | 355 |
| |
356 |
| - | |
357 | 356 |
| |
358 | 357 |
| |
359 | 358 |
| |
|
Lines changed: 0 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 |
| - | |
18 |
| - | |
19 |
| - | |
20 |
| - | |
21 |
| - | |
22 | 17 |
| |
23 | 18 |
| |
24 | 19 |
| |
|
0 commit comments
Comments
(0)