- Notifications
You must be signed in to change notification settings - Fork28
Commit727c155
committed
Fix reindexing of pg_class indexes some more.
Commits3dbb317 et al failed under CLOBBER_CACHE_ALWAYS testing.Investigation showed that to reindex pg_class_oid_index, we mustsuppress accesses to the index (via SetReindexProcessing) before we callRelationSetNewRelfilenode, or at least before we do CommandCounterIncrementtherein; otherwise, relcache reloads happening within the CCI may try tofetch pg_class rows using the index's new relfilenode value, which is asyet an empty file.Of course, the point of3dbb317 was that that ordering didn't workeither, because then RelationSetNewRelfilenode's own update of the index'spg_class row cannot access the index, should it need to.There are various ways we might have got around that, but Andres Freundcame up with a brilliant solution: for a mapped index, we can really justskip the pg_class update altogether. The only fields it was actuallychanging were relpages etc, but it was just setting them to zeroes whichis useless make-work. (Correct new values will be installed at the endof index build.) All pg_class indexes are mapped and probably always willbe, so this eliminates the problem by removing work rather than adding it,always a pleasant outcome. Having taught RelationSetNewRelfilenode to doit that way, we can revert the code reordering in reindex_index. (ButI left the moved setup code where it was; there seems no reason why ithas to run without use of the old index. If you're trying to fix abusted pg_class index, you'll have had to disable system index usealtogether to get this far.)Moreover, this means we don't need RelationSetIndexList at all, becausereindex_relation's hacking to make "REINDEX TABLE pg_class" work islikewise now unnecessary. We'll leave that code in place in the backbranches, but a follow-on patch will remove it in HEAD.In passing, do some minor cleanup for commit5c15606 (in HEAD only),notably removing a duplicate newrnode assignment.Patch by me, using a core idea due to Andres Freund. Back-patch to allsupported branches, as3dbb317 was.Discussion:https://postgr.es/m/28926.1556664156@sss.pgh.pa.us1 parent63c6a24 commit727c155
2 files changed
+49
-65
lines changedLines changed: 4 additions & 49 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3713 | 3713 |
| |
3714 | 3714 |
| |
3715 | 3715 |
| |
3716 |
| - | |
3717 |
| - | |
3718 |
| - | |
3719 |
| - | |
3720 |
| - | |
3721 |
| - | |
3722 |
| - | |
3723 |
| - | |
3724 |
| - | |
3725 | 3716 |
| |
3726 | 3717 |
| |
3727 | 3718 |
| |
3728 | 3719 |
| |
3729 | 3720 |
| |
3730 | 3721 |
| |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
3731 | 3726 |
| |
3732 | 3727 |
| |
3733 | 3728 |
| |
| |||
3873 | 3868 |
| |
3874 | 3869 |
| |
3875 | 3870 |
| |
3876 |
| - | |
3877 | 3871 |
| |
3878 | 3872 |
| |
3879 | 3873 |
| |
| |||
3908 | 3902 |
| |
3909 | 3903 |
| |
3910 | 3904 |
| |
3911 |
| - | |
3912 |
| - | |
3913 |
| - | |
3914 |
| - | |
3915 |
| - | |
3916 |
| - | |
3917 |
| - | |
3918 |
| - | |
3919 |
| - | |
3920 |
| - | |
3921 |
| - | |
3922 |
| - | |
3923 |
| - | |
3924 |
| - | |
3925 |
| - | |
3926 |
| - | |
3927 |
| - | |
3928 |
| - | |
3929 |
| - | |
3930 |
| - | |
3931 |
| - | |
3932 |
| - | |
3933 |
| - | |
3934 |
| - | |
3935 |
| - | |
3936 |
| - | |
3937 |
| - | |
3938 |
| - | |
3939 | 3905 |
| |
3940 | 3906 |
| |
3941 |
| - | |
3942 | 3907 |
| |
3943 | 3908 |
| |
3944 | 3909 |
| |
| |||
3966 | 3931 |
| |
3967 | 3932 |
| |
3968 | 3933 |
| |
3969 |
| - | |
3970 | 3934 |
| |
3971 | 3935 |
| |
3972 | 3936 |
| |
3973 | 3937 |
| |
3974 |
| - | |
3975 |
| - | |
3976 |
| - | |
3977 | 3938 |
| |
3978 | 3939 |
| |
3979 | 3940 |
| |
3980 | 3941 |
| |
3981 | 3942 |
| |
3982 | 3943 |
| |
3983 | 3944 |
| |
3984 |
| - | |
3985 |
| - | |
3986 |
| - | |
3987 | 3945 |
| |
3988 | 3946 |
| |
3989 | 3947 |
| |
| |||
3995 | 3953 |
| |
3996 | 3954 |
| |
3997 | 3955 |
| |
3998 |
| - | |
3999 |
| - | |
4000 |
| - | |
4001 | 3956 |
| |
4002 | 3957 |
| |
4003 | 3958 |
| |
|
Lines changed: 45 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3384 | 3384 |
| |
3385 | 3385 |
| |
3386 | 3386 |
| |
3387 |
| - | |
3388 |
| - | |
3389 |
| - | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
| 3392 | + | |
| 3393 | + | |
3390 | 3394 |
| |
3391 | 3395 |
| |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
3392 | 3414 |
| |
3393 | 3415 |
| |
3394 | 3416 |
| |
3395 | 3417 |
| |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + | |
3396 | 3422 |
| |
| 3423 | + | |
| 3424 | + | |
3397 | 3425 |
| |
3398 | 3426 |
| |
3399 |
| - | |
3400 |
| - | |
3401 |
| - | |
3402 |
| - | |
3403 |
| - | |
3404 |
| - | |
3405 |
| - | |
3406 |
| - | |
3407 |
| - | |
3408 |
| - | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
| 3430 | + | |
| 3431 | + | |
| 3432 | + | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
| 3436 | + | |
3409 | 3437 |
| |
3410 |
| - | |
| 3438 | + | |
| 3439 | + | |
3411 | 3440 |
| |
3412 | 3441 |
| |
3413 | 3442 |
| |
3414 | 3443 |
| |
3415 | 3444 |
| |
3416 | 3445 |
| |
3417 |
| - | |
3418 |
| - | |
| 3446 | + | |
| 3447 | + | |
3419 | 3448 |
| |
3420 | 3449 |
| |
3421 | 3450 |
| |
|
0 commit comments
Comments
(0)