forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite85662d
committed
Fix false reports in pg_visibility
Currently, pg_visibility computes its xid horizon using theGetOldestNonRemovableTransactionId(). The problem is that this horizon cansometimes go backward. That can lead to reporting false errors.In order to fix that, this commit implements a new functionGetStrictOldestNonRemovableTransactionId(). This function computes the xidhorizon, which would be guaranteed to be newer or equal to any xid horizoncomputed before.We have to do the following to achieve this.1. Ignore processes xmin's, because they consider connection to other databases that were ignored before.2. Ignore KnownAssignedXids, because they are not database-aware. At the same time, the primary could compute its horizons database-aware.3. Ignore walsender xmin, because it could go backward if some replication connections don't use replication slots.As a result, we're using only currently running xids to compute the horizon.Surely these would significantly sacrifice accuracy. But we have to do so toavoid reporting false errors.Inspired by earlier patch by Daniel Shelepanov and the following discussionwith Robert Haas and Tom Lane.Discussion:https://postgr.es/m/1649062270.289865713%40f403.i.mail.ruReviewed-by: Alexander Lakhin, Dmitry Koval1 parentcc6e64a commite85662d
File tree
6 files changed
+129
-6
lines changed- contrib/pg_visibility
- t
- src
- backend/storage/ipc
- include/storage
6 files changed
+129
-6
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| 14 | + | |
14 | 15 |
| |
15 | 16 |
| |
16 | 17 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 |
| |
36 | 40 |
|
Lines changed: 63 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
| 22 | + | |
22 | 23 |
| |
23 | 24 |
| |
24 | 25 |
| |
| |||
532 | 533 |
| |
533 | 534 |
| |
534 | 535 |
| |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
535 | 593 |
| |
536 | 594 |
| |
537 | 595 |
| |
| |||
563 | 621 |
| |
564 | 622 |
| |
565 | 623 |
| |
566 |
| - | |
| 624 | + | |
567 | 625 |
| |
568 | 626 |
| |
569 | 627 |
| |
| |||
671 | 729 |
| |
672 | 730 |
| |
673 | 731 |
| |
674 |
| - | |
675 |
| - | |
676 |
| - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
677 | 735 |
| |
678 |
| - | |
| 736 | + | |
679 | 737 |
| |
680 | 738 |
| |
681 | 739 |
| |
|
Lines changed: 47 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 | + |
Lines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2688 | 2688 |
| |
2689 | 2689 |
| |
2690 | 2690 |
| |
| 2691 | + | |
2691 | 2692 |
| |
2692 | 2693 |
| |
2693 | 2694 |
| |
| |||
2732 | 2733 |
| |
2733 | 2734 |
| |
2734 | 2735 |
| |
2735 |
| - | |
| 2736 | + | |
2736 | 2737 |
| |
2737 | 2738 |
| |
2738 | 2739 |
| |
2739 | 2740 |
| |
2740 | 2741 |
| |
2741 | 2742 |
| |
2742 | 2743 |
| |
| 2744 | + | |
| 2745 | + | |
2743 | 2746 |
| |
2744 | 2747 |
| |
2745 | 2748 |
| |
| |||
2760 | 2763 |
| |
2761 | 2764 |
| |
2762 | 2765 |
| |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
2763 | 2773 |
| |
2764 | 2774 |
| |
2765 | 2775 |
| |
| |||
2826 | 2836 |
| |
2827 | 2837 |
| |
2828 | 2838 |
| |
| 2839 | + | |
2829 | 2840 |
| |
2830 | 2841 |
| |
2831 | 2842 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
| 85 | + | |
| 86 | + | |
85 | 87 |
| |
86 | 88 |
| |
87 | 89 |
| |
|
0 commit comments
Comments
(0)