From: dan Date: Fri, 30 Apr 2010 09:52:17 +0000 (+0000) Subject: Fix a couple of assert() statements in os_unix.c and wal.c. Combine sqlite3WalIsDirty... X-Git-Tag: version-3.7.2~455^2~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c97b53425204533345bb58185157d2e6e3eded5;p=thirdparty%2Fsqlite.git Fix a couple of assert() statements in os_unix.c and wal.c. Combine sqlite3WalIsDirty() with sqlite3WalUndo(). FossilOrigin-Name: a8f958be804ee05c4137b3cd110db344713af5f2 --- diff --git a/manifest b/manifest index 552a63398f..6271923420 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\smissing\swalIndexUnmap()\sto\ssqlite3WalSnapshotOpen(). -D 2010-04-30T09:32:06 +C Fix\sa\scouple\sof\sassert()\sstatements\sin\sos_unix.c\sand\swal.c.\sCombine\ssqlite3WalIsDirty()\swith\ssqlite3WalUndo(). +D 2010-04-30T09:52:18 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -150,9 +150,9 @@ F src/os.c 8bc63cf91e9802e2b807198e54e50227fa889306 F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c F src/os_common.h 0d6ee583b6ee3185eb9d951f890c6dd03021a08d F src/os_os2.c 8ad77a418630d7dee91d1bb04f79c2096301d3a0 -F src/os_unix.c 4237d2a6429307307ebd1e7c1e3ccec875468907 +F src/os_unix.c 685b0347383b5d12dee9961b3cc0337ff075617b F src/os_win.c a8fc01d8483be472e495793c01064fd87e56a5c1 -F src/pager.c 07c3522319a449db9dc732da828a09c4c55c41a4 +F src/pager.c 434f9751fc2dfc11ade004282deda5f8560bcba2 F src/pager.h 934b598583a9d936bb13c37d62a2fe68ac48781c F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e F src/pcache.c ace8f6a5ecd4711cc66a1b23053be7109bd437cf @@ -221,8 +221,8 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda -F src/wal.c b617892b95ac3f82e657e3c047ad6883111f6b8c -F src/wal.h d0a7048e68a86d3fe4639858d7f592606545d224 +F src/wal.c 6f0fdfac56f3148b7ff2fcd60f12c2a7bdb5e0de +F src/wal.h c3f347ba8f1cde46d9bcc6fedaf3ed0aa4b53294 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/where.c faadd9c2bf08868e5135192b44e0d753e363a885 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -808,7 +808,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 265e66e6984c32999bf93981e3b1d19887dfe599 -R 7b9c465ab8c7541a3a7b291b0b84a4e5 +P 72b95fde15dae56390dc8d4168fb2757447e289e +R 8864259ed44807eea46d7c4986422a72 U dan -Z 9561c62faf9368c39d4969e72108b9f2 +Z 967d048f88e642230f471eb242428feb diff --git a/manifest.uuid b/manifest.uuid index 8d2667d652..dd868c1211 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -72b95fde15dae56390dc8d4168fb2757447e289e \ No newline at end of file +a8f958be804ee05c4137b3cd110db344713af5f2 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index fee07cb27e..5962d68246 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4798,7 +4798,7 @@ static int unixShmUnlock( /* Compute locks held by sibling connections */ for(pX=pFile->pFirst; pX; pX=pX->pNext){ if( pX==p ) continue; - assert( (pX->exclMask & unlockMask)==0 ); + assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 ); allMask |= pX->sharedMask; } diff --git a/src/pager.c b/src/pager.c index 0ad245a8c4..ee0c575a59 100644 --- a/src/pager.c +++ b/src/pager.c @@ -2272,6 +2272,16 @@ static int pagerUndoCallback(void *pCtx, Pgno iPg){ } } + /* Normally, if a transaction is rolled back, any backup processes are + ** updated as data is copied out of the rollback journal and into the + ** database. This is not generally possible with a WAL database, as + ** rollback involves simply truncating the log file. Therefore, if one + ** or more frames have already been written to the log (and therefore + ** also copied into the backup databases) as part of this transaction, + ** the backups must be restarted. + */ + sqlite3BackupRestart(pPager->pBackup); + return rc; } @@ -2282,18 +2292,6 @@ static int pagerRollbackWal(Pager *pPager){ int rc; /* Return Code */ PgHdr *pList; /* List of dirty pages to revert */ - /* Normally, if a transaction is rolled back, any backup processes are - ** updated as data is copied out of the rollback journal and into the - ** database. This is not generally possible with a WAL database, as - ** rollback involves simply truncating the log file. Therefore, if one - ** or more frames have already been written to the log (and therefore - ** also copied into the backup databases) as part of this transaction, - ** the backups must be restarted. - */ - if( sqlite3WalDirty(pPager->pWal) ){ - sqlite3BackupRestart(pPager->pBackup); - } - /* For all pages in the cache that are currently dirty or have already ** been written (but not committed) to the log file, do one of the ** following: diff --git a/src/wal.c b/src/wal.c index 9d518c16a0..fa29cb58c7 100644 --- a/src/wal.c +++ b/src/wal.c @@ -829,7 +829,7 @@ int walIndexTryHdr(Wal *pWal, int *pChanged){ static int walIndexReadHdr(Wal *pWal, int *pChanged){ int rc; - assert( pWal->lockState==SQLITE_SHM_READ ); + assert( pWal->lockState>=SQLITE_SHM_READ ); walIndexMap(pWal); /* First try to read the header without a lock. Verify the checksum @@ -1053,14 +1053,6 @@ int sqlite3WalSavepointUndo(Wal *pWal, u32 iFrame){ return rc; } -/* -** Return true if data has been written but not committed to the log file. -*/ -int sqlite3WalDirty(Wal *pWal){ - assert( pWal->lockState==SQLITE_SHM_WRITE ); - return( pWal->hdr.iLastPg!=((WalIndexHdr*)pWal->pWiData)->iLastPg ); -} - /* ** Write a set of frames to the log. The caller must hold the write-lock ** on the log file (obtained using sqlite3WalWriteLock()). diff --git a/src/wal.h b/src/wal.h index 4bab929f01..1c787d8dcd 100644 --- a/src/wal.h +++ b/src/wal.h @@ -59,9 +59,6 @@ u32 sqlite3WalSavepoint(Wal *pWal); ** response to a ROLLBACK TO command. */ int sqlite3WalSavepointUndo(Wal *pWal, u32 iFrame); -/* Return true if data has been written but not committed to the log file. */ -int sqlite3WalDirty(Wal *pWal); - /* Write a frame or frames to the log. */ int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int);