]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Mark untestable branches of memjournal.c as such. Reduce the size of a
authordrh <drh@noemail.net>
Wed, 1 Apr 2009 23:09:43 +0000 (23:09 +0000)
committerdrh <drh@noemail.net>
Wed, 1 Apr 2009 23:09:43 +0000 (23:09 +0000)
single block allocation to a power of two.  Reenable the inmemory_journal
permutation test. (CVS 6431)

FossilOrigin-Name: 05c182a5db9fa96f2d588dd884ce77916b0e60e4

manifest
manifest.uuid
src/memjournal.c
test/permutations.test

index 5745066d10ef1344808282669b9d9d7d351332fe..8dcbf40f2d61fd0b698d78476b444482099f917e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\sstrftime()\sfunction\sso\sthat\sthe\s%s\sformat\scan\shandle\sdates\soutside\nof\sthe\srange\sof\s1901\sto\s2038.\s\sTicket\s#3769.\s(CVS\s6430)
-D 2009-04-01T20:44:14
+C Mark\suntestable\sbranches\sof\smemjournal.c\sas\ssuch.\s\sReduce\sthe\ssize\sof\sa\nsingle\sblock\sallocation\sto\sa\spower\sof\stwo.\s\sReenable\sthe\sinmemory_journal\npermutation\stest.\s(CVS\s6431)
+D 2009-04-01T23:09:44
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -129,7 +129,7 @@ F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
 F src/mem2.c d02bd6a5b34f2d59012a852615621939d9c09548
 F src/mem3.c 67153ec933e08b70714055e872efb58a6b287939
 F src/mem5.c 838309b521c96a2a34507f74a5a739d28de4aac6
-F src/memjournal.c 17e9281ea5d7981e3e7b0dd3274921ecba4f773c
+F src/memjournal.c 2fc78ced7b47ba54efbf15a129f09e0733f6adbd
 F src/mutex.c 5e2ea0e0490a3567dc08a014bcee748c0cea727f
 F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e
 F src/mutex_noop.c f5a07671f25a1a9bd7c10ad7107bc2585446200f
@@ -491,7 +491,7 @@ F test/pageropt.test 3ee6578891baaca967f0bd349e4abfa736229e1a
 F test/pagesize.test 0d9ff3fedfce6e5ffe8fa7aca9b6d3433a2e843b
 F test/pcache.test 70ad1d65cf73f6a0a7501e0236312eb214d93a55
 F test/pcache2.test 46efd980a89f737847b99327bda19e08fe11e402
-F test/permutations.test 2e777ae1eeb11b777b31aad929c4351464758441
+F test/permutations.test 7129bc5d215dfe1da527b784b95b041a5a2be397
 F test/pragma.test a35b0be36542477183168cdb8b743f5c0d883c4d
 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
 F test/printf.test 47e9e5bbec8509023479d54ceb71c9d05a95308a
@@ -714,7 +714,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 36115e4073528f03253dd94fadf3954522c0dfb9
-R 00a8b22d9cb1f0d232f45571019310a5
+P a95b843a9251ca9f9a23e8b67c2126f4c297a534
+R ba76a4ea435a4c583deb3a28012fe1b7
 U drh
-Z 410f6e88d081a33d059402dd6e5bba76
+Z 248166af0729a14ff40d76e777b3eb92
index 2fee84e7d69d07afa68c6d02649ecf65beac15aa..07e6f9a3030773ddc8f3565fc1ef67e554e658a8 100644 (file)
@@ -1 +1 @@
-a95b843a9251ca9f9a23e8b67c2126f4c297a534
\ No newline at end of file
+05c182a5db9fa96f2d588dd884ce77916b0e60e4
\ No newline at end of file
index 945b5da503f6f02c0e38ad7c2e6328d9017d5e9d..930c7857192de10b54d841affa30f1022fcc0941 100644 (file)
@@ -14,7 +14,7 @@
 ** The in-memory rollback journal is used to journal transactions for
 ** ":memory:" databases and when the journal_mode=MEMORY pragma is used.
 **
