]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
If an SQLITE_FULL error occurs during rollback or journal finalization, treat it...
authordan <dan@noemail.net>
Tue, 17 Aug 2010 18:15:48 +0000 (18:15 +0000)
committerdan <dan@noemail.net>
Tue, 17 Aug 2010 18:15:48 +0000 (18:15 +0000)
FossilOrigin-Name: 8ac185236e766becdac7248c1ba3dfa42a9464b1

manifest
manifest.uuid
src/pager.c

index c007410911a94e6845ab48f0ead01fd84b087bcd..85f61b81d618e6f5141a1b402714d95189c89d65 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,5 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Changes\sto\spager\sfor\simproved\stestability.
-D 2010-08-17T17:25:16
+C If\san\sSQLITE_FULL\serror\soccurs\sduring\srollback\sor\sjournal\sfinalization,\streat\sit\sin\sthe\ssame\sway\sas\sSQLITE_IOERR\s(i.e.\srequire\sthat\sthe\spager\sinternals\sbe\scompletely\sreset\sbefore\sit\sis\snext\sread\sfrom\sor\swritten\sto).
+D 2010-08-17T18:15:48
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -159,7 +156,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 ddef1e661fbfe6b13d43273c7672485f6fb847cd
+F src/pager.c 10cc26721aa3c34a208247984617a5682abf87c2
 F src/pager.h ef8c8f71ab022cc2fff768a1175dd32355be9dcd
 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
 F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
