forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9bacec1
committed
Don't overlook indexes during parallel VACUUM.
Commitb4af70c, which simplified state managed by VACUUM, performedrefactoring of parallel VACUUM in passing. Confusion about the exactdetails of the tasks that the leader process is responsible for led tocode that made it possible for parallel VACUUM to miss a subset of thetable's indexes entirely. Specifically, indexes that fell under themin_parallel_index_scan_size size cutoff were missed. These indexes aresupposed to be vacuumed by the leader (alongside any parallel unsafeindexes), but weren't vacuumed at all. Affected indexes could easilyend up with duplicate heap TIDs, once heap TIDs were recycled for newheap tuples. This had generic symptoms that might be seen with almostany index corruption involving structural inconsistencies between anindex and its table.To fix, make sure that the parallel VACUUM leader process performs anyrequired index vacuuming for indexes that happen to be below the sizecutoff. Also document the design of parallel VACUUM with thesebelow-size-cutoff indexes.It's unclear how many users might be affected by this bug. There had tobe at least three indexes on the table to hit the bug: a smaller index,plus at least two additional indexes that themselves exceed the sizecutoff. Cases with just one additional index would not run intotrouble, since the parallel VACUUM cost model requires twolarger-than-cutoff indexes on the table to apply any parallelprocessing. Note also that autovacuum was not affected, since it neveruses parallel processing.Test case based on tests from a larger patch to test parallel VACUUM byMasahiko Sawada.Many thanks to Kamigishi Rei for her invaluable help with tracking thisproblem down.Author: Peter Geoghegan <pg@bowt.ie>Author: Masahiko Sawada <sawada.mshk@gmail.com>Reported-By: Kamigishi Rei <iijima.yun@koumakan.jp>Reported-By: Andrew Gierth <andrew@tao11.riddles.org.uk>Diagnosed-By: Andres Freund <andres@anarazel.de>Bug: #17245Discussion:https://postgr.es/m/17245-ddf06aaf85735f36@postgresql.orgDiscussion:https://postgr.es/m/20211030023740.qbnsl2xaoh2grq3d@alap3.anarazel.deBackpatch: 14-, where the refactoring commit appears.1 parentf3d4019 commit9bacec1
File tree
5 files changed
+132
-26
lines changed- src
- backend/access/heap
- include/commands
- test/regress
- expected
- sql
5 files changed
+132
-26
lines changedLines changed: 35 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
452 | 452 |
| |
453 | 453 |
| |
454 | 454 |
| |
455 |
| - | |
| 455 | + | |
456 | 456 |
| |
457 | 457 |
| |
458 | 458 |
| |
| |||
2636 | 2636 |
| |
2637 | 2637 |
| |
2638 | 2638 |
| |
2639 |
| - | |
2640 |
| - | |
| 2639 | + | |
| 2640 | + | |
2641 | 2641 |
| |
2642 | 2642 |
| |
2643 | 2643 |
| |
| |||
2825 | 2825 |
| |
2826 | 2826 |
| |
2827 | 2827 |
| |
2828 |
| - | |
| 2828 | + | |
2829 | 2829 |
| |
2830 | 2830 |
| |
2831 | 2831 |
| |
| |||
2858 | 2858 |
| |
2859 | 2859 |
| |
2860 | 2860 |
| |
2861 |
| - | |
2862 |
| - | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
2863 | 2870 |
| |
2864 | 2871 |
| |
2865 | 2872 |
| |
| |||
2879 | 2886 |
| |
2880 | 2887 |
| |
2881 | 2888 |
| |
2882 |
| - | |
2883 |
| - | |
2884 |
| - | |
2885 |
| - | |
2886 |
| - | |
2887 | 2889 |
| |
2888 | 2890 |
| |
2889 | 2891 |
| |
2890 |
| - | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
2891 | 2895 |
| |
2892 |
| - | |
| 2896 | + | |
| 2897 | + | |
2893 | 2898 |
| |
2894 | 2899 |
| |
2895 | 2900 |
| |
| |||
3730 | 3735 |
| |
3731 | 3736 |
| |
3732 | 3737 |
| |
3733 |
| - | |
| 3738 | + | |
3734 | 3739 |
| |
3735 | 3740 |
| |
3736 | 3741 |
| |
3737 | 3742 |
| |
3738 |
| - | |
| 3743 | + | |
3739 | 3744 |
| |
3740 | 3745 |
| |
3741 | 3746 |
| |
| |||
3761 | 3766 |
| |
3762 | 3767 |
| |
3763 | 3768 |
| |
3764 |
| - | |
| 3769 | + | |
3765 | 3770 |
| |
3766 | 3771 |
| |
3767 | 3772 |
| |
| |||
3839 | 3844 |
| |
3840 | 3845 |
| |
3841 | 3846 |
| |
3842 |
| - | |
| 3847 | + | |
3843 | 3848 |
| |
3844 | 3849 |
| |
3845 | 3850 |
| |
| |||
3857 | 3862 |
| |
3858 | 3863 |
| |
3859 | 3864 |
| |
3860 |
| - | |
| 3865 | + | |
3861 | 3866 |
| |
3862 | 3867 |
| |
3863 |
| - | |
| 3868 | + | |
3864 | 3869 |
| |
3865 | 3870 |
| |
3866 | 3871 |
| |
3867 | 3872 |
| |
3868 |
| - | |
| 3873 | + | |
3869 | 3874 |
| |
3870 | 3875 |
| |
3871 | 3876 |
| |
| |||
3893 | 3898 |
| |
3894 | 3899 |
| |
3895 | 3900 |
| |
3896 |
| - | |
| 3901 | + | |
3897 | 3902 |
| |
3898 | 3903 |
| |
3899 | 3904 |
| |
| |||
3970 | 3975 |
| |
3971 | 3976 |
| |
3972 | 3977 |
| |
3973 |
| - | |
| 3978 | + | |
3974 | 3979 |
| |
3975 | 3980 |
| |
3976 | 3981 |
| |
| |||
4013 | 4018 |
| |
4014 | 4019 |
| |
4015 | 4020 |
| |
4016 |
| - | |
| 4021 | + | |
4017 | 4022 |
| |
4018 | 4023 |
| |
4019 | 4024 |
| |
| |||
4043 | 4048 |
| |
4044 | 4049 |
| |
4045 | 4050 |
| |
4046 |
| - | |
4047 |
| - | |
| 4051 | + | |
| 4052 | + | |
4048 | 4053 |
| |
4049 | 4054 |
| |
4050 | 4055 |
| |
| |||
4068 | 4073 |
| |
4069 | 4074 |
| |
4070 | 4075 |
| |
| 4076 | + | |
| 4077 | + | |
| 4078 | + | |
| 4079 | + | |
| 4080 | + | |
4071 | 4081 |
| |
4072 | 4082 |
| |
4073 | 4083 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
43 |
| - | |
| 43 | + | |
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
|
Lines changed: 49 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 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
| 99 | + | |
99 | 100 |
| |
100 | 101 |
| |
101 | 102 |
| |
|
Lines changed: 46 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 | + |
0 commit comments
Comments
(0)