forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf841ceb
committed
Improve TRUNCATE by avoiding early lock queue
A caller of TRUNCATE could previously queue for an access exclusive lockon a relation it may not have permission to truncate, potentiallyinterfering with users authorized to work on it. This can be veryintrusive depending on the lock attempted to be taken. For example,pg_authid could be blocked, preventing any authentication attempt tohappen on a PostgreSQL instance.This commit fixes the case of TRUNCATE so as RangeVarGetRelidExtended isused with a callback doing the necessary ACL checks at an earlier stage,avoiding lock queuing issues, so as an immediate failure happens forunprivileged users instead of waiting on a lock that would not betaken.This is rather similar to the type of work done incbe24a6 for CLUSTER,and the code of TRUNCATE is this time refactored so as there is nouser-facing changes. As the commit for CLUSTER, no back-patch is done.Reported-by: Lloyd Albin, Jeremy SchneiderAuthor: Michael PaquierReviewed by: Nathan Bossart, Kyotaro HoriguchiDiscussion:https://postgr.es/m/152512087100.19803.12733865831237526317@wrigleys.postgresql.orgDiscussion:https://postgr.es/m/20180806165816.GA19883@paquier.xyz1 parent2b13702 commitf841ceb
File tree
4 files changed
+204
-18
lines changed- src
- backend/commands
- test/isolation
- expected
- specs
4 files changed
+204
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
| |||
1336 | 1339 | | |
1337 | 1340 | | |
1338 | 1341 | | |
1339 | | - | |
1340 | | - | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
1341 | 1349 | | |
1342 | 1350 | | |
1343 | 1351 | | |
1344 | 1352 | | |
1345 | 1353 | | |
1346 | 1354 | | |
1347 | | - | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
1348 | 1362 | | |
1349 | 1363 | | |
1350 | 1364 | | |
| |||
1367 | 1381 | | |
1368 | 1382 | | |
1369 | 1383 | | |
1370 | | - | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
1371 | 1387 | | |
1372 | 1388 | | |
1373 | 1389 | | |
| |||
1450 | 1466 | | |
1451 | 1467 | | |
1452 | 1468 | | |
1453 | | - | |
| 1469 | + | |
| 1470 | + | |
1454 | 1471 | | |
1455 | 1472 | | |
1456 | 1473 | | |
| |||
1700 | 1717 | | |
1701 | 1718 | | |
1702 | 1719 | | |
1703 | | - | |
| 1720 | + | |
| 1721 | + | |
1704 | 1722 | | |
1705 | 1723 | | |
1706 | | - | |
| 1724 | + | |
1707 | 1725 | | |
1708 | 1726 | | |
| 1727 | + | |
1709 | 1728 | | |
1710 | 1729 | | |
1711 | 1730 | | |
1712 | 1731 | | |
1713 | 1732 | | |
1714 | 1733 | | |
1715 | | - | |
1716 | | - | |
| 1734 | + | |
| 1735 | + | |
1717 | 1736 | | |
1718 | 1737 | | |
1719 | | - | |
1720 | | - | |
| 1738 | + | |
1721 | 1739 | | |
1722 | 1740 | | |
1723 | | - | |
1724 | | - | |
| 1741 | + | |
1725 | 1742 | | |
1726 | | - | |
1727 | | - | |
| 1743 | + | |
| 1744 | + | |
1728 | 1745 | | |
1729 | | - | |
| 1746 | + | |
1730 | 1747 | | |
1731 | 1748 | | |
1732 | 1749 | | |
1733 | | - | |
| 1750 | + | |
| 1751 | + | |
1734 | 1752 | | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
1735 | 1761 | | |
1736 | 1762 | | |
1737 | 1763 | | |
| |||
13419 | 13445 | | |
13420 | 13446 | | |
13421 | 13447 | | |
| 13448 | + | |
| 13449 | + | |
| 13450 | + | |
| 13451 | + | |
| 13452 | + | |
| 13453 | + | |
| 13454 | + | |
| 13455 | + | |
| 13456 | + | |
| 13457 | + | |
| 13458 | + | |
| 13459 | + | |
| 13460 | + | |
| 13461 | + | |
| 13462 | + | |
| 13463 | + | |
| 13464 | + | |
| 13465 | + | |
| 13466 | + | |
| 13467 | + | |
| 13468 | + | |
| 13469 | + | |
13422 | 13470 | | |
13423 | 13471 | | |
13424 | 13472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 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 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments
Comments
(0)