SQLite

Check-in [0cb6cd2a6a]
Login

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

Overview
Comment:Bug fixes in the overwrite optimization.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | cell-overwrite-prototype
Files: files | file ages | folders
SHA3-256: 0cb6cd2a6a596afaa1cca6c5f5abc2ea75d04f254c7debaf36ecd6a90b66aed6
User & Date: drh 2018-05-03 12:57:48.671
Context
2018-05-03
13:56
Add more corruption checking to the cell overwrite logic. (check-in: 58d14afe1e user: drh tags: cell-overwrite-prototype)
12:57
Bug fixes in the overwrite optimization. (check-in: 0cb6cd2a6a user: drh tags: cell-overwrite-prototype)
03:59
The sqlite3BtreeInsert() routine tries to overwrite an existing cell with modified content if the new content is the same size. Pages are only dirtied if they change. This prototype works some, but still has issues. (check-in: 489451b378 user: drh tags: cell-overwrite-prototype)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
  iOffset = pCur->info.nLocal;
  ovflPgno = get4byte(pCur->info.pPayload + iOffset);
  pBt = pPage->pBt;
  ovflPageSize = pBt->usableSize - 4;
  do{
    rc = btreeGetPage(pBt, ovflPgno, &pPage, 0);
    if( rc ) return rc;
    if( iOffset+ovflPageSize>nTotal ){
      ovflPgno = get4byte(pPage->aData + ovflPageSize);
    }else{
      ovflPageSize = nTotal - iOffset;
    }
    rc = btreeOverwriteContent(pPage, pPage->aData, pX,
                               iOffset, ovflPageSize);
    if( rc ) return rc;
    iOffset += ovflPageSize;
    sqlite3PagerUnref(pPage->pDbPage);
  }while( iOffset<nTotal );
  return SQLITE_OK;    
}







|
|



|







8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
  iOffset = pCur->info.nLocal;
  ovflPgno = get4byte(pCur->info.pPayload + iOffset);
  pBt = pPage->pBt;
  ovflPageSize = pBt->usableSize - 4;
  do{
    rc = btreeGetPage(pBt, ovflPgno, &pPage, 0);
    if( rc ) return rc;
    if( iOffset+ovflPageSize<nTotal ){
      ovflPgno = get4byte(pPage->aData);
    }else{
      ovflPageSize = nTotal - iOffset;
    }
    rc = btreeOverwriteContent(pPage, pPage->aData+4, pX,
                               iOffset, ovflPageSize);
    if( rc ) return rc;
    iOffset += ovflPageSize;
    sqlite3PagerUnref(pPage->pDbPage);
  }while( iOffset<nTotal );
  return SQLITE_OK;    
}