]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Enable the SQLITE_FCNTL_SIZE_HINT on unix even if SQLITE_FCNTL_CHUNK_SIZE
authordrh <drh@noemail.net>
Mon, 25 Jul 2011 23:25:47 +0000 (23:25 +0000)
committerdrh <drh@noemail.net>
Mon, 25 Jul 2011 23:25:47 +0000 (23:25 +0000)
has not been set.

FossilOrigin-Name: 05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b

manifest
manifest.uuid
src/os_unix.c
test/wal5.test

index 758a9c3780246da19d17f2a92d98a6e05c1d2635..e1657062a69f1b2d82516938c779f3be7226dc1d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Merge\sthe\swinAccess\sretry\slogic\sfrom\sthe\santi-antivirus\sbranch\ninto\sthe\strunk.
-D 2011-07-23T13:54:34.013
+C Enable\sthe\sSQLITE_FCNTL_SIZE_HINT\son\sunix\seven\sif\sSQLITE_FCNTL_CHUNK_SIZE\nhas\snot\sbeen\sset.
+D 2011-07-25T23:25:47.867
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -165,7 +165,7 @@ F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b
 F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58
 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
-F src/os_unix.c dcd6d5782dd30e918dc3d111cdcb1883bfb95345
+F src/os_unix.c b83e0924d1a832a89989d3d2770179205d0e066a
 F src/os_win.c 8449cb4ce1cd50248b7133108532d9582cc6c042
 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41
 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
@@ -881,7 +881,7 @@ F test/wal.test 5617ad308bfdb8a8885220d8a261a6096a8d7e57
 F test/wal2.test aa0fb2314b3235be4503c06873e41ebfc0757782
 F test/wal3.test d512a5c8b4aa345722d11e8f1671db7eb15a0e39
 F test/wal4.test 3404b048fa5e10605facaf70384e6d2943412e30
-F test/wal5.test f06a0427e06db00347e32eb9fa99d6a5c0f2d088
+F test/wal5.test 08e145a352b1223930c7f0a1de82a8747a99c322
 F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3
 F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
 F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe
@@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262
-P 6fb7cfc2efb32dd5c8921a90b853390bc44d4794 a6b85c73406caa3bf0585341c8ebc9897a1884f4
-R 1255c11fb87a761a1f8eac495b8a38b4
+P 08d0e8799e1441ef063b1cdf9e4107071a0f81ca
+R 513a198a27aca1f07c596d222f883111
 U drh
-Z 2eecc3b1645ef2e7bef18a04829340dc
+Z bf5f24c7092583c5f65553c09e369462
index 96e327d41a18ed9ae05226238a6e2daf00f1b51a..3e9f01365c096980065d817f3d03aa280eec37ec 100644 (file)
@@ -1 +1 @@
-08d0e8799e1441ef063b1cdf9e4107071a0f81ca
\ No newline at end of file
+05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b
\ No newline at end of file
index b2956c1647e8aa163136514f6a6653a022b7bbbd..dce13e5365388b7e95033cc9f47224fe7ebde0c2 100644 (file)
@@ -3395,13 +3395,19 @@ static int proxyFileControl(sqlite3_file*,int,void*);
 ** SQLITE_FCNTL_SIZE_HINT operation is a no-op for Unix.
 */
 static int fcntlSizeHint(unixFile *pFile, i64 nByte){
-  if( pFile->szChunk ){
+  { /* preserve indentation of removed "if" */
     i64 nSize;                    /* Required file size */
+    i64 szChunk;                  /* Chunk size */
     struct stat buf;              /* Used to hold return values of fstat() */
    
     if( osFstat(pFile->h, &buf) ) return SQLITE_IOERR_FSTAT;
 
-    nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
+    szChunk = pFile->szChunk;
+    if( szChunk==0 ){
+      nSize = nByte;
+    }else{
+      nSize = ((nByte+szChunk-1) / szChunk) * szChunk;
+    }
     if( nSize>(i64)buf.st_size ){
 
 #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE
index 0c700dfc50595e458a584c0a81464e5be8758abc..af4056ccd26354e6e4ef2f155dfb844781cb3efb 100644 (file)
@@ -235,14 +235,7 @@ foreach {testprefix do_wal_checkpoint} {
     do_test 2.3.$tn.5 { sql1 { INSERT INTO t2 VALUES(3, 4) } } {}
     do_test 2.3.$tn.6 { file_page_counts } {1 7 1 7}
     do_test 2.3.$tn.7 { code1 { do_wal_checkpoint db -mode full } } {1 7 5}
-    if {$tcl_platform(platform) == "windows"} {
-        # on unix, the size_hint is a no-op if no chunk size is set.
-        # the windows implementation does not have a similar check,
-        # and because of this, the db file size has an extra page.
-        do_test 2.3.$tn.8 { file_page_counts } {2 7 2 7}
-    } {
-        do_test 2.3.$tn.8 { file_page_counts } {1 7 2 7}
-    }
+    do_test 2.3.$tn.8 { file_page_counts } {2 7 2 7}
   }
 
   # Check that checkpoints block on the correct locks. And respond correctly
@@ -350,4 +343,3 @@ foreach {testprefix do_wal_checkpoint} {
 
 
 finish_test
-