forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit818fefd
committed
Fix race leading to incorrect conflict cause in InvalidatePossiblyObsoleteSlot()
The invalidation of an active slot is done in two steps:- Termination of the backend holding it, if any.- Report that the slot is obsolete, with a conflict cause depending onthe slot's data.This can be racy because between these two steps the slot mutex would bereleased while doing system calls, which means that the effective_xminand effective_catalog_xmin could advance during that time, detecting aconflict cause different than the one originally wanted before theprocess owning a slot is terminated.Holding the mutex longer is not an option, so this commit changes thecode to record the LSNs stored in the slot during the termination of theprocess owning the slot.Bonus thanks to Alexander Lakhin for the various tests and the analysis.Author: Bertrand DrouvotReviewed-by: Michael Paquier, Bharath RupireddyDiscussion:https://postgr.es/m/ZaTjW2Xh+TQUCOH0@ip-10-97-1-34.eu-west-3.compute.internalBackpatch-through: 161 parent01ec4d8 commit818fefd
1 file changed
+33
-6
lines changedLines changed: 33 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1454 | 1454 |
| |
1455 | 1455 |
| |
1456 | 1456 |
| |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
1457 | 1462 |
| |
1458 | 1463 |
| |
1459 | 1464 |
| |
| |||
1488 | 1493 |
| |
1489 | 1494 |
| |
1490 | 1495 |
| |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
1491 | 1509 |
| |
1492 | 1510 |
| |
1493 | 1511 |
| |
1494 |
| - | |
1495 |
| - | |
| 1512 | + | |
| 1513 | + | |
1496 | 1514 |
| |
1497 | 1515 |
| |
1498 | 1516 |
| |
| |||
1501 | 1519 |
| |
1502 | 1520 |
| |
1503 | 1521 |
| |
1504 |
| - | |
1505 |
| - | |
| 1522 | + | |
| 1523 | + | |
1506 | 1524 |
| |
1507 | 1525 |
| |
1508 |
| - | |
1509 |
| - | |
| 1526 | + | |
| 1527 | + | |
1510 | 1528 |
| |
1511 | 1529 |
| |
1512 | 1530 |
| |
| |||
1519 | 1537 |
| |
1520 | 1538 |
| |
1521 | 1539 |
| |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
1522 | 1547 |
| |
1523 | 1548 |
| |
1524 | 1549 |
| |
| |||
1601 | 1626 |
| |
1602 | 1627 |
| |
1603 | 1628 |
| |
| 1629 | + | |
| 1630 | + | |
1604 | 1631 |
| |
1605 | 1632 |
| |
1606 | 1633 |
| |
|
0 commit comments
Comments
(0)