]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Adjustments for better 64K page size handling.
authordrh <drh@noemail.net>
Sat, 14 Aug 2010 21:21:24 +0000 (21:21 +0000)
committerdrh <drh@noemail.net>
Sat, 14 Aug 2010 21:21:24 +0000 (21:21 +0000)
FossilOrigin-Name: faf1974e2de321bfefb68b81d702ae69771933ef

manifest
manifest.uuid
src/btree.c
src/wal.c

index 8e5a48322b8d171f69806d17c2688e03aaaecac1..6d8c9d2cc338d916175c527c5410aa27f3f615c3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,8 @@
-C Add\stest\scase\sto\se_expr.test.
-D 2010-08-14T18:32:24
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+C Adjustments\sfor\sbetter\s64K\spage\ssize\shandling.
+D 2010-08-14T21:21:25
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -113,7 +116,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
 F src/backup.c 51d83300fe0baee39405c416ceb19a58ed30a8ed
 F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef
 F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff
-F src/btree.c f5758ebc3601b57ed8510b97b3d4cff8dcaef995
+F src/btree.c 083ced0941ef7c3bcb667b7319114ab492ed4325
 F src/btree.h b4ba2fdf6b64c7c376bdfffa826af6b786b151d9
 F src/btreeInt.h 5b034ff54800046cc5870605d683ac1f9134bd99
 F src/build.c 0018d49629fc4807100c988dd191dd95e185bb38
@@ -227,7 +230,7 @@ F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256
 F src/vdbemem.c e5673f81a2381b35c60e73ef0a8502be2ab1041e
 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
 F src/vtab.c 0e8e0cb30dffb078367e843e84e37ef99236c7e4
-F src/wal.c c79ae356eb124ba2ca4e9842e30bc1fa9c0ef273
+F src/wal.c c2d20c37c594e8d67facb273184fcd70e881bd02
 F src/wal.h 96669b645e27cd5a111ba59f0cae7743a207bc3c
 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
 F src/where.c 7db3e41c2a846f9deeb24f1bbb75461b4010b7b5
@@ -843,7 +846,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 7dd78eb7974ec7c40af3fcf2b125ca5bc0766b5c
-R 0228d9fad28861af037393c6d2923e36
-U dan
-Z 43f60defab7e944b5b137eea1702bf95
+P db9539f2ceabd3c5a3eb5d4701f80f4e7da9344d
+R 1a92e64b60334d2b1f13f1288894a05a
+U drh
+Z cb5fbd482dc54c48c890fe543adb260b
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFMZwjYoxKgR168RlERAuTTAKCAlGN4ms1osdDGqkAZEJOT1U/ayQCeKWVo
+j5q8jHm2fn070zRuR44G9+w=
+=r7zM
+-----END PGP SIGNATURE-----
index c9e02439cfac3cb1843dde932bd1776484abdfdb..685cbbcb9f05f2f289284ddae2368aaf8cf9c6c3 100644 (file)
@@ -1 +1 @@
-db9539f2ceabd3c5a3eb5d4701f80f4e7da9344d
\ No newline at end of file
+faf1974e2de321bfefb68b81d702ae69771933ef
\ No newline at end of file
index b90128eba4f5a04612a285bcdeef3196740cc6bb..89e6408b584f75673b4d39088f19f4a5f345ccda 100644 (file)
@@ -7677,7 +7677,7 @@ static int checkTreePage(
     cellStart = hdr + 12 - 4*pPage->leaf;
     for(i=0; i<nCell; i++){
       int pc = get2byte(&data[cellStart+i*2]);
-      u16 size = 1024;
+      u32 size = 65536;
       int j;
       if( pc<=usableSize-4 ){
         size = cellSizePtr(pPage, &data[pc]);
index 97e3205bb103cb76afede2a28a7284918499b084..19fc53cbc90cb716ad7137941a86dcd6e25bbbf5 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -292,6 +292,10 @@ typedef struct WalCkptInfo WalCkptInfo;
 **
 ** The actual header in the wal-index consists of two copies of this
 ** object.
+**
+** The szPage value can be any power of 2 between 512 and 32768, inclusive.
+** Or it can be 1 to represent a 65536-byte page.  The latter case was
+** added in 3.7.1 when support for 64K pages was added.  
 */
 struct WalIndexHdr {
   u32 iVersion;                   /* Wal-index version */
@@ -299,7 +303,7 @@ struct WalIndexHdr {
   u32 iChange;                    /* Counter incremented each transaction */
   u8 isInit;                      /* 1 when initialized */
   u8 bigEndCksum;                 /* True if checksums in WAL are big-endian */
-  u16 szPage;                     /* Database page size in bytes */
+  u16 szPage;                     /* Database page size in bytes. 1==64K */
   u32 mxFrame;                    /* Index of last valid frame in the WAL */
   u32 nPage;                      /* Size of database in pages */
   u32 aFrameCksum[2];             /* Checksum of last frame in log */
@@ -1131,7 +1135,9 @@ static int walIndexRecover(Wal *pWal){
       if( nTruncate ){
         pWal->hdr.mxFrame = iFrame;
         pWal->hdr.nPage = nTruncate;
-        pWal->hdr.szPage = (szPage>=0x10000) ? (szPage>>16) : szPage;
+        pWal->hdr.szPage = (szPage&0xff00) | (szPage>>16);
+        testcase( szPage<=32768 );
+        testcase( szPage>=65536 );
         aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
         aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
       }
@@ -1525,8 +1531,9 @@ static int walCheckpoint(
   int i;                          /* Loop counter */
   volatile WalCkptInfo *pInfo;    /* The checkpoint status information */
 
-  szPage = pWal->hdr.szPage;
-  if( szPage<512 ) szPage <<= 16;
+  szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
+  testcase( szPage<=32768 );
+  testcase( szPage>=65536 );
   if( pWal->hdr.mxFrame==0 ) return SQLITE_OK;
 
   /* Allocate the iterator */
@@ -1728,8 +1735,9 @@ static int walIndexTryHdr(Wal *pWal, int *pChanged){
   if( memcmp(&pWal->hdr, &h1, sizeof(WalIndexHdr)) ){
     *pChanged = 1;
     memcpy(&pWal->hdr, &h1, sizeof(WalIndexHdr));
-    pWal->szPage = pWal->hdr.szPage;
-    if( pWal->szPage<512 ) pWal->szPage <<= 16;
+    pWal->szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
+    testcase( pWal->szPage<=32768 );
+    testcase( pWal->szPage>=65536 );
   }
 
   /* The header was successfully read. Return zero. */
@@ -2162,7 +2170,9 @@ int sqlite3WalRead(
     int sz;
     i64 iOffset;
     sz = pWal->hdr.szPage;
-    if( sz<512 ) sz <<= 16;
+    sz = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
+    testcase( sz<=32768 );
+    testcase( sz>=65536 );
     iOffset = walFrameOffset(iRead, sz) + WAL_FRAME_HDRSIZE;
     *pInWal = 1;
     /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */
@@ -2541,7 +2551,9 @@ int sqlite3WalFrames(
 
   if( rc==SQLITE_OK ){
     /* Update the private copy of the header. */
-    pWal->hdr.szPage = szPage>=0x10000 ? (szPage >> 16) : szPage;
+    pWal->hdr.szPage = (szPage&0xff00) | (szPage>>16);
+    testcase( szPage<=32768 );
+    testcase( szPage>=65536 );
     pWal->hdr.mxFrame = iFrame;
     if( isCommit ){
       pWal->hdr.iChange++;