From: drh Date: Fri, 23 Dec 2011 02:07:10 +0000 (+0000) Subject: Merge the POWERSAFE_OVERWRITE features and the use of statvfs() from the X-Git-Tag: mountain-lion~8^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc8d10a0fd67013a6b3407e4e2148cc560c9ee4d;p=thirdparty%2Fsqlite.git Merge the POWERSAFE_OVERWRITE features and the use of statvfs() from the statvfs branch into trunk. FossilOrigin-Name: 2370d70eb51d2259aaa8073d861ab79d6637cbd9 --- cc8d10a0fd67013a6b3407e4e2148cc560c9ee4d diff --cc manifest index 2f08ae4c31,5fe186261d..1aebed56f7 --- a/manifest +++ b/manifest @@@ -1,5 -1,5 +1,5 @@@ - C Add\sinterfaces\ssqlite3_uri_boolean()\sand\ssqlite3_uri_int64()\swhich\sare\nwrappers\saround\ssqlite3_uri_parameter()\scombined\swith\sinternal\sroutines\sfor\nconverting\sstrings\sto\sbooleans\sand\s64-bit\sintegers. - D 2011-12-23T00:07:33.075 -C Change\sthe\sname\sZERO_DAMAGE\sto\sthe\smore\sdescriptive\sPOWERSAFE_OVERWRITE.\nThe\squery\sparameter\sused\sto\scontrol\sthis\sdevice\scharacteristic\sis\snow\s"psow". -D 2011-12-23T01:04:17.601 ++C Merge\sthe\sPOWERSAFE_OVERWRITE\sfeatures\sand\sthe\suse\sof\sstatvfs()\sfrom\sthe\nstatvfs\sbranch\sinto\strunk. ++D 2011-12-23T02:07:10.640 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@@ -250,7 -250,7 +250,7 @@@ F src/vdbemem.c 2fc78b3e0fabcc1eaa23cd7 F src/vdbesort.c 468d43c057063e54da4f1988b38b4f46d60e7790 F src/vdbetrace.c d6e50e04e1ec498150e519058f617d91b8f5c843 F src/vtab.c e9318d88feac85be8e27ee783ac8f5397933fc8a - F src/wal.c 5525f049dffd47ee860bf4ffbb8da4ebef78637d -F src/wal.c 13c34ed72fd3a0cb81b3addbc901b3be60430cca ++F src/wal.c 66e2afeec77933f80c8098cfb3c0b29bc875de0f F src/wal.h 42f8313f7aaf8913e2d1fdf7b47025c23491ea1d F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/where.c af623942514571895818b9b7ae11db95ae3b3d88 @@@ -872,7 -872,7 +872,7 @@@ F test/types.test bf816ce73c7dfcfe26b70 F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84 F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a F test/unique.test 083c7fff74695bcc27a71d75699deba3595bc9c2 --F test/unixexcl.test 892937c53d0c16e76631674e38a0fce052ae5e9c ++F test/unixexcl.test c82934b3fda907573c7dfccc4f4c9506e5537f36 F test/unordered.test f53095cee37851bf30130fa1bf299a8845e837bb F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172 F test/uri.test 0d289d32396bdbc491e9dc845f1a52e13f861e0b @@@ -902,11 -902,11 +902,11 @@@ F test/vtabF.test fd5ad376f5a34fe0891df F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d - F test/wal.test c743be787e60c1242fa6cdf73b410e64b2977e25 - F test/wal2.test 29e2cbe840582fc6efd0487b4f6337caed4b3e80 - F test/wal3.test 29a6e8843e5f5fd13f33cb0407d2923107020d32 + F test/wal.test edefe316b4125d7f68004ea53c5e73c398d436cc + F test/wal2.test f11883dd3cb7f647c5d2acfd7b5c6d4ba5770cc9 -F test/wal3.test 0f9bb79aa5712e9fa2343d1cdc9e2785adddcfc2 ++F test/wal3.test 6504bbf348b2d6dfade64a064f1050fd617e8706 F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c - F test/wal5.test 1bbfaa316dc2a1d0d1fac3f4500c38a90055a41b + F test/wal5.test f58ed4b8b542f71c7441da12fbd769d99b362437 F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3 F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe @@@ -985,7 -986,7 +986,7 @@@ F tool/tostr.awk e75472c2f98dd76e06b8c9 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 - P 1c27d842163e27c39bbe9409f50657b9de9ade6e - R 712ad6ea662046687d3fa2e6906d477a -P d5e36327c12f264429eb079bddbb71a310f76389 -R d510fa35ee7302e7724e03225e057408 ++P 83d26b9a9115eadac9e59a33d608bca0ab2519e3 6191c5e45175f5c6040e891843b0725a929d6dd7 ++R 9e1524ff0804966ed866a28455ef991b U drh - Z dfef488f9835a38d5955098b906ef223 -Z cc6357a73838dede95445f3f634219d1 ++Z 88029f358469c654bea2978d031e29f2 diff --cc manifest.uuid index 0daedf9dab,7bfda38bdc..18ed65b934 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - 83d26b9a9115eadac9e59a33d608bca0ab2519e3 -6191c5e45175f5c6040e891843b0725a929d6dd7 ++2370d70eb51d2259aaa8073d861ab79d6637cbd9 diff --cc src/wal.c index fa44b66d32,904138723d..657d59d527 --- a/src/wal.c +++ b/src/wal.c @@@ -2646,26 -2657,43 +2657,43 @@@ static int walWriteToLog sqlite3_int64 iOffset /* Start writing at this offset */ ){ int rc; - if( iOffset>=pWal->szFirstBlock - || iOffset+iAmtszFirstBlock - || pWal->syncFlags==0 - ){ - /* The common and fast case. Just write the data. */ - rc = sqlite3OsWrite(pWal->pWalFd, pContent, iAmt, iOffset); - }else{ - /* If this write will cross the first sector boundary, it has to - ** be split it two with a sync in between. */ - int iFirstAmt = pWal->szFirstBlock - iOffset; - assert( iFirstAmt>0 && iFirstAmtpWalFd, pContent, iFirstAmt, iOffset); - if( rc ) return rc; - assert( pWal->syncFlags & (SQLITE_SYNC_NORMAL|SQLITE_SYNC_FULL) ); - rc = sqlite3OsSync(pWal->pWalFd, pWal->syncFlags); + if( iOffsetiSyncPoint && iOffset+iAmt>=p->iSyncPoint ){ + int iFirstAmt = (int)(p->iSyncPoint - iOffset); + rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset); if( rc ) return rc; + iOffset += iFirstAmt; + iAmt -= iFirstAmt; pContent = (void*)(iFirstAmt + (char*)pContent); - rc = sqlite3OsWrite(pWal->pWalFd, pContent, - iAmt-iFirstAmt, iOffset+iFirstAmt); + assert( p->syncFlags & (SQLITE_SYNC_NORMAL|SQLITE_SYNC_FULL) ); + rc = sqlite3OsSync(p->pFd, p->syncFlags); - if( rc ) return rc; ++ if( iAmt==0 || rc ) return rc; } + rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset); + return rc; + } + + /* + ** Write out a single frame of the WAL + */ + static int walWriteOneFrame( + WalWriter *p, /* Where to write the frame */ + PgHdr *pPage, /* The page of the frame to be written */ + int nTruncate, /* The commit flag. Usually 0. >0 for commit */ + sqlite3_int64 iOffset /* Byte offset at which to write */ + ){ + int rc; /* Result code from subfunctions */ + void *pData; /* Data actually written */ + u8 aFrame[WAL_FRAME_HDRSIZE]; /* Buffer to assemble frame-header in */ + #if defined(SQLITE_HAS_CODEC) + if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM; + #else + pData = pPage->pData; + #endif + walEncodeFrame(p->pWal, pPage->pgno, nTruncate, pData, aFrame); + rc = walWriteToLog(p, aFrame, sizeof(aFrame), iOffset); + if( rc ) return rc; + /* Write the page data */ + rc = walWriteToLog(p, pData, p->szPage, iOffset+sizeof(aFrame)); return rc; } diff --cc test/unixexcl.test index 207078acde,207078acde..8c64488d75 --- a/test/unixexcl.test +++ b/test/unixexcl.test @@@ -82,8 -82,8 +82,8 @@@ do_multiclient_test tn do_multiclient_test tn { do_test unixexcl-3.$tn.1 { -- code1 { db close; sqlite3 db test.db -vfs unix-excl } -- code2 { db2 close; sqlite3 db2 test.db -vfs unix-excl } ++ code1 { db close; sqlite3 db file:test.db?psow=0 -vfs unix-excl -uri 1 } ++ code2 { db2 close; sqlite3 db2 file:test.db?psow=0 -vfs unix-excl -uri 1 } sql1 { PRAGMA journal_mode = WAL; CREATE TABLE t1(a, b); @@@ -108,7 -108,7 +108,7 @@@ } {1 2} do_test unixexcl-3.$tn.3 { sql1 { PRAGMA wal_checkpoint; INSERT INTO t1 VALUES(3, 4); } -- } {0 5 5} ++ } {0 3 3} do_test unixexcl-3.$tn.4 { sql2 { SELECT * FROM t1; } } {1 2} @@@ -120,7 -120,7 +120,7 @@@ } {1 2 3 4} do_test unixexcl-3.$tn.7 { sql1 { PRAGMA wal_checkpoint; } -- } {0 7 7} ++ } {0 4 4} } }