/ Check-in [3d4252b0]
Login

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

Overview
Comment:Remove some unused branches from internal function sqlite3PagerDontRollback(). (CVS 4733)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3d4252b06b42151874ee437c3a484e818232a5c9
User & Date: danielk1977 2008-01-21 13:04:35
Context
2008-01-21
16:22
Miscellaneous test coverage improvements. (CVS 4734) check-in: 720bc20a user: drh tags: trunk
13:04
Remove some unused branches from internal function sqlite3PagerDontRollback(). (CVS 4733) check-in: 3d4252b0 user: danielk1977 tags: trunk
2008-01-20
23:19
Add the RTRIM collating sequence. Only implemented for UTF8. Still considered experimental and may be removed if we find adverse impact elsewhere in the system. (CVS 4732) check-in: 0bf4e7fe user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
4375
4376
4377
4378
4379
4380
4381













4382
4383
4384
4385
4386
4387





4388
4389
4390
4391
4392





4393

4394
4395
4396
4397
4398

4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.402 2008/01/18 13:42:55 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
#include <assert.h>
#include <string.h>

/*
................................................................................
** means that the pager does not have to record the given page in the
** rollback journal.
**
** If we have not yet actually read the content of this page (if
** the PgHdr.needRead flag is set) then this routine acts as a promise
** that we will never need to read the page content in the future.
** so the needRead flag can be cleared at this point.













*/
void sqlite3PagerDontRollback(DbPage *pPg){
  Pager *pPager = pPg->pPager;

  pagerEnter(pPager);
  assert( pPager->state>=PAGER_RESERVED );





  if( pPager->journalOpen==0 || pPg->alwaysRollback 
   || pPager->alwaysRollback || MEMDB ){
    pagerLeave(pPager);
    return;
  }





  if( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize ){

    assert( pPager->aInJournal!=0 );
    pPager->aInJournal[pPg->pgno/8] |= 1<<(pPg->pgno&7);
    pPg->inJournal = 1;
    pPg->needRead = 0;
    if( pPager->stmtInUse ){

      pPager->aInStmt[pPg->pgno/8] |= 1<<(pPg->pgno&7);
    }
    PAGERTRACE3("DONT_ROLLBACK page %d of %d\n", pPg->pgno, PAGERID(pPager));
    IOTRACE(("GARBAGE %p %d\n", pPager, pPg->pgno))
  }
  if( pPager->stmtInUse 
   && !pageInStatement(pPg) 
   && (int)pPg->pgno<=pPager->stmtSize 
  ){
    assert( pPg->inJournal || (int)pPg->pgno>pPager->origDbSize );
    assert( pPager->aInStmt!=0 );
    pPager->aInStmt[pPg->pgno/8] |= 1<<(pPg->pgno&7);
  }
  pagerLeave(pPager);
}


/*
** This routine is called to increment the database file change-counter,
** stored at byte 24 of the pager file.







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>






>
>
>
>
>
|
<



>
>
>
>
>
|
>
|
|
|
|
|
>
|
|
|
|
<
<
<
<
<
<
<
<
<







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406

4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426









4427
4428
4429
4430
4431
4432
4433
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.403 2008/01/21 13:04:35 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
#include <assert.h>
#include <string.h>

/*
................................................................................
** means that the pager does not have to record the given page in the
** rollback journal.
**
** If we have not yet actually read the content of this page (if
** the PgHdr.needRead flag is set) then this routine acts as a promise
** that we will never need to read the page content in the future.
** so the needRead flag can be cleared at this point.
**
** This routine is only called from a single place in the sqlite btree
** code (when a leaf is removed from the free-list). This allows the
** following assumptions to be made about pPg:
**
**   1. PagerDontWrite() has been called on the page, OR 
**      PagerWrite() has not yet been called on the page.
**
**   2. The page existed when the transaction was started.
**
** Details: DontRollback() (this routine) is only called when a leaf is
** removed from the free list. DontWrite() is called whenever a page 
** becomes a free-list leaf.
*/
void sqlite3PagerDontRollback(DbPage *pPg){
  Pager *pPager = pPg->pPager;

  pagerEnter(pPager);
  assert( pPager->state>=PAGER_RESERVED );

  /* If the journal file is not open, or DontWrite() has been called on
  ** this page (DontWrite() sets the alwaysRollback flag), then this
  ** function is a no-op.
  */
  if( pPager->journalOpen==0 || pPg->alwaysRollback || pPager->alwaysRollback ){

    pagerLeave(pPager);
    return;
  }
  assert( !MEMDB );    /* For a memdb, pPager->journalOpen is always 0 */

  /* Check that PagerWrite() has not yet been called on this page, and
  ** that the page existed when the transaction started.
  */
  assert( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize );

  assert( pPager->aInJournal!=0 );
  pPager->aInJournal[pPg->pgno/8] |= 1<<(pPg->pgno&7);
  pPg->inJournal = 1;
  pPg->needRead = 0;
  if( pPager->stmtInUse ){
    assert( pPager->stmtSize <= pPager->origDbSize );
    pPager->aInStmt[pPg->pgno/8] |= 1<<(pPg->pgno&7);
  }
  PAGERTRACE3("DONT_ROLLBACK page %d of %d\n", pPg->pgno, PAGERID(pPager));
  IOTRACE(("GARBAGE %p %d\n", pPager, pPg->pgno))









  pagerLeave(pPager);
}


/*
** This routine is called to increment the database file change-counter,
** stored at byte 24 of the pager file.