]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Modify the test_journal.c code to (1) account for the backup code writing to parts...
authordanielk1977 <danielk1977@noemail.net>
Wed, 11 Feb 2009 07:38:11 +0000 (07:38 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Wed, 11 Feb 2009 07:38:11 +0000 (07:38 +0000)
FossilOrigin-Name: 4879621658c2c785ab7b12dbae780901496d3a78

manifest
manifest.uuid
src/test_journal.c

index b15ef3abd4eef23cdd29701b61a900d9acf43db4..6a1e047aa1aee9391da80f381c32c66fb8ed608d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\stest_mutex.c,\szero\sthe\sglobal\sstructure\sstaticly\sinstead\sof\sin\sSqlitetest_mutex_Init().\sThis\sis\sbecause\sSqlitetest_mutex_Init()\sis\snow\scalled\sby\seach\sthread\sduring\sthread\stests\s((6193)).\sTest\scode\schanges\sonly.\s(CVS\s6279)
-D 2009-02-11T05:18:07
+C Modify\sthe\stest_journal.c\scode\sto\s(1)\saccount\sfor\sthe\sbackup\scode\swriting\sto\sparts\sof\sthe\spending-byte\spage\swhen\schanging\sa\sdatabases\spage-size,\sand\s(2)\sto\savoid\sreading\sfrom\sthe\spending-byte\spage\sand\striggering\sthe\sassert\sin\sos_unix.c.\sChanges\sto\stest\scode\sonly.\s(CVS\s6280)
+D 2009-02-11T07:38:12
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in c7a5a30fb6852bd7839b1024e1661da8549878ee
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -181,7 +181,7 @@ F src/test_config.c 9dd62f4bb725ad87d28b187b07377cb4f4a43197
 F src/test_devsym.c 9f4bc2551e267ce7aeda195f3897d0f30c5228f4
 F src/test_func.c a55c4d5479ff2eb5c0a22d4d88e9528ab59c953b
 F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
-F src/test_journal.c 0f4b9a929fae2be5bee0230f29204227c3d76c71
+F src/test_journal.c 15f9d0132d97bcc695b0c0e3e29ec8a73f0f430e
 F src/test_loadext.c 97dc8800e46a46ed002c2968572656f37e9c0dd9
 F src/test_malloc.c d23050c7631ec9ee0369c7ca905e6c9233968e11
 F src/test_md5.c 032ae2bb6f81da350d2404e81fa8d560c8268026
@@ -701,7 +701,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 2da076a2c1663e916dc50e5e1679be216922dfc5
-R 183a0bce67e12d80eb1e99f8c034c4cc
+P 8b318b9385d0542ca56750b901c0c6b7d05ca634
+R 9a8fca6b31553509b67660a185c0a0d1
 U danielk1977
-Z bd1c3b31b6fc6d323855e59951084116
+Z 710356677aa5921b82da35e3db1360ce
index 774527dd5387a2bc307a3c6462e03ecbb416c7cc..36f1c60cc3c8e2925897b0625224e589ae09da69 100644 (file)
@@ -1 +1 @@
-8b318b9385d0542ca56750b901c0c6b7d05ca634
\ No newline at end of file
+4879621658c2c785ab7b12dbae780901496d3a78
\ No newline at end of file
index 63f772c8a6764fced44a493d57d9ebbe4fb6fdab..a7947ab32f4dd7305660af5c4c5f3f1c31839f79 100644 (file)
@@ -15,7 +15,7 @@
 ** correctly populates and syncs a journal file before writing to a
 ** corresponding database file.
 **
-** $Id: test_journal.c,v 1.9 2009/01/11 18:24:27 drh Exp $
+** $Id: test_journal.c,v 1.10 2009/02/11 07:38:12 danielk1977 Exp $
 */
 #if SQLITE_TEST          /* This file is used for testing only */
 
@@ -367,6 +367,7 @@ static int openTransaction(jt_file *pMain, jt_file *pJournal){
       int ii;
       for(ii=0; rc==SQLITE_OK && ii<pMain->nPage; ii++){
         i64 iOff = (i64)(pMain->nPagesize) * (i64)ii;
+        if( iOff==PENDING_BYTE ) continue;
         rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff);
         pMain->aCksum[ii] = genCksum(aData, pMain->nPagesize);
       }
@@ -411,11 +412,22 @@ static int jtWrite(
   }
 
   if( p->flags&SQLITE_OPEN_MAIN_DB && p->pWritable ){
-    u32 pgno = iOfst/p->nPagesize + 1;
-
-    assert( (iAmt==1 || iAmt==p->nPagesize) && ((iOfst+iAmt)%p->nPagesize)==0 );
-    assert( pgno<=p->nPage || p->nSync>0 );
-    assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) );
+    if( iAmt<p->nPagesize 
+     && p->nPagesize%iAmt==0 
+     && iOfst>=(PENDING_BYTE+512) 
+     && iOfst+iAmt<=PENDING_BYTE+p->nPagesize
+    ){
+      /* No-op. This special case is hit when the backup code is copying a
+      ** to a database with a larger page-size than the source database and
+      ** it needs to fill in the non-locking-region part of the original
+      ** pending-byte page.
+      */
+    }else{
+      u32 pgno = iOfst/p->nPagesize + 1;
+      assert( (iAmt==1||iAmt==p->nPagesize) && ((iOfst+iAmt)%p->nPagesize)==0 );
+      assert( pgno<=p->nPage || p->nSync>0 );
+      assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) );
+    }
   }
 
   return sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst);