Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 59ab3be

Browse files
Remove dead code from nbtsplitloc.c.
It doesn't make sense to consider the possibility that there will only be one candidate split point when choosing among split points to find the split with the lowest penalty. This is a vestige of an earlier version of the patch that became commit fab2502. Issue spotted while rereviewing coverage of the nbtree patch series using gcov.
1 parent bd9396a commit 59ab3be

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/backend/access/nbtree/nbtsplitloc.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -520,13 +520,12 @@ _bt_splitcmp(const void *arg1, const void *arg2)
520520
}
521521

522522
/*
523-
* Subroutine to find the "best" split point among an array of acceptable
524-
* candidate split points that split without there being an excessively high
525-
* delta between the space left free on the left and right halves. The "best"
526-
* split point is the split point with the lowest penalty among split points
527-
* that fall within current/final split interval. Penalty is an abstract
528-
* score, with a definition that varies depending on whether we're splitting a
529-
* leaf page or an internal page. See _bt_split_penalty() for details.
523+
* Subroutine to find the "best" split point among candidate split points.
524+
* The best split point is the split point with the lowest penalty among split
525+
* points that fall within current/final split interval. Penalty is an
526+
* abstract score, with a definition that varies depending on whether we're
527+
* splitting a leaf page or an internal page. See _bt_split_penalty() for
528+
* details.
530529
*
531530
* "perfectpenalty" is assumed to be the lowest possible penalty among
532531
* candidate split points. This allows us to return early without wasting
@@ -545,13 +544,6 @@ _bt_bestsplitloc(FindSplitData *state, int perfectpenalty, bool *newitemonleft)
545544
lowsplit;
546545
int highsplit = Min(state->interval, state->nsplits);
547546

548-
/* No point in calculating penalty when there's only one choice */
549-
if (state->nsplits == 1)
550-
{
551-
*newitemonleft = state->splits[0].newitemonleft;
552-
return state->splits[0].firstoldonright;
553-
}
554-
555547
bestpenalty = INT_MAX;
556548
lowsplit = 0;
557549
for (int i = lowsplit; i < highsplit; i++)

0 commit comments

Comments
 (0)