]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a couple of assert() statements in os_unix.c and wal.c. Combine sqlite3WalIsDirty...
authordan <dan@noemail.net>
Fri, 30 Apr 2010 09:52:17 +0000 (09:52 +0000)
committerdan <dan@noemail.net>
Fri, 30 Apr 2010 09:52:17 +0000 (09:52 +0000)
FossilOrigin-Name: a8f958be804ee05c4137b3cd110db344713af5f2

manifest
manifest.uuid
src/os_unix.c
src/pager.c
src/wal.c
src/wal.h

index 552a63398fb95ee55a84bb4e77eadd88d7f23050..6271923420b75c738e0fe5891d67795f8c0f0692 100644 (file)
--- 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
index 8d2667d65245ee6f8e20da78676ae10c0acc04f7..dd868c121165e71565b6005b47b820a999b5fbd3 100644 (file)
@@ -1 +1 @@
-72b95fde15dae56390dc8d4168fb2757447e289e
\ No newline at end of file
+a8f958be804ee05c4137b3cd110db344713af5f2
\ No newline at end of file
index fee07cb27e4e618dd8b74660de3a83bf652fb004..5962d68246278accccfda70a6b7af9d82b384cc0 100644 (file)
@@ -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;
   }
 
index 0ad245a8c4962022fa0ab95fc7e13d45fc204fde..ee0c575a59c4523ef485e6241f00bcb579b26b9e 100644 (file)
@@ -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:
index 9d518c16a096853ae7a7c624dabbc160cc603f06..fa29cb58c7a863aa6f2a3e48e06a109e3e29d1af 100644 (file)
--- 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()).
index 4bab929f016959b225866b4fd91b1a162b79b65b..1c787d8dcdf3d8fdacf64f588e89206d57c9b3e9 100644 (file)
--- 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);