]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Merge the POWERSAFE_OVERWRITE features and the use of statvfs() from the
authordrh <drh@noemail.net>
Fri, 23 Dec 2011 02:07:10 +0000 (02:07 +0000)
committerdrh <drh@noemail.net>
Fri, 23 Dec 2011 02:07:10 +0000 (02:07 +0000)
statvfs branch into trunk.

FossilOrigin-Name: 2370d70eb51d2259aaa8073d861ab79d6637cbd9

1  2 
manifest
manifest.uuid
src/wal.c
test/unixexcl.test
test/wal3.test

diff --cc manifest
index 2f08ae4c31f0fa156dc532eb0e50babe8b92d33e,5fe186261de23a14f3263571e611387990843564..1aebed56f70c94387fb1988ccfada683edc25bed
+++ 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 0daedf9dabe988a219d137f4d623a4b715760e1d,7bfda38bdc386fff7ee4538087cd3366285f1950..18ed65b93493f6c7ad7a8a600d949f1e3847eb8c
@@@ -1,1 -1,1 +1,1 @@@
- 83d26b9a9115eadac9e59a33d608bca0ab2519e3
 -6191c5e45175f5c6040e891843b0725a929d6dd7
++2370d70eb51d2259aaa8073d861ab79d6637cbd9
diff --cc src/wal.c
index fa44b66d321e2e1699ad22ae957fc0dab7d213c7,904138723d9e19e27d876006b9b435040e5fcd36..657d59d527fc373e9a331094ee9c6fa9e65033b5
+++ 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+iAmt<pWal->szFirstBlock
-    || 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 && iFirstAmt<iAmt );
-     rc = sqlite3OsWrite(pWal->pWalFd, pContent, iFirstAmt, iOffset);
-     if( rc ) return rc;
-     assert( pWal->syncFlags & (SQLITE_SYNC_NORMAL|SQLITE_SYNC_FULL) );
-     rc = sqlite3OsSync(pWal->pWalFd, pWal->syncFlags);
+   if( iOffset<p->iSyncPoint && 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;
  }
  
index 207078acdeb1998ab9f3eac7091b4f162bde16ab,207078acdeb1998ab9f3eac7091b4f162bde16ab..8c64488d755b5fa6f62598f2cc3a712ced72c8a4
@@@ -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);
      } {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}
      } {1 2 3 4}
      do_test unixexcl-3.$tn.7 {
        sql1 { PRAGMA wal_checkpoint; }
--    } {0 7 7}
++    } {0 4 4}
    }
  }
  
diff --cc test/wal3.test
Simple merge