]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Avoid truncating non-in-memory sub-journals when releasing a savepoint for a small...
authorshaneh <shaneh@noemail.net>
Fri, 5 Feb 2010 16:28:00 +0000 (16:28 +0000)
committershaneh <shaneh@noemail.net>
Fri, 5 Feb 2010 16:28:00 +0000 (16:28 +0000)
FossilOrigin-Name: 27dc5b1c52eaa5f99cf44ee31204f62598fbf011

manifest
manifest.uuid
src/pager.c

index 55655e26649c2e11c17fbb506de89cbe55b39447..f80a7cca1b146782d4ca0f20cf7244a8f747af3c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,5 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Remove\sthe\suse\sof\s64-bit\smath\sin\sthe\soffset\scomputations\sof\s\nthe\sOP_Column\sopcode\sfor\sa\ssmall\sperformance\simprovement.
-D 2010-02-05T14:12:54
+C Avoid\struncating\snon-in-memory\ssub-journals\swhen\sreleasing\sa\ssavepoint\sfor\sa\ssmall\sperformance\simprovement.
+D 2010-02-05T16:28:00
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -153,7 +150,7 @@ F src/os_common.h 240c88b163b02c21a9f21f87d49678a0aa21ff30
 F src/os_os2.c 75a8c7b9a00a2cf1a65f9fa4afbc27d46634bb2f
 F src/os_unix.c 0b97269557d5a148d43c55edab5a20b62d0e10e3
 F src/os_win.c 5ffab20249a61e0625f869efe157fa009747039b
-F src/pager.c e5421d38470fe58faee71a5a66a778ada882394c
+F src/pager.c 4cf8da7cf454d09086400c3b2943b41e6e46e829
 F src/pager.h 1b32faf2e578ac3e7bcf9c9d11217128261c5c54
 F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
 F src/pcache.c 815bcb3cf0e14b23212efd3f4981f667a5fd633e
@@ -789,14 +786,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 26cb1df73504d5d883cf0967e57b46aa062d0b00
-R 1958cacd7f583aec4ab73bfa77d04590
-U drh
-Z fc01b4de0eee88e8eb53af6f3beff67e
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFLbCdpoxKgR168RlERAleAAJ9zp4nXhvCTHxqvWnr21SgA/iUicACdEllu
-mfGoLjhZumCpTb2x8CplRYs=
-=/N/5
------END PGP SIGNATURE-----
+P 61a2c8d4d64c28119e9f06eb42f9c0437ba7a7bd
+R 7b780dc261c98bc95bb0a9dcb2e2f834
+U shaneh
+Z d9892d5150c22658e41a11ffe03f2d66
index 52cc347d92072048308179e11e566a1ff7eccb13..31437588c1f2c2bbc2ee6001845c8ea920dce421 100644 (file)
@@ -1 +1 @@
-61a2c8d4d64c28119e9f06eb42f9c0437ba7a7bd
\ No newline at end of file
+27dc5b1c52eaa5f99cf44ee31204f62598fbf011
\ No newline at end of file
index a0576f36d6a25d690baa1de01c6391cc63d62c28..62d9775e1051050063e5376d6a42c9eff55da4cc 100644 (file)
@@ -4981,30 +4981,34 @@ int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){
     ** operation. Store this value in nNew. Then free resources associated 
     ** with any savepoints that are destroyed by this operation.
     */
-    nNew = iSavepoint + (op==SAVEPOINT_ROLLBACK);
+    nNew = iSavepoint + (( op==SAVEPOINT_RELEASE ) ? 0 : 1);
     for(ii=nNew; ii<pPager->nSavepoint; ii++){
       sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint);
     }
     pPager->nSavepoint = nNew;
 
-    /* If this is a rollback operation, playback the specified savepoint.
+    /* If this is a release of the outermost savepoint, truncate 
+    ** the sub-journal to zero bytes in size. */
+    if( op==SAVEPOINT_RELEASE ){
+      if( nNew==0 && isOpen(pPager->sjfd) ){
+        /* Only truncate if it is an in-memory sub-journal. */
+        if( sqlite3IsMemJournal(pPager->sjfd) ){
+          rc = sqlite3OsTruncate(pPager->sjfd, 0);
+        }
+        pPager->nSubRec = 0;
+      }
+    }
+    /* Else this is a rollback operation, playback the specified savepoint.
     ** If this is a temp-file, it is possible that the journal file has
     ** not yet been opened. In this case there have been no changes to
     ** the database file, so the playback operation can be skipped.
     */
-    if( op==SAVEPOINT_ROLLBACK && isOpen(pPager->jfd) ){
+    else if( isOpen(pPager->jfd) ){
       PagerSavepoint *pSavepoint = (nNew==0)?0:&pPager->aSavepoint[nNew-1];
       rc = pagerPlaybackSavepoint(pPager, pSavepoint);
       assert(rc!=SQLITE_DONE);
     }
   
-    /* If this is a release of the outermost savepoint, truncate 
-    ** the sub-journal to zero bytes in size. */
-    if( nNew==0 && op==SAVEPOINT_RELEASE && isOpen(pPager->sjfd) ){
-      assert( rc==SQLITE_OK );
-      rc = sqlite3OsTruncate(pPager->sjfd, 0);
-      pPager->nSubRec = 0;
-    }
   }
   return rc;
 }