]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Speed improvements by avoiding unnecessary calls to fstat() and ftruncate(). (CVS...
authordrh <drh@noemail.net>
Mon, 20 Apr 2009 11:34:26 +0000 (11:34 +0000)
committerdrh <drh@noemail.net>
Mon, 20 Apr 2009 11:34:26 +0000 (11:34 +0000)
FossilOrigin-Name: 5b7e3a411a6f2fe296675de9467783f6625cff3f

manifest
manifest.uuid
src/pager.c

index 87a570653e2018b371ef8786dacf1106bd834b6f..cac6a849cbc9c93cab97f7844bc2e25ea3c8325d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\scomments\sand\sremove\sunused\scode\sin\sbtree.c.\s\sNo\sfunctional\schanges.\s(CVS\s6521)
-D 2009-04-19T20:51:07
+C Speed\simprovements\sby\savoiding\sunnecessary\scalls\sto\sfstat()\sand\sftruncate().\s(CVS\s6522)
+D 2009-04-20T11:34:27
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -143,7 +143,7 @@ F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc
 F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
 F src/os_unix.c 9ad9f45049a3c9eb0b0713b162ff0d7024ff7259
 F src/os_win.c c3d0354b9a7ae75e3e993e6c17f5deb061acbc36
-F src/pager.c e8d2bb957f01f1d030798b8ee039327bb3000d65
+F src/pager.c 2ad6a948040f802508acddf4052f29b04802b3db
 F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f
 F src/parse.y b7e4341b21736a90b952aa6bb663ec98529b778e
 F src/pcache.c 395f752a13574120bd7513a400ba02a265aaa76d
@@ -717,7 +717,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P d80822953c2d2f2fd7f6acdd3caa403c0decacc4
-R 1aeac7e626ad8c712d8be267be9624bb
+P bd860184909b7a9cc32c59770ebcee0efdc491f0
+R 54bee78449bd233f2681af75ee3baa1f
 U drh
-Z e1e6fd3e9710fd0e165194b49bd9ea30
+Z e4faa13a740c6f189e281ee604da4368
index 2d748534feb013b58bc7ab06e9197490b384ea24..61e48d641f30298230720831c8ffcdeba0aeff1c 100644 (file)
@@ -1 +1 @@
-bd860184909b7a9cc32c59770ebcee0efdc491f0
\ No newline at end of file
+5b7e3a411a6f2fe296675de9467783f6625cff3f
\ No newline at end of file
index dfdfccd2d4a741fe553b3a13dd1ef7a70343025a..b42f299e2495b6cfeb72c19276716a8d9cf446fc 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.580 2009/04/11 16:27:50 drh Exp $
+** @(#) $Id: pager.c,v 1.581 2009/04/20 11:34:27 drh Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -1041,6 +1041,7 @@ static void pager_reset(Pager *pPager){
   if( SQLITE_OK==pPager->errCode ){
     sqlite3BackupRestart(pPager->pBackup);
     sqlite3PcacheClear(pPager->pPCache);
+    pPager->dbSizeValid = 0;
   }
 }
 
@@ -1290,7 +1291,11 @@ static int pager_end_transaction(Pager *pPager, int hasMaster){
         rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);
       }
     }else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){
-      rc = sqlite3OsTruncate(pPager->jfd, 0);
+      if( pPager->journalOff==0 ){
+        rc = SQLITE_OK;
+      }else{
+        rc = sqlite3OsTruncate(pPager->jfd, 0);
+      }
       pPager->journalOff = 0;
       pPager->journalStarted = 0;
     }else if( pPager->exclusiveMode 
@@ -3664,9 +3669,15 @@ static int pagerSharedLock(Pager *pPager){
 /*
 ** If the reference count has reached zero, rollback any active
 ** transaction and unlock the pager.
+**
+** Except, in locking_mode=EXCLUSIVE when there is nothing to in
+** the rollback journal, the unlock is not performed and there is
+** nothing to rollback, so this routine is a no-op.
 */ 
 static void pagerUnlockIfUnused(Pager *pPager){
-  if( sqlite3PcacheRefCount(pPager->pPCache)==0 ){
+  if( (sqlite3PcacheRefCount(pPager->pPCache)==0)
+   && (!pPager->exclusiveMode || pPager->journalOff>0) 
+  ){
     pagerUnlockAndRollback(pPager);
   }
 }