- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit8683195
committed
Ignore temporary relations in RelidByRelfilenumber()
Temporary relations may share the same RelFileNumber with a permanentrelation, or other temporary relations associated with other sessions.Being able to uniquely identify a temporary relation would requireRelidByRelfilenumber() to know about the proc number of the temporaryrelation it wants to identify, something it is not designed for sinceits introduction inf01d1ae.There are currently three callers of RelidByRelfilenumber():- autoprewarm.- Logical decoding, reorder buffer.- pg_filenode_relation(), that attempts to find a relation OID based ona tablespace OID and a RelFileNumber.This makes the situation problematic particularly for the first twocases, leading to the possibility of random ERRORs due toinconsistencies that temporary relations can create in the cachemaintained by RelidByRelfilenumber(). The third case should be less ofan issue, as I suspect that there are few direct callers ofpg_filenode_relation().The window where the ERRORs are happen is very narrow, requiring an OIDwraparound to create a lookup conflict in RelidByRelfilenumber() with atemporary table reusing the same OID as another relation already cached.The problem is easier to reach in workloads with a high OID consumptionrate, especially with a higher number of temporary relations created.We could get pg_filenode_relation() and RelidByRelfilenumber() to workwith temporary relations if provided the means to identify them with anoptional proc number given in input, but the years have also shown thatwe do not have a use case for it, yet. Note that this could not bebackpatched if pg_filenode_relation() needs changes. It is simpler toignore temporary relations.Reported-by: Shenhao Wang <wangsh.fnst@fujitsu.com>Author: Vignesh C <vignesh21@gmail.com>Reviewed-By: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>Reviewed-By: Robert Haas <robertmhaas@gmail.com>Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>Reviewed-By: Takamichi Osumi <osumi.takamichi@fujitsu.com>Reviewed-By: Michael Paquier <michael@paquier.xyz>Reviewed-By: Masahiko Sawada <sawada.mshk@gmail.com>Reported-By: Shenhao Wang <wangsh.fnst@fujitsu.com>Discussion:https://postgr.es/m/bbaaf9f9-ebb2-645f-54bb-34d6efc7ac42@fujitsu.comBackpatch-through: 131 parentb942360 commit8683195
File tree
7 files changed
+41
-4
lines changed- doc/src/sgml
- src
- backend/utils
- adt
- cache
- test/regress
- expected
- sql
7 files changed
+41
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30362 | 30362 | | |
30363 | 30363 | | |
30364 | 30364 | | |
30365 | | - | |
| 30365 | + | |
| 30366 | + | |
30366 | 30367 | | |
30367 | 30368 | | |
30368 | 30369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
938 | 938 | | |
939 | 939 | | |
940 | 940 | | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
941 | 944 | | |
942 | 945 | | |
943 | 946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
| |||
208 | 213 | | |
209 | 214 | | |
210 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
211 | 219 | | |
212 | 220 | | |
213 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3567 | 3567 | | |
3568 | 3568 | | |
3569 | 3569 | | |
| 3570 | + | |
3570 | 3571 | | |
3571 | 3572 | | |
3572 | 3573 | | |
3573 | 3574 | | |
3574 | 3575 | | |
3575 | | - | |
| 3576 | + | |
| 3577 | + | |
| 3578 | + | |
3576 | 3579 | | |
3577 | 3580 | | |
3578 | 3581 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
105 | 117 | | |
106 | 118 | | |
107 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2202 | 2202 | | |
2203 | 2203 | | |
2204 | 2204 | | |
| 2205 | + | |
2205 | 2206 | | |
2206 | 2207 | | |
2207 | 2208 | | |
2208 | 2209 | | |
2209 | 2210 | | |
2210 | | - | |
2211 | | - | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
2212 | 2214 | | |
2213 | 2215 | | |
2214 | 2216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
| |||
0 commit comments
Comments
(0)