- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitbabe545
committed
Avoid leaking memory during large-scale REASSIGN OWNED BY operations.
The various ALTER OWNER routines tend to leak memory inCurrentMemoryContext. That's not a problem when they're only calledonce per command; but in this usage where we might be touching manyobjects, it can amount to a serious memory leak. Fix that by runningeach call in a short-lived context.(DROP OWNED BY likely has a similar issue, except that you'll probablyrun out of lock table space before noticing. REASSIGN is worth fixingsince for most non-table object types, it won't take any lock.)Back-patch to all supported branches. Unfortunately, in the backbranches this helps to only a limited extent, since the sinval messagequeue bloats quite a lot in this usage before commit3aafc03,consuming memory more or less comparable to what's actually leaked.Still, it's clearly a leak with a simple fix, so we might as well fix it.Justin Pryzby, per report from Guillaume LelargeDiscussion:https://postgr.es/m/CAECtzeW2DAoioEGBRjR=CzHP6TdL=yosGku8qZxfX9hhtrBB0Q@mail.gmail.com1 parent3d858af commitbabe545
1 file changed
+20
-0
lines changedLines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
65 | 65 |
| |
66 | 66 |
| |
67 | 67 |
| |
| 68 | + | |
68 | 69 |
| |
69 | 70 |
| |
70 | 71 |
| |
| |||
1497 | 1498 |
| |
1498 | 1499 |
| |
1499 | 1500 |
| |
| 1501 | + | |
| 1502 | + | |
1500 | 1503 |
| |
1501 | 1504 |
| |
1502 | 1505 |
| |
| |||
1510 | 1513 |
| |
1511 | 1514 |
| |
1512 | 1515 |
| |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
1513 | 1528 |
| |
1514 | 1529 |
| |
1515 | 1530 |
| |
| |||
1598 | 1613 |
| |
1599 | 1614 |
| |
1600 | 1615 |
| |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
1601 | 1621 |
| |
1602 | 1622 |
| |
1603 | 1623 |
| |
|
0 commit comments
Comments
(0)