Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix some incorrect asserts() in the pager - problems brought to light by the new soft-heap-limit testing apparatus of check-in (4202). (CVS 4207) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
51f3e01b7486f23b67bdfb6bb19fc529 |
User & Date: | drh 2007-08-10 23:56:36.000 |
Context
2007-08-11
| ||
00:26 | Backout check-in (4206) and replace it with a much better and more general fix for the problem identified in ticket #2565. (CVS 4208) (check-in: 7961a73850 user: drh tags: trunk) | |
2007-08-10
| ||
23:56 | Fix some incorrect asserts() in the pager - problems brought to light by the new soft-heap-limit testing apparatus of check-in (4202). (CVS 4207) (check-in: 51f3e01b74 user: drh tags: trunk) | |
23:54 | Fix the corruption problem of ticket #2565 as demonstrated by the test added in (4204). There may yet be other instances of similar problems lurking in the code. (CVS 4206) (check-in: 7ed2f59e70 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.354 2007/08/10 23:56:36 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" #include "os.h" #include "pager.h" #include <assert.h> #include <string.h> |
︙ | ︙ | |||
558 559 560 561 562 563 564 | ** ** If the second argument is SQLITE_IOERR, SQLITE_CORRUPT, or SQLITE_FULL ** the error becomes persistent. All subsequent API calls on this Pager ** will immediately return the same error code. */ static int pager_error(Pager *pPager, int rc){ int rc2 = rc & 0xff; | > | > > > | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | ** ** If the second argument is SQLITE_IOERR, SQLITE_CORRUPT, or SQLITE_FULL ** the error becomes persistent. All subsequent API calls on this Pager ** will immediately return the same error code. */ static int pager_error(Pager *pPager, int rc){ int rc2 = rc & 0xff; assert( pPager->errCode==SQLITE_FULL || pPager->errCode==SQLITE_OK || (pPager->errCode & 0xff)==SQLITE_IOERR ); if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR || rc2==SQLITE_CORRUPT ){ pPager->errCode = rc; } |
︙ | ︙ | |||
2751 2752 2753 2754 2755 2756 2757 | if( pPg==pPager->pAll ){ pPager->pAll = pPg->pNextAll; }else{ for( pTmp=pPager->pAll; pTmp->pNextAll!=pPg; pTmp=pTmp->pNextAll ){} pTmp->pNextAll = pPg->pNextAll; } nReleased += sqliteAllocSize(pPg); | | > | > > > | 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 | if( pPg==pPager->pAll ){ pPager->pAll = pPg->pNextAll; }else{ for( pTmp=pPager->pAll; pTmp->pNextAll!=pPg; pTmp=pTmp->pNextAll ){} pTmp->pNextAll = pPg->pNextAll; } nReleased += sqliteAllocSize(pPg); IOTRACE(("PGFREE %p %d *\n", pPager, pPg->pgno)); PAGER_INCR(sqlite3_pager_pgfree_count); sqliteFree(pPg); } if( rc!=SQLITE_OK ){ /* An error occured whilst writing to the database file or ** journal in pager_recycle(). The error is not returned to the ** caller of this function. Instead, set the Pager.errCode variable. ** The error will be returned to the user (or users, in the case ** of a shared pager cache) of the pager for which the error occured. */ assert( (rc&0xff)==SQLITE_IOERR || rc==SQLITE_FULL || rc==SQLITE_BUSY ); assert( pPager->state>=PAGER_RESERVED ); pager_error(pPager, rc); } } } return nReleased; |
︙ | ︙ |