- Notifications
You must be signed in to change notification settings - Fork5
Commit89fd41b
committed
Fix and improve cache invalidation logic for logical decoding.
There are basically three situations in which logical decoding needsto perform cache invalidation. During/After replaying a transactionwith catalog changes, when skipping a uninteresting transaction thatperformed catalog changes and when erroring out while replaying atransaction. Unfortunately these three cases were all done slightlydifferently - partially because8de3e41, which greatly simplifiesmatters, got committed in the midst of the development of logicaldecoding.The actually problematic case was when logical decoding skippedtransaction commits (and thus processed invalidations). When used viathe SQL interface cache invalidation could access the catalog - bad,because we didn't set up enough state to allow that correctly. It'dnot be hard to setup sufficient state, but the simpler solution is toalways perform cache invalidation outside a valid transaction.Also make the different cache invalidation cases look as similar aspossible, to ease code review.This fixes the assertion failure reported by Antonin Houska in53EE02D9.7040702@gmail.com. The presented testcase has been expandedinto a regression test.Backpatch to 9.4, where logical decoding was introduced.1 parent5a2c184 commit89fd41b
File tree
4 files changed
+152
-42
lines changed- contrib/test_decoding
- expected
- sql
- src/backend/replication/logical
4 files changed
+152
-42
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 |
| - | |
| 40 | + | |
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
|
Lines changed: 84 additions & 0 deletions
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 | + |
Lines changed: 27 additions & 0 deletions
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 | + |
Lines changed: 40 additions & 41 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1264 | 1264 |
| |
1265 | 1265 |
| |
1266 | 1266 |
| |
1267 |
| - | |
1268 |
| - | |
| 1267 | + | |
1269 | 1268 |
| |
1270 | 1269 |
| |
1271 | 1270 |
| |
| |||
1305 | 1304 |
| |
1306 | 1305 |
| |
1307 | 1306 |
| |
1308 |
| - | |
1309 | 1307 |
| |
1310 | 1308 |
| |
1311 | 1309 |
| |
| |||
1317 | 1315 |
| |
1318 | 1316 |
| |
1319 | 1317 |
| |
1320 |
| - | |
1321 |
| - | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
1322 | 1321 |
| |
1323 |
| - | |
1324 |
| - | |
1325 | 1322 |
| |
1326 |
| - | |
1327 | 1323 |
| |
1328 |
| - | |
1329 |
| - | |
1330 | 1324 |
| |
1331 | 1325 |
| |
1332 | 1326 |
| |
| |||
1489 | 1483 |
| |
1490 | 1484 |
| |
1491 | 1485 |
| |
1492 |
| - | |
1493 |
| - | |
1494 |
| - | |
1495 | 1486 |
| |
1496 | 1487 |
| |
1497 | 1488 |
| |
1498 | 1489 |
| |
1499 |
| - | |
| 1490 | + | |
1500 | 1491 |
| |
1501 | 1492 |
| |
1502 | 1493 |
| |
1503 | 1494 |
| |
1504 |
| - | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
1505 | 1501 |
| |
1506 |
| - | |
1507 |
| - | |
1508 | 1502 |
| |
1509 | 1503 |
| |
1510 | 1504 |
| |
| |||
1520 | 1514 |
| |
1521 | 1515 |
| |
1522 | 1516 |
| |
1523 |
| - | |
1524 |
| - | |
1525 |
| - | |
1526 |
| - | |
1527 |
| - | |
1528 |
| - | |
1529 |
| - | |
1530 |
| - | |
1531 | 1517 |
| |
1532 |
| - | |
1533 |
| - | |
| 1518 | + | |
| 1519 | + | |
1534 | 1520 |
| |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
1535 | 1524 |
| |
1536 | 1525 |
| |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
1537 | 1532 |
| |
1538 | 1533 |
| |
1539 | 1534 |
| |
| |||
1645 | 1640 |
| |
1646 | 1641 |
| |
1647 | 1642 |
| |
1648 |
| - | |
1649 |
| - | |
1650 |
| - | |
1651 |
| - | |
1652 |
| - | |
1653 |
| - | |
1654 |
| - | |
1655 |
| - | |
1656 |
| - | |
1657 |
| - | |
1658 |
| - | |
1659 |
| - | |
1660 |
| - | |
1661 |
| - | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
1662 | 1661 |
| |
1663 | 1662 |
| |
1664 | 1663 |
| |
|
0 commit comments
Comments
(0)