forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcd4868a
committed
pageinspect: Fix handling of all-zero pages
Getting from get_raw_page() an all-zero page is considered as a validcase by the buffer manager and it can happen for example when finding acorrupted page with zero_damaged_pages enabled (using zero_damaged_pagesto look at corrupted pages happens), or after a crash when a relationfile is extended before any WAL for its new data is generated (before avacuum or autovacuum job comes in to do some cleanup).However, all the functions of pageinspect, as of the index AMs (excepthash that has its own idea of new pages), heap, the FSM or the pageheader have never worked with all-zero pages, causing various crasheswhen going through the page internals.This commit changes all the pageinspect functions to be compliant withall-zero pages, where the choice is made to return NULL or no rows forSRFs when finding a new page. get_raw_page() still works the same way,returning a batch of zeros in the bytea of the page retrieved. A harderror could be used but NULL, while more invasive, is useful whenscanning relation files in full to get a batch of results for a singlerelation in one query. Tests are added for all the code pathsimpacted.Reported-by: Daria LepikhovaAuthor: Michael PaquierDiscussion:https://postgr.es/m/561e187b-3549-c8d5-03f5-525c14e65bd0@postgrespro.ruBackpatch-through: 101 parenta00fd06 commitcd4868a
File tree
18 files changed
+191
-0
lines changed- contrib/pageinspect
- expected
- sql
18 files changed
+191
-0
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| 61 | + | |
| 62 | + | |
| 63 | + | |
61 | 64 |
| |
62 | 65 |
| |
63 | 66 |
| |
| |||
95 | 98 |
| |
96 | 99 |
| |
97 | 100 |
| |
| 101 | + | |
| 102 | + | |
| 103 | + | |
98 | 104 |
| |
99 | 105 |
| |
100 | 106 |
| |
| |||
156 | 162 |
| |
157 | 163 |
| |
158 | 164 |
| |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
159 | 172 |
| |
160 | 173 |
| |
161 | 174 |
| |
| |||
331 | 344 |
| |
332 | 345 |
| |
333 | 346 |
| |
| 347 | + | |
| 348 | + | |
| 349 | + | |
334 | 350 |
| |
335 | 351 |
| |
336 | 352 |
| |
| |||
382 | 398 |
| |
383 | 399 |
| |
384 | 400 |
| |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
385 | 407 |
| |
386 | 408 |
| |
387 | 409 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
611 | 611 |
| |
612 | 612 |
| |
613 | 613 |
| |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
614 | 620 |
| |
615 | 621 |
| |
616 | 622 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
62 | 62 |
| |
63 | 63 |
| |
64 | 64 |
| |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
65 | 90 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
99 | 99 |
| |
100 | 100 |
| |
101 | 101 |
| |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
102 | 108 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
54 | 54 |
| |
55 | 55 |
| |
56 | 56 |
| |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
57 | 71 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
87 | 87 |
| |
88 | 88 |
| |
89 | 89 |
| |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
90 | 108 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
190 | 190 |
| |
191 | 191 |
| |
192 | 192 |
| |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
193 | 205 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
218 | 218 |
| |
219 | 219 |
| |
220 | 220 |
| |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
46 | 46 |
| |
47 | 47 |
| |
48 | 48 |
| |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
49 | 53 |
| |
50 | 54 |
| |
51 | 55 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 |
| |
53 | 56 |
| |
54 | 57 |
| |
| |||
58 | 61 |
| |
59 | 62 |
| |
60 | 63 |
| |
| 64 | + | |
61 | 65 |
| |
62 | 66 |
| |
63 | 67 |
| |
| |||
115 | 119 |
| |
116 | 120 |
| |
117 | 121 |
| |
| 122 | + | |
| 123 | + | |
| 124 | + | |
118 | 125 |
| |
119 | 126 |
| |
120 | 127 |
| |
| |||
200 | 207 |
| |
201 | 208 |
| |
202 | 209 |
| |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
203 | 216 |
| |
204 | 217 |
| |
205 | 218 |
| |
|
0 commit comments
Comments
(0)