forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6059946
committed
Fix assertion failure when updating stats_fetch_consistency in a transaction
An update of the GUC stats_fetch_consistency in a transaction would beable to trigger an assertion when doing cache->snapshot. In this case,when retrieving a pgstat entry after the switch, a new snapshot would berebuilt, confusing pgstat_build_snapshot() because a snapshot is alreadycached with an unexpected mode ("cache").In order to fix this problem, this commit adds a flag to force asnapshot clear each time this GUC is changed. Some tests are added tocheck, while on it.Some optimizations in avoiding the snapshot clear should be possibledepending on what is cached and the current GUC value, I guess, but thissolution is simple, and ensures that the state of the cache is updatedeach time a new pgstat entry is fetched, hence being consistent with thelevel wanted by the client that has set the GUC.Note that cache->none and snapshot->none would not cause issues, asfetching a pgstat entry would be retrieved from shared memory on thesecond attempt, however a snapshot would still be cached. Similarly,none->snapshot and none->cache would build a new snapshot on the secondfetch attempt. Finally, snapshot->cache would cache a new snapshot onthe second attempt.Reported-by: Alexander LakhinAuthor: Kyotaro HoriguchiDiscussion:https://postgr.es/m/17804-2a118cd046f2d0e5@postgresql.orgbackpatch-through: 151 parent4d47eff commit6059946
File tree
6 files changed
+118
-5
lines changed- doc/src/sgml
- src
- backend/utils
- activity
- misc
- include/utils
- test/regress
- expected
- sql
6 files changed
+118
-5
lines changedLines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8219 | 8219 |
| |
8220 | 8220 |
| |
8221 | 8221 |
| |
8222 |
| - | |
8223 |
| - | |
| 8222 | + | |
| 8223 | + | |
| 8224 | + | |
8224 | 8225 |
| |
8225 | 8226 |
| |
8226 | 8227 |
| |
|
Lines changed: 34 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
103 | 103 |
| |
104 | 104 |
| |
105 | 105 |
| |
106 |
| - | |
| 106 | + | |
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
| |||
227 | 227 |
| |
228 | 228 |
| |
229 | 229 |
| |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
230 | 237 |
| |
231 | 238 |
| |
232 | 239 |
| |
| |||
760 | 767 |
| |
761 | 768 |
| |
762 | 769 |
| |
763 |
| - | |
| 770 | + | |
| 771 | + | |
764 | 772 |
| |
765 | 773 |
| |
766 | 774 |
| |
| |||
787 | 795 |
| |
788 | 796 |
| |
789 | 797 |
| |
| 798 | + | |
| 799 | + | |
| 800 | + | |
790 | 801 |
| |
791 | 802 |
| |
792 | 803 |
| |
| |||
885 | 896 |
| |
886 | 897 |
| |
887 | 898 |
| |
| 899 | + | |
| 900 | + | |
| 901 | + | |
888 | 902 |
| |
889 | 903 |
| |
890 | 904 |
| |
| |||
929 | 943 |
| |
930 | 944 |
| |
931 | 945 |
| |
| 946 | + | |
| 947 | + | |
| 948 | + | |
932 | 949 |
| |
933 | 950 |
| |
934 | 951 |
| |
| |||
1671 | 1688 |
| |
1672 | 1689 |
| |
1673 | 1690 |
| |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + |
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4821 | 4821 |
| |
4822 | 4822 |
| |
4823 | 4823 |
| |
4824 |
| - | |
| 4824 | + | |
4825 | 4825 |
| |
4826 | 4826 |
| |
4827 | 4827 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
| 124 | + | |
124 | 125 |
| |
125 | 126 |
| |
126 | 127 |
| |
|
Lines changed: 59 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
985 | 985 |
| |
986 | 986 |
| |
987 | 987 |
| |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
988 | 1047 |
| |
989 | 1048 |
| |
990 | 1049 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
476 | 476 |
| |
477 | 477 |
| |
478 | 478 |
| |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
479 | 499 |
| |
480 | 500 |
| |
481 | 501 |
| |
|
0 commit comments
Comments
(0)