forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf4b6341
committed
Change lock acquisition order in expand_inherited_rtentry.
Previously, this function acquired locks in the order usingfind_all_inheritors(), which locks the children of each table that itprocesses in ascending OID order, and which processes the inheritancehierarchy as a whole in a breadth-first fashion. Now, it processesthe inheritance hierarchy in a depth-first fashion, and at each levelit proceeds in the order in which tables appear in the PartitionDesc.If table inheritance rather than table partitioning is used, the oldorder is preserved.This change moves the locking of any given partition much closer tothe code that actually expands that partition. This seems essentialif we ever want to allow concurrent DDL to add or remove partitions,because if the set of partitions can change, we must use the same datato decide which partitions to lock as we do to decide which partitionsto expand; otherwise, we might expand a partition that we haven'tlocked. It should hopefully also facilitate efforts to postponeinheritance expansion or locking for performance reasons, becausethere's really no way to postpone locking some partitions ifwe're blindly locking them all using find_all_inheritors().The only downside of this change which is known to me is that itfurther deviates from the principle that we should always lock theinheritance hierarchy in find_all_inheritors() order to avoid deadlockrisk. However, we've already crossed that bridge in commit9eefba1 and there are futher patchespending that make similar changes, so this isn't really giving upanything that we haven't surrendered already -- and it seems entirelyworth it, given the performance benefits some of those changes seemlikely to bring.Patch by me; thanks to David Rowley for discussion of these issues.Discussion:http://postgr.es/m/CAKJS1f_eEYVEq5tM8sm1k-HOwG0AyCPwX54XG9x4w0zy_N4Q_Q@mail.gmail.comDiscussion:http://postgr.es/m/CA+TgmoZUwPf_uanjF==gTGBMJrn8uCq52XYvAEorNkLrUdoawg@mail.gmail.com1 parent42ccbe4 commitf4b6341
1 file changed
+28
-31
lines changedLines changed: 28 additions & 31 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
124 | 124 |
| |
125 | 125 |
| |
126 | 126 |
| |
127 |
| - | |
128 |
| - | |
129 |
| - | |
130 |
| - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
131 | 132 |
| |
| 133 | + | |
132 | 134 |
| |
133 | 135 |
| |
134 |
| - | |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
139 |
| - | |
140 |
| - | |
141 |
| - | |
142 |
| - | |
143 |
| - | |
144 |
| - | |
145 |
| - | |
146 |
| - | |
147 |
| - | |
148 |
| - | |
149 | 136 |
| |
150 | 137 |
| |
151 | 138 |
| |
| |||
155 | 142 |
| |
156 | 143 |
| |
157 | 144 |
| |
158 |
| - | |
159 |
| - | |
160 |
| - | |
161 |
| - | |
162 |
| - | |
163 |
| - | |
164 | 145 |
| |
165 |
| - | |
| 146 | + | |
166 | 147 |
| |
167 | 148 |
| |
168 | 149 |
| |
169 | 150 |
| |
170 |
| - | |
171 |
| - | |
172 |
| - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
173 | 154 |
| |
174 | 155 |
| |
175 | 156 |
| |
| |||
180 | 161 |
| |
181 | 162 |
| |
182 | 163 |
| |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
183 | 180 |
| |
184 | 181 |
| |
185 | 182 |
| |
| |||
289 | 286 |
| |
290 | 287 |
| |
291 | 288 |
| |
292 |
| - | |
293 |
| - | |
| 289 | + | |
| 290 | + | |
294 | 291 |
| |
295 | 292 |
| |
296 | 293 |
| |
|
0 commit comments
Comments
(0)