Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Adjustments to the codec in the pager. (CVS 1222) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
be5122e99caacbeb5e568a2782fe2faf |
User & Date: | drh 2004-02-10 23:51:06.000 |
Context
2004-02-11
| ||
02:18 | Pass all (relevant) regression tests when using the codec. (CVS 1223) (check-in: 5200e9edc5 user: drh tags: trunk) | |
2004-02-10
| ||
23:51 | Adjustments to the codec in the pager. (CVS 1222) (check-in: be5122e99c user: drh tags: trunk) | |
13:41 | Perform updates in search order. Ticket #602. (CVS 1221) (check-in: cf1cec74ae user: drh tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** ** @(#) $Id: pager.c,v 1.98 2004/02/10 23:51:06 drh Exp $ */ #include "os.h" /* Must be first to enable large file support */ #include "sqliteInt.h" #include "pager.h" #include <assert.h> #include <string.h> |
︙ | ︙ | |||
559 560 561 562 563 564 565 | */ assert( pPg->nRef==0 || pPg->pgno==1 ); memcpy(PGHDR_TO_DATA(pPg), pgRec.aData, SQLITE_PAGE_SIZE); memset(PGHDR_TO_EXTRA(pPg), 0, pPager->nExtra); pPg->dirty = 0; pPg->needSync = 0; if( pPager->xCodec ){ | | | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | */ assert( pPg->nRef==0 || pPg->pgno==1 ); memcpy(PGHDR_TO_DATA(pPg), pgRec.aData, SQLITE_PAGE_SIZE); memset(PGHDR_TO_EXTRA(pPg), 0, pPager->nExtra); pPg->dirty = 0; pPg->needSync = 0; if( pPager->xCodec ){ pPager->xCodec(pPager->pCodecArg, PGHDR_TO_DATA(pPg), 3); } } return rc; } /* ** Playback the journal and thus restore the database file to |
︙ | ︙ | |||
722 723 724 725 726 727 728 | char zBuf[SQLITE_PAGE_SIZE]; if( !pPg->dirty ) continue; if( (int)pPg->pgno <= pPager->origDbSize ){ sqliteOsSeek(&pPager->fd, SQLITE_PAGE_SIZE*(off_t)(pPg->pgno-1)); rc = sqliteOsRead(&pPager->fd, zBuf, SQLITE_PAGE_SIZE); if( rc ) break; if( pPager->xCodec ){ | | | 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | char zBuf[SQLITE_PAGE_SIZE]; if( !pPg->dirty ) continue; if( (int)pPg->pgno <= pPager->origDbSize ){ sqliteOsSeek(&pPager->fd, SQLITE_PAGE_SIZE*(off_t)(pPg->pgno-1)); rc = sqliteOsRead(&pPager->fd, zBuf, SQLITE_PAGE_SIZE); if( rc ) break; if( pPager->xCodec ){ pPager->xCodec(pPager->pCodecArg, zBuf, 2); } }else{ memset(zBuf, 0, SQLITE_PAGE_SIZE); } if( pPg->nRef==0 || memcmp(zBuf, PGHDR_TO_DATA(pPg), SQLITE_PAGE_SIZE) ){ memcpy(PGHDR_TO_DATA(pPg), zBuf, SQLITE_PAGE_SIZE); memset(PGHDR_TO_EXTRA(pPg), 0, pPager->nExtra); |
︙ | ︙ | |||
1244 1245 1246 1247 1248 1249 1250 | if( pList==0 ) return SQLITE_OK; pPager = pList->pPager; while( pList ){ assert( pList->dirty ); sqliteOsSeek(&pPager->fd, (pList->pgno-1)*(off_t)SQLITE_PAGE_SIZE); if( pPager->xCodec ){ | | | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | if( pList==0 ) return SQLITE_OK; pPager = pList->pPager; while( pList ){ assert( pList->dirty ); sqliteOsSeek(&pPager->fd, (pList->pgno-1)*(off_t)SQLITE_PAGE_SIZE); if( pPager->xCodec ){ pPager->xCodec(pPager->pCodecArg, PGHDR_TO_DATA(pList), 6); } rc = sqliteOsWrite(&pPager->fd, PGHDR_TO_DATA(pList), SQLITE_PAGE_SIZE); if( pPager->xCodec ){ pPager->xCodec(pPager->pCodecArg, PGHDR_TO_DATA(pList), 0); } if( rc ) return rc; pList->dirty = 0; |
︙ | ︙ | |||
1520 1521 1522 1523 1524 1525 1526 | || fileSize>=pgno*SQLITE_PAGE_SIZE ){ sqlitepager_unref(PGHDR_TO_DATA(pPg)); return rc; }else{ memset(PGHDR_TO_DATA(pPg), 0, SQLITE_PAGE_SIZE); } }else if( pPager->xCodec ){ | | | 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 | || fileSize>=pgno*SQLITE_PAGE_SIZE ){ sqlitepager_unref(PGHDR_TO_DATA(pPg)); return rc; }else{ memset(PGHDR_TO_DATA(pPg), 0, SQLITE_PAGE_SIZE); } }else if( pPager->xCodec ){ pPager->xCodec(pPager->pCodecArg, PGHDR_TO_DATA(pPg), 3); } } }else{ /* The requested page is in the page cache. */ pPager->nHit++; page_ref(pPg); } |
︙ | ︙ | |||
1804 1805 1806 1807 1808 1809 1810 | } store32bits(pPg->pgno, pPg, -4); if( pPager->xCodec ){ pPager->xCodec(pPager->pCodecArg, pData, 3); } rc = sqliteOsWrite(&pPager->jfd, &((char*)pData)[-4], szPg); if( pPager->xCodec ){ | | | 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 | } store32bits(pPg->pgno, pPg, -4); if( pPager->xCodec ){ pPager->xCodec(pPager->pCodecArg, pData, 3); } rc = sqliteOsWrite(&pPager->jfd, &((char*)pData)[-4], szPg); if( pPager->xCodec ){ pPager->xCodec(pPager->pCodecArg, pData, 0); } if( journal_format>=JOURNAL_FORMAT_3 ){ *(u32*)PGHDR_TO_EXTRA(pPg) = saved; } if( rc!=SQLITE_OK ){ sqlitepager_rollback(pPager); pPager->errMask |= PAGER_ERR_FULL; |
︙ | ︙ |