forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit722acf5
committed
Handle wraparound during truncation in multixact/members
In pg_multixact/members, relying on modulo-2^32 arithmetic forwraparound handling doesn't work all that well. Because we don'texplicitely track wraparound of the allocation counter for members, itis possible that the "live" area exceeds 2^31 entries; trying to removeSLRU segments that are "old" according to the original logic might leadto removal of segments still in use. To fix, have the truncationroutine use a tailored SlruScanDirectory callback that keeps track ofthe live area in actual use; that way, when the live range exceeds 2^31entries, the oldest segments still live will not get removed untimely.This new SlruScanDir callback needs to take care not to remove segmentsthat are "in the future": if new SLRU segments appear while thetruncation is ongoing, make sure we don't remove them. This requiresexamination of shared memory state to recheck for false positives, buttesting suggests that this doesn't cause a problem. The original codingdidn't suffer from this pitfall because segments created when truncationis running are never considered to be removable.Per Andres Freund's investigation of bug #8673 reported by SergeNegodyuck.1 parent3cff187 commit722acf5
File tree
3 files changed
+104
-18
lines changed- src
- backend/access/transam
- include/access
3 files changed
+104
-18
lines changedLines changed: 85 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
577 | 577 |
| |
578 | 578 |
| |
579 | 579 |
| |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
580 | 585 |
| |
581 |
| - | |
| 586 | + | |
582 | 587 |
| |
583 | 588 |
| |
584 | 589 |
| |
| |||
1559 | 1564 |
| |
1560 | 1565 |
| |
1561 | 1566 |
| |
1562 |
| - | |
| 1567 | + | |
1563 | 1568 |
| |
1564 | 1569 |
| |
1565 | 1570 |
| |
| |||
2335 | 2340 |
| |
2336 | 2341 |
| |
2337 | 2342 |
| |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
2338 | 2402 |
| |
2339 | 2403 |
| |
2340 | 2404 |
| |
| |||
2376 | 2440 |
| |
2377 | 2441 |
| |
2378 | 2442 |
| |
| 2443 | + | |
2379 | 2444 |
| |
2380 | 2445 |
| |
| 2446 | + | |
2381 | 2447 |
| |
2382 | 2448 |
| |
2383 | 2449 |
| |
| |||
2424 | 2490 |
| |
2425 | 2491 |
| |
2426 | 2492 |
| |
2427 |
| - | |
2428 |
| - | |
2429 |
| - | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
2430 | 2510 |
| |
2431 | 2511 |
| |
2432 | 2512 |
| |
|
Lines changed: 18 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1210 | 1210 |
| |
1211 | 1211 |
| |
1212 | 1212 |
| |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
1213 | 1224 |
| |
1214 | 1225 |
| |
1215 | 1226 |
| |
| |||
1235 | 1246 |
| |
1236 | 1247 |
| |
1237 | 1248 |
| |
1238 |
| - | |
1239 | 1249 |
| |
1240 | 1250 |
| |
1241 | 1251 |
| |
1242 |
| - | |
1243 |
| - | |
1244 |
| - | |
1245 |
| - | |
1246 |
| - | |
1247 |
| - | |
| 1252 | + | |
1248 | 1253 |
| |
1249 | 1254 |
| |
1250 | 1255 |
| |
| |||
1256 | 1261 |
| |
1257 | 1262 |
| |
1258 | 1263 |
| |
1259 |
| - | |
1260 |
| - | |
1261 |
| - | |
1262 |
| - | |
1263 |
| - | |
1264 |
| - | |
| 1264 | + | |
1265 | 1265 |
| |
1266 | 1266 |
| |
1267 | 1267 |
| |
| |||
1272 | 1272 |
| |
1273 | 1273 |
| |
1274 | 1274 |
| |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
1275 | 1280 |
| |
1276 | 1281 |
| |
1277 | 1282 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
150 | 150 |
| |
151 | 151 |
| |
152 | 152 |
| |
| 153 | + | |
153 | 154 |
| |
154 | 155 |
| |
155 | 156 |
| |
|
0 commit comments
Comments
(0)