Commit ee0bb8f
Merge cockroachdb#151691
151691: sql/schemachanger: hide new secondary indexes during PK swap r=fqazi a=fqazi
Previously, during a primary key swap, the recreated secondary indexes were visible to introspection queries. This could cause users to encounter errors if they queried these indexes mid-operation. This patch resolves the issue by making the new indexes temporarily non-public and renaming them to prevent accidental access during the swap.
Fixes: cockroachdb#148405
Release note (bug fix): Fixed a bug that allowed replacement indexes, created during an ALTER PRIMARY KEY operation, to be accessed with index hints before they were in a ready state. This could lead to runtime errors.
Co-authored-by: Faizan Qazi <[email protected]>File tree
56 files changed
+578
-539
lines changed- pkg
- ccl/schemachangerccl/testdata
- decomp
- end_to_end/alter_table_alter_primary_key_rbr
- cli/testdata/doctor
- sql
- catalog
- bootstrap/testdata
- descpb
- tabledesc
- opt/exec/execbuilder/testdata
- schemachanger
- scbuild/internal/scbuildstmt
- scdecomp/testdata
- scexec/scmutationexec
- scop
- scpb
- uml
- scplan/internal/opgen
- testdata/end_to_end
- alter_table_add_primary_key_drop_rowid_with_secondary_idx
- alter_table_alter_primary_key_drop_rowid_with_idx
- alter_table_alter_primary_key_using_hash
- alter_table_alter_primary_key_vanilla
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
56 files changed
+578
-539
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
| 520 | + | |
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
| |||
956 | 957 | | |
957 | 958 | | |
958 | 959 | | |
| 960 | + | |
959 | 961 | | |
960 | 962 | | |
961 | 963 | | |
| |||
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
32 | 48 | | |
33 | 49 | | |
34 | 50 | | |
Lines changed: 30 additions & 30 deletions
Large diffs are not rendered by default.
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
Lines changed: 9 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| |||
973 | 973 | | |
974 | 974 | | |
975 | 975 | | |
976 | | - | |
| 976 | + | |
977 | 977 | | |
978 | 978 | | |
979 | 979 | | |
| |||
998 | 998 | | |
999 | 999 | | |
1000 | 1000 | | |
1001 | | - | |
1002 | 1001 | | |
1003 | | - | |
1004 | 1002 | | |
1005 | 1003 | | |
1006 | 1004 | | |
1007 | 1005 | | |
1008 | 1006 | | |
1009 | 1007 | | |
1010 | | - | |
1011 | | - | |
| 1008 | + | |
1012 | 1009 | | |
1013 | | - | |
1014 | 1010 | | |
1015 | 1011 | | |
1016 | 1012 | | |
| |||
1263 | 1259 | | |
1264 | 1260 | | |
1265 | 1261 | | |
1266 | | - | |
| 1262 | + | |
1267 | 1263 | | |
1268 | 1264 | | |
1269 | 1265 | | |
| |||
1731 | 1727 | | |
1732 | 1728 | | |
1733 | 1729 | | |
1734 | | - | |
| 1730 | + | |
1735 | 1731 | | |
1736 | 1732 | | |
1737 | 1733 | | |
| |||
1748 | 1744 | | |
1749 | 1745 | | |
1750 | 1746 | | |
1751 | | - | |
| 1747 | + | |
1752 | 1748 | | |
1753 | 1749 | | |
1754 | | - | |
| 1750 | + | |
1755 | 1751 | | |
1756 | 1752 | | |
1757 | 1753 | | |
| |||
1787 | 1783 | | |
1788 | 1784 | | |
1789 | 1785 | | |
1790 | | - | |
1791 | | - | |
1792 | | - | |
1793 | | - | |
1794 | | - | |
1795 | | - | |
1796 | | - | |
1797 | | - | |
1798 | | - | |
1799 | | - | |
1800 | | - | |
1801 | | - | |
1802 | 1786 | | |
1803 | 1787 | | |
1804 | 1788 | | |
| |||
2178 | 2162 | | |
2179 | 2163 | | |
2180 | 2164 | | |
2181 | | - | |
| 2165 | + | |
2182 | 2166 | | |
2183 | 2167 | | |
2184 | 2168 | | |
| |||
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
0 commit comments