diff options
author | Peter Geoghegan <pg@bowt.ie> | 2019-03-24 12:28:58 -0700 |
---|---|---|
committer | Peter Geoghegan <pg@bowt.ie> | 2019-03-24 12:28:58 -0700 |
commit | 59ab3be9e4d3e3cdf03bada2f6fb3d71a1e42908 (patch) | |
tree | e914d43a2dcdd47ec046259ab81ee89e1c8f1a79 /src | |
parent | bd9396a0b2d42497f1196af74b327e00cb6af435 (diff) | |
download | postgresql-59ab3be9e4d3e3cdf03bada2f6fb3d71a1e42908.tar.gz postgresql-59ab3be9e4d3e3cdf03bada2f6fb3d71a1e42908.zip |
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 fab25024.
Issue spotted while rereviewing coverage of the nbtree patch series
using gcov.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/nbtree/nbtsplitloc.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/backend/access/nbtree/nbtsplitloc.c b/src/backend/access/nbtree/nbtsplitloc.c index 34228b133e8..4969853e7f7 100644 --- a/src/backend/access/nbtree/nbtsplitloc.c +++ b/src/backend/access/nbtree/nbtsplitloc.c @@ -520,13 +520,12 @@ _bt_splitcmp(const void *arg1, const void *arg2) } /* - * Subroutine to find the "best" split point among an array of acceptable - * candidate split points that split without there being an excessively high - * delta between the space left free on the left and right halves. The "best" - * split point is the split point with the lowest penalty among split points - * that fall within current/final split interval. Penalty is an abstract - * score, with a definition that varies depending on whether we're splitting a - * leaf page or an internal page. See _bt_split_penalty() for details. + * Subroutine to find the "best" split point among candidate split points. + * The best split point is the split point with the lowest penalty among split + * points that fall within current/final split interval. Penalty is an + * abstract score, with a definition that varies depending on whether we're + * splitting a leaf page or an internal page. See _bt_split_penalty() for + * details. * * "perfectpenalty" is assumed to be the lowest possible penalty among * candidate split points. This allows us to return early without wasting @@ -545,13 +544,6 @@ _bt_bestsplitloc(FindSplitData *state, int perfectpenalty, bool *newitemonleft) lowsplit; int highsplit = Min(state->interval, state->nsplits); - /* No point in calculating penalty when there's only one choice */ - if (state->nsplits == 1) - { - *newitemonleft = state->splits[0].newitemonleft; - return state->splits[0].firstoldonright; - } - bestpenalty = INT_MAX; lowsplit = 0; for (int i = lowsplit; i < highsplit; i++) |