From: drh Date: Sat, 14 Aug 2010 12:42:45 +0000 (+0000) Subject: Tweaks to comments in pager.c. Fix two compiler warnings. X-Git-Tag: version-3.7.2~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5918c62e9769ff8251b1b7725d05b9f241913d9;p=thirdparty%2Fsqlite.git Tweaks to comments in pager.c. Fix two compiler warnings. FossilOrigin-Name: 68a49f7fe382e4d36e1259cdeec956c942906ddb --- diff --git a/manifest b/manifest index 865c518c99..f4cb648b96 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C Add\stest\scases\sto\se_expr.test. -D 2010-08-14T12:25:18 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Tweaks\sto\scomments\sin\spager.c.\s\sFix\stwo\scompiler\swarnings. +D 2010-08-14T12:42:45 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -156,7 +159,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e F src/os_unix.c 11194cbcf6a57456e58022dc537ab8c3497d9bb9 F src/os_win.c 51cb62f76262d961ea4249489383d714501315a7 -F src/pager.c 4e144b452545838fdb226755a16d109e0198f513 +F src/pager.c afcd1f6f707f3bff2e214f326fcdcdebe1ef8203 F src/pager.h 985a83d35b0cfa8e1c23ef91ed5cdb9bde73695a F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07 @@ -207,7 +210,7 @@ F src/test_osinst.c f408c6a181f2fb04c56273afd5c3e1e82f60392c F src/test_pcache.c 7bf828972ac0d2403f5cfa4cd14da41f8ebe73d8 F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0 F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6 -F src/test_stat.c dcabb7d39da058cbfc9ddc427cd92fbf14822b28 +F src/test_stat.c f682704b5d1ba8e1d4e7e882a6d7922e2dcf066c F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_thread.c bedd05cad673dba53326f3aa468cc803038896c0 F src/test_vfs.c 702e52636113f6b9721da90ef1bf26e07fff414d @@ -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 d4ec61e2547200aa92a26c1f270682ed67edc241 -R e84bb46a139cdce66b3551c38c0d1297 -U dan -Z bd338cd57dbe432375897c27c0c4e355 +P d8bbab78fa56b076dfafb36daa7d6ef0b07f9a44 +R 00ed3364cfce8a4105ed9a3a25cad7ed +U drh +Z 25d17dd4620d7e65e11d0b88322d1479 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFMZo9IoxKgR168RlERAp1LAJwOT7m3IIp+K8QF3N/Nj+jyeFSJlACfXB9z +d6d5VsCmNb5RNvHYenT8x/U= +=t0vs +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 49ec43d697..276b1bf56c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d8bbab78fa56b076dfafb36daa7d6ef0b07f9a44 \ No newline at end of file +68a49f7fe382e4d36e1259cdeec956c942906ddb \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 0ad95b123d..102cbfd823 100644 --- a/src/pager.c +++ b/src/pager.c @@ -22,8 +22,12 @@ #include "sqliteInt.h" #include "wal.h" -/* -******************** NOTES ON THE DESIGN OF THE PAGER ************************ + +/******************* NOTES ON THE DESIGN OF THE PAGER ************************ +** +** This comment block describes invariants that hold when using a rollback +** journal. These invariants do not apply for journal_mode=WAL, +** journal_mode=MEMORY, or journal_mode=OFF. ** ** Within this comment block, a page is deemed to have been synced ** automatically as soon as it is written when PRAGMA synchronous=OFF. @@ -57,7 +61,7 @@ ** transaction. ** ** (3) Writes to the database file are an integer multiple of the page size -** in length and are aligned to a page boundary. +** in length and are aligned on a page boundary. ** ** (4) Reads from the database file are either aligned on a page boundary and ** an integer multiple of the page size in length or are taken from the @@ -88,7 +92,8 @@ ** ** (9) Whenever the database file is modified, at least one bit in the range ** of bytes from 24 through 39 inclusive will be changed prior to releasing -** the EXCLUSIVE lock. +** the EXCLUSIVE lock, thus signaling other connections on the same +** database to flush their caches. ** ** (10) The pattern of bits in bytes 24 through 39 shall not repeat in less ** than one billion transactions. @@ -101,7 +106,8 @@ ** ** (13) A SHARED lock is held on the database file while reading any ** content out of the database file. -*/ +** +******************************************************************************/ /* ** Macros for troubleshooting. Normally turned off @@ -625,16 +631,14 @@ struct Pager { u8 readOnly; /* True for a read-only database */ u8 memDb; /* True to inhibit all file I/O */ - /* The following block contains those class members that are dynamically - ** modified during normal operations. The other variables in this structure - ** are either constant throughout the lifetime of the pager, or else - ** used to store configuration parameters that affect the way the pager - ** operates. - ** - ** The 'state' variable is described in more detail along with the - ** descriptions of the values it may take - PAGER_UNLOCK etc. Many of the - ** other variables in this block are described in the comment directly - ** above this class definition. + /************************************************************************** + ** The following block contains those class members that change during + ** routine opertion. Class members not in this block are either fixed + ** when the pager is first created or else only change when there is a + ** significant mode change (such as changing the page_size, locking_mode, + ** or the journal_mode). From another view, these class members describe + ** the "state" of the pager, while other class members describe the + ** "configuration" of the pager. */ u8 eState; /* Pager state (OPEN, READER, WRITER_LOCKED..) */ u8 eLock; /* Current lock held on database file */ @@ -657,17 +661,21 @@ struct Pager { sqlite3_file *sjfd; /* File descriptor for sub-journal */ i64 journalOff; /* Current write offset in the journal file */ i64 journalHdr; /* Byte offset to previous journal header */ - i64 journalSizeLimit; /* Size limit for persistent journal files */ + sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */ PagerSavepoint *aSavepoint; /* Array of active savepoints */ int nSavepoint; /* Number of elements in aSavepoint[] */ char dbFileVers[16]; /* Changes whenever database file changes */ - u32 sectorSize; /* Assumed sector size during rollback */ + /* + ** End of the routinely-changing class members + ***************************************************************************/ u16 nExtra; /* Add this many bytes to each in-memory page */ i16 nReserve; /* Number of unused bytes at end of each page */ u32 vfsFlags; /* Flags for sqlite3_vfs.xOpen() */ + u32 sectorSize; /* Assumed sector size during rollback */ int pageSize; /* Number of bytes in a page */ Pgno mxPgno; /* Maximum allowed size of the database */ + i64 journalSizeLimit; /* Size limit for persistent journal files */ char *zFilename; /* Name of the database file */ char *zJournal; /* Name of the journal file */ int (*xBusyHandler)(void*); /* Function to call when busy */ @@ -685,7 +693,6 @@ struct Pager { #endif char *pTmpSpace; /* Pager.pageSize bytes of space for tmp use */ PCache *pPCache; /* Pointer to page cache object */ - sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */ #ifndef SQLITE_OMIT_WAL Wal *pWal; /* Write-ahead log used by "journal_mode=wal" */ char *zWal; /* File name for write-ahead log */ @@ -6370,6 +6377,13 @@ int sqlite3PagerLockingMode(Pager *pPager, int eMode){ int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ u8 eOld = pPager->journalMode; /* Prior journalmode */ +#ifdef SQLITE_DEBUG + /* The print_pager_state() routine is intended to be used by the debugger + ** only. We invoke it once here to suppress a compiler warning. */ + print_pager_state(pPager); +#endif + + /* The eMode parameter is always valid */ assert( eMode==PAGER_JOURNALMODE_DELETE || eMode==PAGER_JOURNALMODE_TRUNCATE diff --git a/src/test_stat.c b/src/test_stat.c index 1534621114..c85463e526 100644 --- a/src/test_stat.c +++ b/src/test_stat.c @@ -494,7 +494,7 @@ static int statFilter( ){ StatCursor *pCsr = (StatCursor *)pCursor; - statResetCsr((StatCursor *)pCursor); + statResetCsr(pCsr); return statNext(pCursor); }