/ Check-in [36b7c5ce]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:The SQLITE_IOERR_BLOCKED extended error code is not longer used, so remove assert() statements and documentation for that error code. Also make other documentation improvements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:36b7c5cefcad6bad044806092593c84876fee8bc
User & Date: drh 2014-08-08 15:38:11
Context
2014-08-08
17:49
Improvements to the way the query planner handles sorting costs, so that very large sorting costs do not overwhelm the loop costs. check-in: bdaa6947 user: drh tags: trunk
16:52
Because SQLite internally calculates query plan costs using a logarithmic scale, very large estimated sorting costs can cause all other estimated costs to be rounded down to zero. In these cases break ties between plans with the same total cost by comparing the costs with sorting excluded. This is an alternative fix for the problem addressed by [2af630c572]. check-in: 299b9570 user: dan tags: query-planner-fix
15:38
The SQLITE_IOERR_BLOCKED extended error code is not longer used, so remove assert() statements and documentation for that error code. Also make other documentation improvements. check-in: 36b7c5ce user: drh tags: trunk
12:51
Reworking the documentation on integer result codes. This is a comment and documentation change only. There are no changes to code. check-in: 54f1df7b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

  1087   1087         case SQLITE_IOERR_FSYNC:        zName = "SQLITE_IOERR_FSYNC";       break;
  1088   1088         case SQLITE_IOERR_DIR_FSYNC:    zName = "SQLITE_IOERR_DIR_FSYNC";   break;
  1089   1089         case SQLITE_IOERR_TRUNCATE:     zName = "SQLITE_IOERR_TRUNCATE";    break;
  1090   1090         case SQLITE_IOERR_FSTAT:        zName = "SQLITE_IOERR_FSTAT";       break;
  1091   1091         case SQLITE_IOERR_UNLOCK:       zName = "SQLITE_IOERR_UNLOCK";      break;
  1092   1092         case SQLITE_IOERR_RDLOCK:       zName = "SQLITE_IOERR_RDLOCK";      break;
  1093   1093         case SQLITE_IOERR_DELETE:       zName = "SQLITE_IOERR_DELETE";      break;
  1094         -      case SQLITE_IOERR_BLOCKED:      zName = "SQLITE_IOERR_BLOCKED";     break;
  1095   1094         case SQLITE_IOERR_NOMEM:        zName = "SQLITE_IOERR_NOMEM";       break;
  1096   1095         case SQLITE_IOERR_ACCESS:       zName = "SQLITE_IOERR_ACCESS";      break;
  1097   1096         case SQLITE_IOERR_CHECKRESERVEDLOCK:
  1098   1097                                   zName = "SQLITE_IOERR_CHECKRESERVEDLOCK"; break;
  1099   1098         case SQLITE_IOERR_LOCK:         zName = "SQLITE_IOERR_LOCK";        break;
  1100   1099         case SQLITE_IOERR_CLOSE:        zName = "SQLITE_IOERR_CLOSE";       break;
  1101   1100         case SQLITE_IOERR_DIR_CLOSE:    zName = "SQLITE_IOERR_DIR_CLOSE";   break;

Changes to src/os_unix.c.

   757    757           (sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK) ){
   758    758         return SQLITE_BUSY;
   759    759       }
   760    760       /* else fall through */
   761    761     case EPERM: 
   762    762       return SQLITE_PERM;
   763    763       
   764         -  /* EDEADLK is only possible if a call to fcntl(F_SETLKW) is made. And
   765         -  ** this module never makes such a call. And the code in SQLite itself 
   766         -  ** asserts that SQLITE_IOERR_BLOCKED is never returned. For these reasons
   767         -  ** this case is also commented out. If the system does set errno to EDEADLK,
   768         -  ** the default SQLITE_IOERR_XXX code will be returned. */
   769         -#if 0
   770         -  case EDEADLK:
   771         -    return SQLITE_IOERR_BLOCKED;
   772         -#endif
   773         -    
   774    764   #if EOPNOTSUPP!=ENOTSUP
   775    765     case EOPNOTSUPP: 
   776    766       /* something went terribly awry, unless during file system support 
   777    767        * introspection, in which it actually means what it says */
   778    768   #endif
   779    769   #ifdef ENOTSUP
   780    770     case ENOTSUP: 

