/ Check-in [25fe7a42]
Login

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

Overview
Comment:Add the SQLITE_BUSY_RESERVED_LOCK compile-time option. (CVS 1894)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:25fe7a42ec2e06e659d7a0a6664789114c007e17
User & Date: drh 2004-08-19 13:29:15
Context
2004-08-19
15:12
Enhance lemon so that a @X instead of just X in the code expands to the major token value rather than the minor token value. Use this to make the parser a few hundred bytes smaller. (CVS 1895) check-in: 28215096 user: drh tags: trunk
13:29
Add the SQLITE_BUSY_RESERVED_LOCK compile-time option. (CVS 1894) check-in: 25fe7a42 user: drh tags: trunk
2004-08-18
19:09
Make sure the database file is correctly truncated after a ROLLBACK that occurs after a statement abort. (CVS 1893) check-in: 6afe467d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.158 2004/08/18 19:09:44 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.159 2004/08/19 13:29:15 drh Exp $
    22     22   */
    23     23   #include "os.h"         /* Must be first to enable large file support */
    24     24   #include "sqliteInt.h"
    25     25   #include "pager.h"
    26     26   #include <assert.h>
    27     27   #include <string.h>
    28     28   
................................................................................
  2413   2413     assert( pPager->state!=PAGER_UNLOCK );
  2414   2414     if( pPager->state==PAGER_SHARED ){
  2415   2415       assert( pPager->aInJournal==0 );
  2416   2416       if( pPager->memDb ){
  2417   2417         pPager->state = PAGER_EXCLUSIVE;
  2418   2418         pPager->origDbSize = pPager->dbSize;
  2419   2419       }else{
  2420         -#if 0
         2420  +#ifdef SQLITE_BUSY_RESERVED_LOCK
  2421   2421         int busy = 1;
  2422   2422         do {
  2423   2423           rc = sqlite3OsLock(&pPager->fd, RESERVED_LOCK);
  2424   2424         }while( rc==SQLITE_BUSY && 
  2425   2425             pPager->pBusyHandler && 
  2426   2426             pPager->pBusyHandler->xFunc && 
  2427   2427             pPager->pBusyHandler->xFunc(pPager->pBusyHandler->pArg, busy++)
  2428   2428         );
  2429         -#endif
         2429  +#else
  2430   2430         rc = sqlite3OsLock(&pPager->fd, RESERVED_LOCK);
         2431  +#endif
  2431   2432         if( rc!=SQLITE_OK ){
  2432   2433           /* We do not call the busy handler when we fail to get a reserved lock.
  2433   2434           ** The only reason we might fail is because another process is holding
  2434   2435           ** the reserved lock.  But the other process will not be able to
  2435   2436           ** release its reserved lock until this process releases its shared
  2436   2437           ** lock.  So we might as well fail in this process, let it release
  2437   2438           ** its shared lock so that the other process can commit.