SQLite

Check-in [ba33bb059e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a case where database corruption may cause an assert() to fail.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | incr-vacuum-opt
Files: files | file ages | folders
SHA1: ba33bb059ed4f4547da2880dbc8bd827c06fae34
User & Date: dan 2013-02-24 11:50:43.950
Context
2013-02-25
07:12
Catch a dropped error code in backup.c. (check-in: ac8ca3ecee user: dan tags: incr-vacuum-opt)
2013-02-24
11:50
Fix a case where database corruption may cause an assert() to fail. (check-in: ba33bb059e user: dan tags: incr-vacuum-opt)
2013-02-23
19:43
Fix a case in the incremental vacuum code where database corruption was going unreported. (check-in: 4cd30c7262 user: dan tags: incr-vacuum-opt)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to src/btree.c.
3062
3063
3064
3065
3066
3067
3068


3069
3070
3071
3072
3073
3074
3075
3076
  if( !pBt->autoVacuum ){
    rc = SQLITE_DONE;
  }else{
    Pgno nOrig = btreePagecount(pBt);
    Pgno nFree = get4byte(&pBt->pPage1->aData[36]);
    Pgno nFin = finalDbSize(pBt, nOrig, nFree);



    if( nFree>0 ){
      invalidateAllOverflowCache(pBt);
      rc = incrVacuumStep(pBt, nFin, nOrig, 0);
      if( rc==SQLITE_OK ){
        rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
        put4byte(&pBt->pPage1->aData[28], pBt->nPage);
      }
    }else{







>
>
|







3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
  if( !pBt->autoVacuum ){
    rc = SQLITE_DONE;
  }else{
    Pgno nOrig = btreePagecount(pBt);
    Pgno nFree = get4byte(&pBt->pPage1->aData[36]);
    Pgno nFin = finalDbSize(pBt, nOrig, nFree);

    if( nOrig<nFin ){
      rc = SQLITE_CORRUPT_BKPT;
    }else if( nFree>0 ){
      invalidateAllOverflowCache(pBt);
      rc = incrVacuumStep(pBt, nFin, nOrig, 0);
      if( rc==SQLITE_OK ){
        rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
        put4byte(&pBt->pPage1->aData[28], pBt->nPage);
      }
    }else{