Changes to src/sqlite.h.in.

   667    667   ** integer opcode.  The third argument is a generic pointer intended to
   668    668   ** point to a structure that may contain arguments or space in which to
   669    669   ** write return values.  Potential uses for xFileControl() might be
   670    670   ** functions to enable blocking locks with timeouts, to change the
   671    671   ** locking strategy (for example to use dot-file locks), to inquire
   672    672   ** about the status of a lock, or to break stale locks.  The SQLite
   673    673   ** core reserves all opcodes less than 100 for its own use.
   674         -** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
          674  +** A [file control opcodes | list of opcodes] less than 100 is available.
   675    675   ** Applications that define a custom xFileControl method should use opcodes
   676    676   ** greater than 100 to avoid conflicts.  VFS implementations should
   677    677   ** return [SQLITE_NOTFOUND] for file control opcodes that they do not
   678    678   ** recognize.
   679    679   **
   680    680   ** The xSectorSize() method returns the sector size of the
   681    681   ** device that underlies the file.  The sector size is the
................................................................................
   740    740     int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p);
   741    741     /* Methods above are valid for version 3 */
   742    742     /* Additional methods may be added in future releases */
   743    743   };
   744    744   
   745    745   /*
   746    746   ** CAPI3REF: Standard File Control Opcodes
          747  +** KEYWORDS: {file control opcodes} {file control opcode}
   747    748   **
   748    749   ** These integer constants are opcodes for the xFileControl method
   749    750   ** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
   750    751   ** interface.
   751    752   **
   752    753   ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This
   753    754   ** opcode causes the xFileControl method to write the current state of
................................................................................
  2027   2028   ** that might be invoked with argument P whenever
  2028   2029   ** an attempt is made to access a database table associated with
  2029   2030   ** [database connection] D when another thread
  2030   2031   ** or process has the table locked.
  2031   2032   ** The sqlite3_busy_handler() interface is used to implement
  2032   2033   ** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout].
  2033   2034   **
  2034         -** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]
         2035  +** ^If the busy callback is NULL, then [SQLITE_BUSY]
  2035   2036   ** is returned immediately upon encountering the lock.  ^If the busy callback
  2036   2037   ** is not NULL, then the callback might be invoked with two arguments.
  2037   2038   **
  2038   2039   ** ^The first argument to the busy handler is a copy of the void* pointer which
  2039   2040   ** is the third argument to sqlite3_busy_handler().  ^The second argument to
  2040   2041   ** the busy handler callback is the number of times that the busy handler has
  2041   2042   ** been invoked for the same locking event.  ^If the
  2042   2043   ** busy callback returns 0, then no additional attempts are made to
  2043         -** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned
         2044  +** access the database and [SQLITE_BUSY] is returned
  2044   2045   ** to the application.
  2045   2046   ** ^If the callback returns non-zero, then another attempt
  2046   2047   ** is made to access the database and the cycle repeats.
  2047   2048   **
  2048   2049   ** The presence of a busy handler does not guarantee that it will be invoked
  2049   2050   ** when there is lock contention. ^If SQLite determines that invoking the busy
  2050   2051   ** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
  2051         -** or [SQLITE_IOERR_BLOCKED] to the application instead of invoking the 
         2052  +** to the application instead of invoking the 
  2052   2053   ** busy handler.
  2053   2054   ** Consider a scenario where one process is holding a read lock that
  2054   2055   ** it is trying to promote to a reserved lock and
  2055   2056   ** a second process is holding a reserved lock that it is trying
  2056   2057   ** to promote to an exclusive lock.  The first process cannot proceed
  2057   2058   ** because it is blocked by the second and the second process cannot
  2058   2059   ** proceed because it is blocked by the first.  If both processes
................................................................................
  2059   2060   ** invoke the busy handlers, neither will make any progress.  Therefore,
  2060   2061   ** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
  2061   2062   ** will induce the first process to release its read lock and allow
  2062   2063   ** the second process to proceed.
  2063   2064   **
  2064   2065   ** ^The default busy callback is NULL.
  2065   2066   **
  2066         -** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED]
  2067         -** when SQLite is in the middle of a large transaction where all the
  2068         -** changes will not fit into the in-memory cache.  SQLite will
  2069         -** already hold a RESERVED lock on the database file, but it needs
  2070         -** to promote this lock to EXCLUSIVE so that it can spill cache
  2071         -** pages into the database file without harm to concurrent
  2072         -** readers.  ^If it is unable to promote the lock, then the in-memory
  2073         -** cache will be left in an inconsistent state and so the error
  2074         -** code is promoted from the relatively benign [SQLITE_BUSY] to
  2075         -** the more severe [SQLITE_IOERR_BLOCKED].  ^This error code promotion
  2076         -** forces an automatic rollback of the changes.  See the
  2077         -** <a href="/cvstrac/wiki?p=CorruptionFollowingBusyError">
  2078         -** CorruptionFollowingBusyError</a> wiki page for a discussion of why
  2079         -** this is important.
  2080         -**
  2081   2067   ** ^(There can only be a single busy handler defined for each
  2082   2068   ** [database connection].  Setting a new busy handler clears any
  2083   2069   ** previously set handler.)^  ^Note that calling [sqlite3_busy_timeout()]
  2084   2070   ** or evaluating [PRAGMA busy_timeout=N] will change the
  2085   2071   ** busy handler and thus clear any previously set busy handler.
  2086   2072   **
  2087   2073   ** The busy callback should not take any actions which modify the
................................................................................
  2098   2084   ** CAPI3REF: Set A Busy Timeout
  2099   2085   **
  2100   2086   ** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
  2101   2087   ** for a specified amount of time when a table is locked.  ^The handler
  2102   2088   ** will sleep multiple times until at least "ms" milliseconds of sleeping
  2103   2089   ** have accumulated.  ^After at least "ms" milliseconds of sleeping,
  2104   2090   ** the handler returns 0 which causes [sqlite3_step()] to return
  2105         -** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].
         2091  +** [SQLITE_BUSY].
  2106   2092   **
  2107   2093   ** ^Calling this routine with an argument less than or equal to zero
  2108   2094   ** turns off all busy handlers.
  2109   2095   **
  2110   2096   ** ^(There can only be a single busy handler for a particular
  2111   2097   ** [database connection] any any given moment.  If another busy handler
  2112   2098   ** was defined  (using [sqlite3_busy_handler()]) prior to calling

Changes to src/vdbeaux.c.

  2297   2297       int isSpecialError;            /* Set to true if a 'special' error */
  2298   2298   
  2299   2299       /* Lock all btrees used by the statement */
  2300   2300       sqlite3VdbeEnter(p);
  2301   2301   
  2302   2302       /* Check for one of the special errors */
  2303   2303       mrc = p->rc & 0xff;
  2304         -    assert( p->rc!=SQLITE_IOERR_BLOCKED );  /* This error no longer exists */
  2305   2304       isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR
  2306   2305                        || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL;
  2307   2306       if( isSpecialError ){
  2308   2307         /* If the query was read-only and the error code is SQLITE_INTERRUPT, 
  2309   2308         ** no rollback is necessary. Otherwise, at least a savepoint 
  2310   2309         ** transaction must be rolled back to restore the database to a 
  2311   2310         ** consistent state.