1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Do not invoke btreeComputeFreeSpace() when not necessary.

FossilOrigin-Name: f11b0ed47402034378ded2c60b82841b81cd1319cdb72d1ef052faef29a5294d
This commit is contained in:
drh
2019-02-11 22:50:01 +00:00
parent d4a6744b50
commit 8357c662b3
3 changed files with 9 additions and 11 deletions

View File

@@ -7396,6 +7396,7 @@ static void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){
*/
pTo->isInit = 0;
rc = btreeInitPage(pTo);
if( rc==SQLITE_OK ) rc = btreeComputeFreeSpace(pTo);
if( rc!=SQLITE_OK ){
*pRC = rc;
return;
@@ -8294,10 +8295,7 @@ static int balance(BtCursor *pCur){
int iPage = pCur->iPage;
MemPage *pPage = pCur->pPage;
if( pPage->nFree<0 ){
rc = btreeComputeFreeSpace(pPage);
if( rc ) break;
}
assert( pPage->nFree>=0 );
if( iPage==0 ){
if( pPage->nOverflow ){
/* The root page of the b-tree is overfull. In this case call the