forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdb6736c
committed
Fix memory leak in indexUnchanged hint mechanism.
Commit9dc718b added a "logically unchanged by UPDATE" hintingmechanism, which is currently used within nbtree indexes only (seecommitd168b66). This mechanism determined whether or not the incomingitem is a logically unchanged duplicate (a duplicate needed only forMVCC versioning purposes) once per row updated per non-HOT update. Thisapproach led to memory leaks which were noticeable with an UPDATEstatement that updated sufficiently many rows, at least on tables thathappen to have an expression index.On HEAD, fix the issue by adding a cache to the executor's per-indexIndexInfo struct.Take a different approach on Postgres 14 to avoid an ABI break: simplypass down the hint to all indexes unconditionally with non-HOT UPDATEs.This is deemed acceptable because the hint is currently interpretedwithin btinsert() as "perform a bottom-up index deletion pass if andwhen the only alternative is splitting the leaf page -- prefer to deleteany LP_DEAD-set items first". nbtree must always treat the hint as anoisy signal about what might work, as a strategy of last resort, withcosts imposed on non-HOT updaters. (The same thing might not be truewithin another index AM that applies the hint, which is why the originalbehavior is preserved on HEAD.)Author: Peter Geoghegan <pg@bowt.ie>Reported-By: Klaudie Willis <Klaudie.Willis@protonmail.com>Diagnosed-By: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/261065.1639497535@sss.pgh.pa.usBackpatch: 14-, where the hinting mechanism was added.1 parente9b873f commitdb6736c
File tree
4 files changed
+37
-2
lines changed- src
- backend
- catalog
- executor
- nodes
- include/nodes
4 files changed
+37
-2
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
302 | 302 |
| |
303 | 303 |
| |
304 | 304 |
| |
| 305 | + | |
| 306 | + | |
305 | 307 |
| |
306 | 308 |
| |
307 | 309 |
| |
|
Lines changed: 29 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
935 | 935 |
| |
936 | 936 |
| |
937 | 937 |
| |
938 |
| - | |
939 |
| - | |
| 938 | + | |
| 939 | + | |
940 | 940 |
| |
941 | 941 |
| |
942 | 942 |
| |
943 | 943 |
| |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
944 | 951 |
| |
945 | 952 |
| |
946 | 953 |
| |
947 | 954 |
| |
948 | 955 |
| |
949 | 956 |
| |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
950 | 961 |
| |
| 962 | + | |
| 963 | + | |
951 | 964 |
| |
952 | 965 |
| |
953 | 966 |
| |
| |||
968 | 981 |
| |
969 | 982 |
| |
970 | 983 |
| |
| 984 | + | |
971 | 985 |
| |
972 | 986 |
| |
973 | 987 |
| |
| |||
981 | 995 |
| |
982 | 996 |
| |
983 | 997 |
| |
| 998 | + | |
| 999 | + | |
984 | 1000 |
| |
| 1001 | + | |
985 | 1002 |
| |
986 | 1003 |
| |
987 | 1004 |
| |
| |||
1008 | 1025 |
| |
1009 | 1026 |
| |
1010 | 1027 |
| |
| 1028 | + | |
| 1029 | + | |
1011 | 1030 |
| |
| 1031 | + | |
1012 | 1032 |
| |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
1013 | 1040 |
| |
1014 | 1041 |
| |
1015 | 1042 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
751 | 751 |
| |
752 | 752 |
| |
753 | 753 |
| |
| 754 | + | |
| 755 | + | |
754 | 756 |
| |
755 | 757 |
| |
756 | 758 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
142 | 142 |
| |
143 | 143 |
| |
144 | 144 |
| |
| 145 | + | |
| 146 | + | |
145 | 147 |
| |
146 | 148 |
| |
147 | 149 |
| |
| |||
172 | 174 |
| |
173 | 175 |
| |
174 | 176 |
| |
| 177 | + | |
| 178 | + | |
175 | 179 |
| |
176 | 180 |
| |
177 | 181 |
| |
|
0 commit comments
Comments
(0)