- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit28d3c2d
committed
Fix another bug in parent page splitting during GiST index build.
Yet another bug in the ilk of commitsa7ee7c8 and741b884. In741b884, we took care to clear the memorized location of thedownlink when we split the parent page, because splitting the parentpage can move the downlink. But we missed that even *updating* a tupleon the parent can move it, because updating a tuple on a gist page isimplemented as a delete+insert, so the updated tuple gets moved to theend of the page.This commit fixes the bug in two different ways (belt and suspenders):1. Clear the downlink when we update a tuple on the parent page, even if it's not split. This the same approach as in commitsa7ee7c8 and741b884. I also noticed that gistFindCorrectParent did not clear the 'downlinkoffnum' when it stepped to the right sibling. Fix that too, as it seems like a clear bug even though I haven't been able to find a test case to hit that.2. Change gistFindCorrectParent so that it treats 'downlinkoffnum' merely as a hint. It now always first checks if the downlink is still at that location, and if not, it scans the page like before. That's more robust if there are still more cases where we fail to clear 'downlinkoffnum' that we haven't yet uncovered. With this, it's no longer necessary to meticulously clear 'downlinkoffnum', so this makes the previous fixes unnecessary, but I didn't revert them because it still seems nice to clear it when we know that the downlink has moved.Also add the test case using the same test data that Alexanderposted. I tried to reduce it to a smaller test, and I also tried toreproduce this with different test data, but I was not able to, solet's just include what we have.Backpatch to v12, like the previous fixes.Reported-by: Alexander LakhinDiscussion:https://www.postgresql.org/message-id/18129-caca016eaf0c3702@postgresql.org1 parent64b7876 commit28d3c2d
3 files changed
+226
-80
lines changedLines changed: 91 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
876 | 876 |
| |
877 | 877 |
| |
878 | 878 |
| |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
879 | 970 |
|
Lines changed: 35 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
195 | 195 |
| |
196 | 196 |
| |
197 | 197 |
| |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
198 | 233 |
|
Lines changed: 100 additions & 80 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1018 | 1018 |
| |
1019 | 1019 |
| |
1020 | 1020 |
| |
1021 |
| - | |
| 1021 | + | |
1022 | 1022 |
| |
1023 | 1023 |
| |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
1024 | 1028 |
| |
1025 | 1029 |
| |
1026 | 1030 |
| |
| 1031 | + | |
1027 | 1032 |
| |
1028 |
| - | |
1029 |
| - | |
1030 |
| - | |
| 1033 | + | |
| 1034 | + | |
1031 | 1035 |
| |
1032 |
| - | |
1033 |
| - | |
1034 |
| - | |
1035 |
| - | |
1036 |
| - | |
1037 |
| - | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1038 | 1041 |
| |
1039 |
| - | |
1040 |
| - | |
1041 |
| - | |
1042 |
| - | |
1043 |
| - | |
1044 |
| - | |
1045 |
| - | |
1046 |
| - | |
1047 |
| - | |
1048 |
| - | |
1049 |
| - | |
1050 |
| - | |
1051 |
| - | |
1052 |
| - | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
1053 | 1060 |
| |
1054 |
| - | |
1055 |
| - | |
1056 |
| - | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
1057 | 1067 |
| |
1058 |
| - | |
1059 |
| - | |
1060 |
| - | |
1061 |
| - | |
1062 |
| - | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1063 | 1071 |
| |
1064 |
| - | |
1065 |
| - | |
1066 |
| - | |
1067 |
| - | |
1068 | 1072 |
| |
1069 | 1073 |
| |
1070 |
| - | |
1071 |
| - | |
1072 |
| - | |
1073 |
| - | |
1074 |
| - | |
1075 |
| - | |
1076 |
| - | |
1077 |
| - | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
1078 | 1078 |
| |
1079 |
| - | |
1080 |
| - | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1081 | 1084 |
| |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
1082 | 1090 |
| |
1083 |
| - | |
1084 |
| - | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
1085 | 1095 |
| |
1086 |
| - | |
1087 |
| - | |
1088 |
| - | |
1089 |
| - | |
1090 |
| - | |
1091 |
| - | |
1092 |
| - | |
1093 |
| - | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1094 | 1102 |
| |
1095 |
| - | |
1096 |
| - | |
| 1103 | + | |
| 1104 | + | |
1097 | 1105 |
| |
1098 |
| - | |
1099 |
| - | |
1100 |
| - | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
1101 | 1113 |
| |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1102 | 1121 |
| |
1103 | 1122 |
| |
1104 | 1123 |
| |
1105 | 1124 |
| |
1106 | 1125 |
| |
1107 | 1126 |
| |
1108 | 1127 |
| |
1109 |
| - | |
| 1128 | + | |
1110 | 1129 |
| |
1111 | 1130 |
| |
1112 | 1131 |
| |
| |||
1147 | 1166 |
| |
1148 | 1167 |
| |
1149 | 1168 |
| |
1150 |
| - | |
| 1169 | + | |
1151 | 1170 |
| |
1152 | 1171 |
| |
1153 | 1172 |
| |
| |||
1193 | 1212 |
| |
1194 | 1213 |
| |
1195 | 1214 |
| |
1196 |
| - | |
| 1215 | + | |
1197 | 1216 |
| |
1198 | 1217 |
| |
1199 | 1218 |
| |
| |||
1347 | 1366 |
| |
1348 | 1367 |
| |
1349 | 1368 |
| |
1350 |
| - | |
| 1369 | + | |
1351 | 1370 |
| |
1352 | 1371 |
| |
1353 | 1372 |
| |
| |||
1372 | 1391 |
| |
1373 | 1392 |
| |
1374 | 1393 |
| |
1375 |
| - | |
1376 |
| - | |
1377 |
| - | |
1378 |
| - | |
1379 |
| - | |
1380 |
| - | |
1381 |
| - | |
1382 |
| - | |
1383 |
| - | |
1384 |
| - | |
1385 |
| - | |
1386 |
| - | |
1387 |
| - | |
1388 |
| - | |
1389 |
| - | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1390 | 1410 |
| |
1391 | 1411 |
| |
1392 | 1412 |
| |
|
0 commit comments
Comments
(0)