@@ -846,14 +843,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P ced6a3480fe4a8e2b93160a8419bdc3ab30935e8
-R 19bc85b7e2e305b82c7339594075ff01
-U drh
-Z dae19f7cd7281f0d754f22f429e4dd6e
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFMasX/oxKgR168RlERAuYYAJ94C2NzLusQUE3WIvzLfo497U9Q8gCeJk0U
-4T7U1ZESZl2eGMwQ7nWcsfI=
-=+h/y
------END PGP SIGNATURE-----
+P 61c64b3aeb027fcc9c25591d6b9048ac7850ad3d
+R 9b7b35b7a377dabffd9f7024e2c74abc
+U dan
+Z 698fa736824c32720837304d2389e0a8
index 035eee6c3adf9d439b5ec8a20346cca9e945a2b9..67197d5111dbfcdc0da1f50e162bd40b93062d6a 100644 (file)
@@ -1 +1 @@
-61c64b3aeb027fcc9c25591d6b9048ac7850ad3d
\ No newline at end of file
+8ac185236e766becdac7248c1ba3dfa42a9464b1
\ No newline at end of file
index fc99a218b261dd8cff3295304c2cb4060e954543..caf3681cf663b5685827815d4dff143d31c34e2e 100644 (file)
@@ -606,17 +606,6 @@ struct PagerSavepoint {
 **   is set to zero in all other states. In PAGER_ERROR state, Pager.errCode 
 **   is always set to SQLITE_FULL, SQLITE_IOERR or one of the SQLITE_IOERR_XXX 
 **   sub-codes.
-**
-**   If Pager.errCode is set to SQLITE_IOERR or one of its subcodes, then
-**   this value is immediately returned when ever any sqlite3PagerXXX() method
-**   that returns an error code is called. If it is set to SQLITE_FULL,
-**   then it is returned whenever any such sqlite3PagerXXX() method except
-**   for PagerAcquire() or PagerLookup() is called.
-**
-**   TODO: Review the SQLITE_FULL/PagerAcquire() exception. Is it a good idea?
-**         If so, are there bugs whereby shared-cache clients can see 
-**         uncommitted data when the pager is in the ERROR state?
-**
 */
 struct Pager {
   sqlite3_vfs *pVfs;          /* OS functions to use for IO */
@@ -1805,8 +1794,6 @@ static void pager_unlock(Pager *pPager){
 ** IOERR sub-codes, the pager enters the ERROR state and the error code
 ** is stored in Pager.errCode. While the pager remains in the ERROR state,
 ** all major API calls on the Pager will immediately return Pager.errCode.
-** Except, if the error-code is SQLITE_FULL, calls to PagerLookup() and
-** PagerAcquire are handled as if the pager were in PAGER_READER state.
 **
 ** The ERROR state indicates that the contents of the pager-cache 
 ** cannot be trusted. This state can be cleared by completely discarding 
@@ -3336,7 +3323,7 @@ void sqlite3PagerSetBusyhandler(
 **
 ** If the pager is in the error state when this function is called, it
 ** is a no-op. The value returned is the error state error code (i.e. 
-** one of SQLITE_IOERR, SQLITE_CORRUPT or SQLITE_FULL).
+** one of SQLITE_IOERR, an SQLITE_IOERR_xxx sub-code or SQLITE_FULL).
 **
 ** Otherwise, if all of the following are true:
 **
@@ -4567,7 +4554,7 @@ static int hasHotJournal(Pager *pPager, int *pExists){
 **
 ** The following operations are also performed by this function.
 **
-**   1) If the pager is currently in PAGER_UNLOCK state (no lock held
+**   1) If the pager is currently in PAGER_OPEN state (no lock held
 **      on the database file), then an attempt is made to obtain a
 **      SHARED lock on the database file. Immediately after obtaining
 **      the SHARED lock, the file-system is checked for a hot-journal,
@@ -4582,14 +4569,9 @@ static int hasHotJournal(Pager *pPager, int *pExists){
 **      the contents of the page cache and rolling back any open journal
 **      file.
 **
-** If the operation described by (2) above is not attempted, and if the
-** pager is in an error state other than SQLITE_FULL when this is called,
-** the error state error code is returned. It is permitted to read the
-** database when in SQLITE_FULL error state.
-**
-** Otherwise, if everything is successful, SQLITE_OK is returned. If an
-** IO error occurs while locking the database, checking for a hot-journal
-** file or rolling back a journal file, the IO error code is returned.
+** If everything is successful, SQLITE_OK is returned. If an IO error 
+** occurs while locking the database, checking for a hot-journal file or 
+** rolling back a journal file, the IO error code is returned.
 */
 int sqlite3PagerSharedLock(Pager *pPager){
   int rc = SQLITE_OK;                /* Return code */
@@ -4874,7 +4856,7 @@ int sqlite3PagerAcquire(
 
   /* If the pager is in the error state, return an error immediately. 
   ** Otherwise, request the page from the PCache layer. */
-  if( pPager->errCode!=SQLITE_OK && pPager->errCode!=SQLITE_FULL ){
+  if( pPager->errCode!=SQLITE_OK ){
     rc = pPager->errCode;
   }else{
     rc = sqlite3PcacheFetch(pPager->pPCache, pgno, 1, ppPage);
@@ -4963,9 +4945,7 @@ pager_acquire_err:
 /*
 ** Acquire a page if it is already in the in-memory cache.  Do
 ** not read the page from disk.  Return a pointer to the page,
-** or 0 if the page is not in cache. Also, return 0 if the 
-** pager is in PAGER_UNLOCK state when this function is called,
-** or if the pager is in an error state other than SQLITE_FULL.
+** or 0 if the page is not in cache. 
 **
 ** See also sqlite3PagerGet().  The difference between this routine
 ** and sqlite3PagerGet() is that _get() will go to the disk and read
@@ -4978,7 +4958,7 @@ DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
   assert( pPager!=0 );
   assert( pgno!=0 );
   assert( pPager->pPCache!=0 );
-  assert( pPager->eState>=PAGER_READER );
+  assert( pPager->eState>=PAGER_READER && pPager->eState!=PAGER_ERROR );
   sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &pPg);
   return pPg;
 }
@@ -5107,7 +5087,7 @@ static int pager_open_journal(Pager *pPager){
 int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){
   int rc = SQLITE_OK;
 
-  if( pPager->errCode ) return pPager->errCode;
+  if( NEVER(pPager->errCode) ) return pPager->errCode;
   assert( pPager->eState>=PAGER_READER && pPager->eState<PAGER_ERROR );
   pPager->subjInMemory = (u8)subjInMemory;