diff options
author | drh <drh@noemail.net> | 2015-02-21 00:19:25 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-02-21 00:19:25 +0000 |
commit | ad0961b31b11f210aeb85803788e4b401d6ba85c (patch) | |
tree | 6695104a928ad127c0f8f0ea116c311c60b54e0c /src/test_stat.c | |
parent | db222adfd3620e797d9cea7de60b520c33c7ce76 (diff) | |
download | sqlite-ad0961b31b11f210aeb85803788e4b401d6ba85c.tar.gz sqlite-ad0961b31b11f210aeb85803788e4b401d6ba85c.zip |
Keep track of the optimal number of reserved bytes (by looking at reserve
byte requests in calls to sqlite3BtreeSetPageSize()) and then change the
reserve byte count to the optimal when doing a VACUUM or when using the
backup API.
FossilOrigin-Name: 28c2b726285ea88b334acfd6390a057d2d244838
Diffstat (limited to 'src/test_stat.c')
-rw-r--r-- | src/test_stat.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/test_stat.c b/src/test_stat.c index 615df3d80..daa84de2c 100644 --- a/src/test_stat.c +++ b/src/test_stat.c @@ -301,8 +301,11 @@ static int statDecodePage(Btree *pBt, StatPage *p){ if( p->nCell ){ int i; /* Used to iterate through cells */ - int nUsable = szPage - sqlite3BtreeGetReserve(pBt); + int nUsable; /* Usable bytes per page */ + sqlite3BtreeEnter(pBt); + nUsable = szPage - sqlite3BtreeGetReserveNoMutex(pBt); + sqlite3BtreeLeave(pBt); p->aCell = sqlite3_malloc((p->nCell+1) * sizeof(StatCell)); memset(p->aCell, 0, (p->nCell+1) * sizeof(StatCell)); @@ -425,7 +428,11 @@ statNextRestart: while( p->iCell<p->nCell ){ StatCell *pCell = &p->aCell[p->iCell]; if( pCell->iOvfl<pCell->nOvfl ){ - int nUsable = sqlite3BtreeGetPageSize(pBt)-sqlite3BtreeGetReserve(pBt); + int nUsable; + sqlite3BtreeEnter(pBt); + nUsable = sqlite3BtreeGetPageSize(pBt) - + sqlite3BtreeGetReserveNoMutex(pBt); + sqlite3BtreeLeave(pBt); pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0); pCsr->iPageno = pCell->aOvfl[pCell->iOvfl]; pCsr->zPagetype = "overflow"; |