mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Avoid unnecessary cachedCellSize() calls in the cell partition adjustment
phase of balance_nonroot(). FossilOrigin-Name: 6319ee1256b1f7c39dd39a536a39b77b3d10dcac
This commit is contained in:
10
src/btree.c
10
src/btree.c
@@ -7218,12 +7218,12 @@ static int balance_nonroot(
|
||||
int r; /* Index of right-most cell in left sibling */
|
||||
int d; /* Index of first cell to the left of right sibling */
|
||||
|
||||
r = cntNew[i-1] - 1;
|
||||
d = r + 1 - leafData;
|
||||
(void)cachedCellSize(&b, d);
|
||||
while(1){
|
||||
r = cntNew[i-1] - 1;
|
||||
d = r + 1 - leafData;
|
||||
assert( d<nMaxCells );
|
||||
assert( r<nMaxCells );
|
||||
(void)cachedCellSize(&b, d);
|
||||
(void)cachedCellSize(&b, r);
|
||||
if( szRight!=0
|
||||
&& (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+2)) ){
|
||||
@@ -7231,11 +7231,13 @@ static int balance_nonroot(
|
||||
}
|
||||
szRight += b.szCell[d] + 2;
|
||||
szLeft -= b.szCell[r] + 2;
|
||||
cntNew[i-1]--;
|
||||
cntNew[i-1] = r;
|
||||
if( cntNew[i-1] <= 0 ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto balance_cleanup;
|
||||
}
|
||||
r--;
|
||||
d--;
|
||||
}
|
||||
szNew[i] = szRight;
|
||||
szNew[i-1] = szLeft;
|
||||
|
Reference in New Issue
Block a user