]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
More structure rearrangements for additional size reductions. Ticket #1253. (CVS...
authordrh <drh@noemail.net>
Sat, 21 May 2005 02:48:08 +0000 (02:48 +0000)
committerdrh <drh@noemail.net>
Sat, 21 May 2005 02:48:08 +0000 (02:48 +0000)
FossilOrigin-Name: 6b6e525b294a5bbf8a5e56a2f60aa096865aedbd

manifest
manifest.uuid
src/pager.c
src/sqliteInt.h

index c0d5f5723cd33f966cc84eef6dab9bee34b4c726..5b827f2f98ac19d5ac5eac938fbad50143b3c662 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Reorder\sstructure\sfields\sto\sreduce\scode\sfootprint.\s\sTicket\s#1253.\s\sNeed\nto\sdo\smore\sof\sthis.\s(CVS\s2467)
-D 2005-05-20T20:11:21
+C More\sstructure\srearrangements\sfor\sadditional\ssize\sreductions.\s\sTicket\s#1253.\s(CVS\s2468)
+D 2005-05-21T02:48:09
 F Makefile.in 5c00d0037104de2a50ac7647a5f12769795957a3
 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -52,7 +52,7 @@ F src/os_unix.c cb8a39901b8eb920372c2e42f7ea9ab40f2e47ae
 F src/os_unix.h 39a393252e69e72b06715c9958df05ddbc4aa971
 F src/os_win.c 2bbbe6fbb010763c3fa79d5e951afca9b138c6b5
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c a17fe8849ff136d1627775043191ed07079624f6
+F src/pager.c c91b599f64118c1b3046d8029b15c7f8f0fe9310
 F src/pager.h 0d9153d6269d60d04af3dd84a0cc0a96253cf4a4
 F src/parse.y 3e314b3a96b199b0501ed426f2cee3392ffce806
 F src/pragma.c 93d447670b367e7aec9191ed952fe04f6a052eb5
@@ -61,7 +61,7 @@ F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
 F src/select.c 43cc2a76e3e00dabc59da82d0dcdef23cdba43a3
 F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26
 F src/sqlite.h.in 3675e3ada207e09b9d52a0463561325df4ac26b5
-F src/sqliteInt.h 7123b9d5632d7eaab90cf595c83c89521ea1c3b6
+F src/sqliteInt.h d4faaa3ce498d788eff39325419a97f9d894f538
 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
 F src/tclsqlite.c af0f002d9d6ab4f7f32b9bee5b57665946e76ad9
 F src/test1.c 4ad7ffe5a74fd99d4f73f6fd28ba27f403b3adba
@@ -279,7 +279,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
-P f29a1d882623d8ff14f35a302aef63a16388bcb3
-R 7248d3051a23636637f3bf908b92b89d
+P 27025613bc2970b0c23e08fbe5251103794ab6cb
+R 117e33923c7b5da1df58206a9a2755b5
 U drh
