]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Avoid unnecessary calls to FCNTL_SIZE_HINT. Return an error to the user if the file...
authordan <dan@noemail.net>
Thu, 23 May 2013 10:13:18 +0000 (10:13 +0000)
committerdan <dan@noemail.net>
Thu, 23 May 2013 10:13:18 +0000 (10:13 +0000)
FossilOrigin-Name: 40cfde8b4a59a09e52e62f9f029f8d3b32eb15fa

manifest
manifest.uuid
src/pager.c
src/pragma.c

index 3429dbcc89a3b307488d2c889e34f0cd81a0e3ea..7448a36d33e8bfca3f3f945aadd8efac1d572a16 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Cause\sthe\smmap_size\sPRAGMA\sto\simmediately\schange\sthe\smmap\sspace\sif\sthe\ndatabase\sconnection\sis\salready\sactive.\s\sIn\sparticular,\sreducing\smmap_size\nwill\simmediately\sfree\sup\sprocess\saddress\sspace.
-D 2013-05-23T01:40:53.974
+C Avoid\sunnecessary\scalls\sto\sFCNTL_SIZE_HINT.\sReturn\san\serror\sto\sthe\suser\sif\sthe\sfile-control\sinvoked\sby\s"PRAGMA\smmap_size"\sreturns\sa\svalue\sother\sthan\sSQLITE_OK\sor\sSQLITE_NOTFOUND.
+D 2013-05-23T10:13:18.105
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in f6b58b7bdf6535f0f0620c486dd59aa4662c0b4f
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -179,13 +179,13 @@ F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f
 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
 F src/os_unix.c 42c9b8b7c61c9fa3561258f523be5749e52ed0e0
 F src/os_win.c 5f018dbd4cec25c5b47e11432b946a7d2ccee60b
-F src/pager.c 49e23f9898113ddfe90942bdf1c1ef57955d0921
+F src/pager.c 3709c5c9e2eb566fffba6348508b7212c4d06ca3
 F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1
 F src/parse.y 9708365594eea519cdc8504dee425c0a41c79502
 F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
 F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222
 F src/pcache1.c 9fd22671c270b35131ef480bbc00392b8b5f8ab9
-F src/pragma.c 8779308bc1ea1901c4bc94dfe9a83d436f73f52c
+F src/pragma.c 8bf4bfaef7975abff45e55230ed1033b5f208d11
 F src/prepare.c 743e484233c51109666d402f470523553b41797c
 F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
 F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
@@ -1066,7 +1066,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P 118a3b35693b134d56ebd780123b7fd6f1497668
-R 743f49e6500daee258364b50095b5869
-U drh
-Z 8b8fce9c808b567d366ba2a76c063d60
+P 761177927cb51e4f5e66061ca39cf37edbe8346b
+R f79c1bfda6a2029cdca9b19f9c8cc1f9
+U dan
+Z 2a86c7dc006c06bc92b2aaaf78345975
index 4ef49c9f547c42bb7e4d0ffb289b49afafd350a4..1a555055215156800e5a495f2eb2ae31fffb3729 100644 (file)
@@ -1 +1 @@
-761177927cb51e4f5e66061ca39cf37edbe8346b
\ No newline at end of file
+40cfde8b4a59a09e52e62f9f029f8d3b32eb15fa
\ No newline at end of file
index 1c6a84fea4bbb96e305adb943d7c35da24361c1a..443f5fb740f8b2e7434d80cccd39e70889527ec9 100644 (file)
@@ -4214,7 +4214,8 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){
   */
   assert( rc!=SQLITE_OK || isOpen(pPager->fd) );
   if( rc==SQLITE_OK 
-   && (pList->pDirty ? pPager->dbSize : pList->pgno+1)>pPager->dbHintSize 
+   && pPager->dbHintSize<pPager->dbSize
+   && (pList->pDirty || pList->pgno>pPager->dbHintSize)
   ){
     sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize;
     sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile);
index 3056a7d8e2b81c390a2fb5dd751dae78a5e4b82c..cde5fd1c77348005f3ed7beaaaaf2583c0f6bbb5 100644 (file)
@@ -774,11 +774,15 @@ void sqlite3Pragma(
       }
     }
     sz = -1;
-    if( sqlite3_file_control(db,zDb,SQLITE_FCNTL_MMAP_SIZE,&sz)==SQLITE_OK ){
+    rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_MMAP_SIZE, &sz);
 #if SQLITE_MAX_MMAP_SIZE==0
-      sz = 0;
+    sz = 0;
 #endif
+    if( rc==SQLITE_OK ){
       returnSingleInt(pParse, "mmap_size", sz);
+    }else if( rc!=SQLITE_NOTFOUND ){
+      pParse->nErr++;
+      pParse->rc = rc;
     }
   }else