forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7505da2
committed
Reverse order of newitem nbtree candidate splits.
Commitfab2502, which taught nbtree to choose candidate split pointsmore carefully, had _bt_findsplitloc() record all possible split pointsin an initial pass over a page that is about to be split. The orderthat candidate split points were processed and stored in was assumed tomatch the offset number order of split points on an imaginary version ofthe page that contains the same items as the original, but also fitsnewitem (the item that provoked the split precisely because it didn'tfit).However, the order of split points in the final array was not quite whatwas expected: the split point that makes newitem the firstright itemcame after the split point that makes newitem the lastleft item -- notbefore. As a result, _bt_findsplitloc() could get confused about theleftmost and rightmost tuples among all possible split points recordedfor the page. This seems to have no appreciable impact on the qualityof the final split point chosen by _bt_findsplitloc(), but it's stillwrong.To fix, switch the order in which newitem candidate splits are recordedin. This also makes it possible to describe candidate split points interms of which pair of adjoining tuples enclose the split point within_bt_findsplitloc(), making it clearer why it's generally safe for_bt_split() to expect lastleft and firstright tuples.1 parenta429164 commit7505da2
1 file changed
+22
-15
lines changedLines changed: 22 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
199 |
| - | |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
| 199 | + | |
204 | 200 |
| |
205 | 201 |
| |
206 | 202 |
| |
| |||
214 | 210 |
| |
215 | 211 |
| |
216 | 212 |
| |
217 |
| - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
218 | 218 |
| |
219 |
| - | |
220 |
| - | |
221 |
| - | |
| 219 | + | |
222 | 220 |
| |
| 221 | + | |
| 222 | + | |
223 | 223 |
| |
224 | 224 |
| |
225 |
| - | |
226 |
| - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
227 | 229 |
| |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
228 | 236 |
| |
229 | 237 |
| |
230 | 238 |
| |
231 | 239 |
| |
232 | 240 |
| |
233 | 241 |
| |
234 |
| - | |
235 |
| - | |
236 |
| - | |
237 |
| - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
238 | 245 |
| |
239 | 246 |
| |
240 | 247 |
| |
|
0 commit comments
Comments
(0)