-Z aa9912e17fa098ce45047c53645a0e7c
+Z e67191b0113ddab8b656fe220932b386
index 0452c93707e27a7baed1f378cd8b30d76d8ef102..aefc7f747e17757b4bfbb6fe89efa557ce4a9c42 100644 (file)
@@ -1 +1 @@
-27025613bc2970b0c23e08fbe5251103794ab6cb
\ No newline at end of file
+6b6e525b294a5bbf8a5e56a2f60aa096865aedbd
\ No newline at end of file
index 0bdb1d6a913175ba0f34f95e7a3138cefca186bf..578be3d5de584ac97649d644037fd54dbd2ece35 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.204 2005/05/20 20:11:21 drh Exp $
+** @(#) $Id: pager.c,v 1.205 2005/05/21 02:48:09 drh Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -234,23 +234,6 @@ struct PgHistory {
 ** A open page cache is an instance of the following structure.
 */
 struct Pager {
-  char *zFilename;            /* Name of the database file */
-  char *zJournal;             /* Name of the journal file */
-  char *zDirectory;           /* Directory hold database and journal files */
-  OsFile fd, jfd;             /* File descriptors for database and journal */
-  OsFile stfd;                /* File descriptor for the statement subjournal*/
-  int dbSize;                 /* Number of pages in the file */
-  int origDbSize;             /* dbSize before the current change */
-  int stmtSize;               /* Size of database (in pages) at stmt_begin() */
-  int nRec;                   /* Number of pages written to the journal */
-  u32 cksumInit;              /* Quasi-random value added to every checksum */
-  int stmtNRec;               /* Number of records in stmt subjournal */
-  int nExtra;                 /* Add this many bytes to each in-memory page */
-  int pageSize;               /* Number of bytes in a page */
-  int nPage;                  /* Total number of in-memory pages */
-  int nMaxPage;               /* High water mark of nPage */
-  int nRef;                   /* Number of in-memory pages with PgHdr.nRef>0 */
-  int mxPage;                 /* Maximum number of pages to hold in cache */
   u8 journalOpen;             /* True if journal file descriptors is valid */
   u8 journalStarted;          /* True if header of journal is synced */
   u8 useJournal;              /* Use a rollback journal on this file */
@@ -269,8 +252,25 @@ struct Pager {
   u8 alwaysRollback;          /* Disable dont_rollback() for all pages */
   u8 memDb;                   /* True to inhibit all file I/O */
   u8 setMaster;               /* True if a m-j name has been written to jrnl */
+  int dbSize;                 /* Number of pages in the file */
+  int origDbSize;             /* dbSize before the current change */
+  int stmtSize;               /* Size of database (in pages) at stmt_begin() */
+  int nRec;                   /* Number of pages written to the journal */
+  u32 cksumInit;              /* Quasi-random value added to every checksum */
+  int stmtNRec;               /* Number of records in stmt subjournal */
+  int nExtra;                 /* Add this many bytes to each in-memory page */
+  int pageSize;               /* Number of bytes in a page */
+  int nPage;                  /* Total number of in-memory pages */
+  int nMaxPage;               /* High water mark of nPage */
+  int nRef;                   /* Number of in-memory pages with PgHdr.nRef>0 */
+  int mxPage;                 /* Maximum number of pages to hold in cache */
   u8 *aInJournal;             /* One bit for each page in the database file */
   u8 *aInStmt;                /* One bit for each page in the database */
+  char *zFilename;            /* Name of the database file */
+  char *zJournal;             /* Name of the journal file */
+  char *zDirectory;           /* Directory hold database and journal files */
+  OsFile fd, jfd;             /* File descriptors for database and journal */
+  OsFile stfd;                /* File descriptor for the statement subjournal*/
   BusyHandler *pBusyHandler;  /* Pointer to sqlite.busyHandler */
   PgHdr *pFirst, *pLast;      /* List of free pages */
   PgHdr *pFirstSynced;        /* First free page with PgHdr.needSync==0 */
@@ -282,8 +282,10 @@ struct Pager {
   i64 stmtCksum;              /* cksumInit when statement was started */
   i64 stmtJSize;              /* Size of journal at stmt_begin() */
   int sectorSize;             /* Assumed sector size during rollback */
+#ifdef SQLITE_TEST
   int nHit, nMiss, nOvfl;     /* Cache hits, missing, and LRU overflows */
   int nRead,nWrite;           /* Database pages read/written */
+#endif
   void (*xDestructor)(void*,int); /* Call this routine when freeing pages */
   void (*xReiniter)(void*,int);   /* Call this routine when reloading pages */
   void (*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */
@@ -291,6 +293,16 @@ struct Pager {
   PgHdr *aHash[N_PG_HASH];    /* Hash table to map page number to PgHdr */
 };
 
+/*
+** If SQLITE_TEST is defined then increment the variable given in
+** the argument
+*/
+#ifdef SQLITE_TEST
+# define TEST_INCR(x)  x++
+#else
+# define TEST_INCR(x)
+#endif
+
 /*
 ** These are bits that can be set in Pager.errMask.
 */
@@ -2202,7 +2214,7 @@ static int pager_write_pagelist(PgHdr *pList){
       TRACE3("STORE %d page %d\n", PAGERID(pPager), pList->pgno);
       rc = sqlite3OsWrite(&pPager->fd, PGHDR_TO_DATA(pList), pPager->pageSize);
       CODEC(pPager, PGHDR_TO_DATA(pList), pList->pgno, 0);
-      pPager->nWrite++;
+      TEST_INCR(pPager->nWrite);
     }
 #ifndef NDEBUG
     else{
@@ -2373,7 +2385,7 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
   if( pPg==0 ){
     /* The requested page is not in the page cache. */
     int h;
-    pPager->nMiss++;
+    TEST_INCR(pPager->nMiss);
     if( pPager->nPage<pPager->mxPage || pPager->pFirst==0 || MEMDB ){
       /* Create a new page */
       pPg = sqliteMallocRaw( sizeof(*pPg) + pPager->pageSize
@@ -2459,7 +2471,7 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
       /* Unlink the old page from the free list and the hash table
       */
       unlinkPage(pPg);
-      pPager->nOvfl++;
+      TEST_INCR(pPager->nOvfl);
     }
     pPg->pgno = pgno;
     if( pPager->aInJournal && (int)pgno<=pPager->origDbSize ){
@@ -2515,7 +2527,7 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
           memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize);
         }
       }else{
-        pPager->nRead++;
+        TEST_INCR(pPager->nRead);
       }
     }
 #ifdef SQLITE_CHECK_PAGES
@@ -2523,7 +2535,7 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
 #endif
   }else{
     /* The requested page is in the page cache. */
-    pPager->nHit++;
+    TEST_INCR(pPager->nHit);
     page_ref(pPg);
   }
   *ppPage = PGHDR_TO_DATA(pPg);
@@ -3192,11 +3204,13 @@ int *sqlite3pager_stats(Pager *pPager){
   a[3] = pPager->dbSize;
   a[4] = pPager->state;
   a[5] = pPager->errMask;
+#ifdef SQLITE_TEST
   a[6] = pPager->nHit;
   a[7] = pPager->nMiss;
   a[8] = pPager->nOvfl;
   a[9] = pPager->nRead;
   a[10] = pPager->nWrite;
+#endif
   return a;
 }
 
index 516455c34fae87dc58b103221519f4dbb03d678a..47138f52e98ab6fafc217618d4660cf682d54258 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.378 2005/04/29 02:10:00 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.379 2005/05/21 02:48:09 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -416,16 +416,13 @@ struct Db {
 struct sqlite3 {
   int nDb;                      /* Number of backends currently in use */
   Db *aDb;                      /* All backends */
-  Db aDbStatic[2];              /* Static space for the 2 default backends */
   int flags;                    /* Miscellanous flags. See below */
+  int errCode;                  /* Most recent error code (SQLITE_*) */
+  u8 enc;                       /* Text encoding for this database. */
+  u8 autoCommit;                /* The auto-commit flag. */
   u8 file_format;               /* What file format version is this database? */
   u8 temp_store;                /* 1: file 2: memory 0: default */
   int nTable;                   /* Number of tables in the database */
-  BusyHandler busyHandler;      /* Busy callback */
-  void *pCommitArg;             /* Argument to xCommitCallback() */   
-  int (*xCommitCallback)(void*);/* Invoked at every commit. */
-  Hash aFunc;                   /* All functions that can be in SQL exprs */
-  Hash aCollSeq;                /* All collating sequences */
   CollSeq *pDfltColl;           /* The default collating sequence (BINARY) */
   i64 lastRowid;                /* ROWID of most recent insert (see above) */
   i64 priorNewRowid;            /* Last randomly generated ROWID */
@@ -441,6 +438,15 @@ struct sqlite3 {
   int activeVdbeCnt;            /* Number of vdbes currently executing */
   void (*xTrace)(void*,const char*);     /* Trace function */
   void *pTraceArg;                       /* Argument to the trace function */
+  void *pCommitArg;             /* Argument to xCommitCallback() */   
+  int (*xCommitCallback)(void*);/* Invoked at every commit. */
+  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);
+  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*);
+  void *pCollNeededArg;
+  sqlite3_value *pValue;        /* Value used for transient conversions */
+  sqlite3_value *pErr;          /* Most recent error message */
+  char *zErrMsg;                /* Most recent error message (UTF-8 encoded) */
+  char *zErrMsg16;              /* Most recent error message (UTF-16 encoded) */
 #ifndef SQLITE_OMIT_AUTHORIZATION
   int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);
                                 /* Access authorization function */
@@ -451,19 +457,13 @@ struct sqlite3 {
   void *pProgressArg;           /* Argument to the progress callback */
   int nProgressOps;             /* Number of opcodes for progress callback */
 #endif
-  int errCode;                  /* Most recent error code (SQLITE_*) */
-  u8 enc;                       /* Text encoding for this database. */
-  u8 autoCommit;                /* The auto-commit flag. */
-  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);
-  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*);
-  void *pCollNeededArg;
-  sqlite3_value *pValue;        /* Value used for transient conversions */
-  sqlite3_value *pErr;          /* Most recent error message */
-  char *zErrMsg;                /* Most recent error message (UTF-8 encoded) */
-  char *zErrMsg16;              /* Most recent error message (UTF-16 encoded) */
 #ifndef SQLITE_OMIT_GLOBALRECOVER
   sqlite3 *pNext;               /* Linked list of open db handles. */
 #endif
+  Hash aFunc;                   /* All functions that can be in SQL exprs */
+  Hash aCollSeq;                /* All collating sequences */
+  BusyHandler busyHandler;      /* Busy callback */
+  Db aDbStatic[2];              /* Static space for the 2 default backends */
 };
 
 /*
@@ -1111,15 +1111,15 @@ struct Parse {
   u8 nameClash;        /* A permanent table name clashes with temp table name */
   u8 checkSchema;      /* Causes schema cookie check after an error */
   u8 nested;           /* Number of nested calls to the parser/code generator */
+  u8 fillAgg;          /* If true, ignore the Expr.iAgg field. Normally false */
   int nErr;            /* Number of errors seen */
   int nTab;            /* Number of previously allocated VDBE cursors */
   int nMem;            /* Number of memory cells used so far */
   int nSet;            /* Number of sets used so far */
+  u32 writeMask;       /* Start a write transaction on these databases */
   u32 cookieMask;      /* Bitmask of schema verified databases */
-  int cookieValue[MAX_ATTACHED+2];  /* Values of cookies to verify */
   int cookieGoto;      /* Address of OP_Goto to cookie verifier subroutine */
-  u32 writeMask;       /* Start a write transaction on these databases */
-  u8 fillAgg;          /* If true, ignore the Expr.iAgg field. Normally false */
+  int cookieValue[MAX_ATTACHED+2];  /* Values of cookies to verify */
 
   /* Above is constant between recursions.  Below is reset before and after
   ** each recursion */