-** @(#) $Id: memjournal.c,v 1.8 2008/12/20 02:14:40 drh Exp $
+** @(#) $Id: memjournal.c,v 1.9 2009/04/01 23:09:44 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -25,8 +25,13 @@ typedef struct FileChunk FileChunk;
 
 /* Space to hold the rollback journal is allocated in increments of
 ** this many bytes.
+**
+** The size chosen is a little less than a power of two.  That way,
+** the FileChunk object will have a size that almost exactly fills
+** a power-of-two allocation.  This mimimizes wasted space in power-of-two
+** memory allocators.
 */
-#define JOURNAL_CHUNKSIZE 1024
+#define JOURNAL_CHUNKSIZE (1024-sizeof(FileChunk*))
 
 /* Macro to find the minimum of two numeric values.
 */
@@ -63,7 +68,8 @@ struct MemJournal {
 };
 
 /*
-** Read data from the file.
+** Read data from the in-memory journal file.  This is the implementation
+** of the sqlite3_vfs.xRead method.
 */
 static int memjrnlRead(
   sqlite3_file *pJfd,    /* The journal file from which to read */
@@ -77,12 +83,13 @@ static int memjrnlRead(
   int iChunkOffset;
   FileChunk *pChunk;
 
+  /* SQLite never tries to read past the end of a rollback journal file */
   assert( iOfst+iAmt<=p->endpoint.iOffset );
 
   if( p->readpoint.iOffset!=iOfst || iOfst==0 ){
     sqlite3_int64 iOff = 0;
     for(pChunk=p->pFirst; 
-        pChunk && (iOff+JOURNAL_CHUNKSIZE)<=iOfst;
+        ALWAYS(pChunk) && (iOff+JOURNAL_CHUNKSIZE)<=iOfst;
         pChunk=pChunk->pNext
     ){
       iOff += JOURNAL_CHUNKSIZE;
@@ -185,11 +192,17 @@ static int memjrnlClose(sqlite3_file *pJfd){
 
 /*
 ** Sync the file.
+**
+** Syncing an in-memory journal is a no-op.  And, in fact, this routine
+** is never called in a working implementation.  This implementation
+** exists purely as a contingency, in case some malfunction in some other
+** part of SQLite causes Sync to be called by mistake.
 */
-static int memjrnlSync(sqlite3_file *NotUsed, int NotUsed2){
-  UNUSED_PARAMETER2(NotUsed, NotUsed2);
-  return SQLITE_OK;
-}
+static int memjrnlSync(sqlite3_file *NotUsed, int NotUsed2){   /*NO_TEST*/
+  UNUSED_PARAMETER2(NotUsed, NotUsed2);                        /*NO_TEST*/
+  assert( 0 );                                                 /*NO_TEST*/
+  return SQLITE_OK;                                            /*NO_TEST*/
+}                                                              /*NO_TEST*/
 
 /*
 ** Query the size of the file in bytes.
index ec815ce56255b0c6af9874c1c0bcba0559bb16bb..6553e128627c139ad640704e7d1c18f4874a5955 100644 (file)
@@ -9,7 +9,7 @@
 #
 #***********************************************************************
 #
-# $Id: permutations.test,v 1.45 2009/01/10 18:51:40 danielk1977 Exp $
+# $Id: permutations.test,v 1.46 2009/04/01 23:09:44 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -39,7 +39,7 @@ if {$::perm::testmode eq "all" || $::perm::testmode eq ""} {
   set ::perm::testmode {
     memsubsys1 memsubsys2 singlethread multithread onefile utf16 exclusive
     persistent_journal persistent_journal_error no_journal no_journal_error
-    autovacuum_ioerr no_mutex_try fullmutex journaltest
+    autovacuum_ioerr no_mutex_try fullmutex journaltest inmemory_journal
   }
 }
 if {$::perm::testmode eq "targets"} { 
@@ -451,12 +451,12 @@ run_tests "inmemory_journal" -description {
   # Exclude all tests that simulate IO errors.
   autovacuum_ioerr2.test incrvacuum_ioerr.test ioerr.test
   ioerr.test ioerr2.test ioerr3.test ioerr4.test ioerr5.test
-  vacuum3.test incrblob_err.test diskfull.test 
+  vacuum3.test incrblob_err.test diskfull.test backup_ioerr.test
 
   # Exclude test scripts that use tcl IO to access journal files or count
   # the number of fsync() calls.
   pager.test exclusive.test jrnlmode.test sync.test misc1.test 
-  journal1.test conflict.test
+  journal1.test conflict.test crash8.test tkt3457.test
 }
 
 ifcapable mem3 {