forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit73a076b
committed
Fix undercounting in VACUUM VERBOSE output.
The logic for determining how many nbtree pages in an index are deletedpages sometimes undercounted pages. Pages that were deleted by thecurrent VACUUM operation (as opposed to some previous VACUUM operationwhose deleted pages have yet to be reused) were sometimes overlooked.The final count is exposed to users through VACUUM VERBOSE's "%u indexpages have been deleted" output.btvacuumpage() avoided double-counting when _bt_pagedel() deleted morethan one page by assuming that only one page was deleted, and that theadditional deleted pages would get picked up during a future call tobtvacuumpage() by the same VACUUM operation. _bt_pagedel() canlegitimately delete pages that the btvacuumscan() scan will not visitagain, though, so that assumption was slightly faulty.Fix the accounting by teaching _bt_pagedel() about its caller'srequirements. It now only reports on pages that it knows btvacuumscan()won't visit again (including the current btvacuumpage() page), soeverything works out in the end.This bug has been around forever. Only backpatch to v11, though, tokeep _bt_pagedel() is sync on the branches that have today's bugfixcommitb0229f2. Note that this commit changes the signature of_bt_pagedel(), just like commitb0229f2.Author: Peter GeogheganReviewed-By: Masahiko SawadaDiscussion:https://postgr.es/m/CAH2-WzkrXBcMQWAYUJMFTTvzx_r4q=pYSjDe07JnUXhe+OZnJA@mail.gmail.comBackpatch: 11-1 parentb0229f2 commit73a076b
3 files changed
+38
-18
lines changedLines changed: 30 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
| 41 | + | |
41 | 42 |
| |
42 |
| - | |
| 43 | + | |
| 44 | + | |
43 | 45 |
| |
44 | 46 |
| |
45 | 47 |
| |
| |||
1489 | 1491 |
| |
1490 | 1492 |
| |
1491 | 1493 |
| |
1492 |
| - | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
1493 | 1497 |
| |
1494 | 1498 |
| |
1495 | 1499 |
| |
| |||
1499 | 1503 |
| |
1500 | 1504 |
| |
1501 | 1505 |
| |
1502 |
| - | |
| 1506 | + | |
1503 | 1507 |
| |
1504 | 1508 |
| |
1505 |
| - | |
| 1509 | + | |
1506 | 1510 |
| |
1507 | 1511 |
| |
1508 | 1512 |
| |
1509 | 1513 |
| |
1510 | 1514 |
| |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
1511 | 1521 |
| |
1512 | 1522 |
| |
1513 | 1523 |
| |
| |||
1558 | 1568 |
| |
1559 | 1569 |
| |
1560 | 1570 |
| |
1561 |
| - | |
| 1571 | + | |
1562 | 1572 |
| |
| 1573 | + | |
1563 | 1574 |
| |
1564 | 1575 |
| |
1565 | 1576 |
| |
| |||
1709 | 1720 |
| |
1710 | 1721 |
| |
1711 | 1722 |
| |
1712 |
| - | |
1713 |
| - | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
1714 | 1726 |
| |
1715 | 1727 |
| |
1716 | 1728 |
| |
1717 | 1729 |
| |
1718 |
| - | |
1719 | 1730 |
| |
1720 | 1731 |
| |
1721 | 1732 |
| |
| |||
1974 | 1985 |
| |
1975 | 1986 |
| |
1976 | 1987 |
| |
1977 |
| - | |
1978 |
| - | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
1979 | 1991 |
| |
1980 | 1992 |
| |
1981 | 1993 |
| |
| |||
2370 | 2382 |
| |
2371 | 2383 |
| |
2372 | 2384 |
| |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
2373 | 2393 |
| |
2374 | 2394 |
| |
2375 | 2395 |
| |
|
Lines changed: 6 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1362 | 1362 |
| |
1363 | 1363 |
| |
1364 | 1364 |
| |
1365 |
| - | |
1366 | 1365 |
| |
1367 | 1366 |
| |
1368 | 1367 |
| |
1369 | 1368 |
| |
1370 | 1369 |
| |
1371 |
| - | |
1372 |
| - | |
1373 |
| - | |
1374 |
| - | |
1375 |
| - | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
1376 | 1376 |
| |
1377 | 1377 |
| |
1378 | 1378 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1080 | 1080 |
| |
1081 | 1081 |
| |
1082 | 1082 |
| |
1083 |
| - | |
1084 |
| - | |
| 1083 | + | |
| 1084 | + | |
1085 | 1085 |
| |
1086 | 1086 |
| |
1087 | 1087 |
| |
|
0 commit comments
Comments
(0)