- Notifications
You must be signed in to change notification settings - Fork5.3k
Commitbc32a12
committed
Fix infer_arbiter_index during concurrent index operations
Previously, we would only consider indexes marked indisvalid as usablefor INSERT ON CONFLICT. But that's problematic during CREATE INDEXCONCURRENTLY and REINDEX CONCURRENTLY, because concurrent transactionswould end up with inconsistents lists of inferred indexes, leading todeadlocks and spurious errors about unique key violations (because twotransactions are operating on different indexes for the speculativeinsertion tokens). Change this function to return indexes even ifinvalid. This fixes the spurious errors and deadlocks.Because such indexes might not be complete, we still need uniqueness tobe verified in a different way. We do that by requiring that at leastone index marked valid is part of the set of indexes returned. It isthat index that is going to help ensure that the inserted tuple isindeed unique.This does not fix similar problems occurring with partitioned tables orwith named constraints. These problems will be fixed in follow-upcommits.We have no user report of this problem, even though it exists in allbranches. Because of that and given that the fix is somewhat tricky, Idecided not to backpatch for now.Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>Reviewed-by: Michael Paquier <michael@paquier.xyz>Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>Discussion:https://postgr.es/m/CANtu0ogv+6wqRzPK241jik4U95s1pW3MCZ3rX5ZqbFdUysz7Qw@mail.gmail.com1 parente429c3c commitbc32a12
File tree
14 files changed
+749
-8
lines changed- src
- backend
- commands
- executor
- optimizer/util
- utils/time
- test/modules/injection_points
- expected
- specs
14 files changed
+749
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1789 | 1789 | | |
1790 | 1790 | | |
1791 | 1791 | | |
| 1792 | + | |
1792 | 1793 | | |
1793 | 1794 | | |
1794 | 1795 | | |
| |||
4229 | 4230 | | |
4230 | 4231 | | |
4231 | 4232 | | |
| 4233 | + | |
4232 | 4234 | | |
4233 | 4235 | | |
4234 | 4236 | | |
| |||
4307 | 4309 | | |
4308 | 4310 | | |
4309 | 4311 | | |
| 4312 | + | |
4310 | 4313 | | |
4311 | 4314 | | |
4312 | 4315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
943 | 944 | | |
944 | 945 | | |
945 | 946 | | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
946 | 954 | | |
947 | 955 | | |
948 | 956 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
725 | | - | |
726 | | - | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
727 | 728 | | |
728 | 729 | | |
729 | 730 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
1186 | 1187 | | |
1187 | 1188 | | |
1188 | 1189 | | |
| 1190 | + | |
1189 | 1191 | | |
1190 | 1192 | | |
1191 | 1193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
| 817 | + | |
817 | 818 | | |
818 | 819 | | |
819 | 820 | | |
| |||
907 | 908 | | |
908 | 909 | | |
909 | 910 | | |
910 | | - | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
911 | 927 | | |
912 | 928 | | |
913 | 929 | | |
| |||
929 | 945 | | |
930 | 946 | | |
931 | 947 | | |
932 | | - | |
| 948 | + | |
933 | 949 | | |
934 | | - | |
935 | | - | |
| 950 | + | |
936 | 951 | | |
937 | 952 | | |
938 | 953 | | |
| |||
1033 | 1048 | | |
1034 | 1049 | | |
1035 | 1050 | | |
| 1051 | + | |
1036 | 1052 | | |
1037 | 1053 | | |
1038 | 1054 | | |
1039 | 1055 | | |
1040 | 1056 | | |
1041 | 1057 | | |
1042 | 1058 | | |
1043 | | - | |
| 1059 | + | |
| 1060 | + | |
1044 | 1061 | | |
1045 | 1062 | | |
1046 | 1063 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| |||
458 | 459 | | |
459 | 460 | | |
460 | 461 | | |
| 462 | + | |
461 | 463 | | |
462 | 464 | | |
463 | 465 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
20 | 25 | | |
| |||
Lines changed: 86 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 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
Lines changed: 86 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 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
0 commit comments
Comments
(0)