/ Check-in [1cc0323f]
Login

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

Overview
Comment:Better debug logging of the pager. (CVS 1892)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1cc0323f2597584b3f3239e8948ac3ff3db8da03
User & Date: drh 2004-08-18 16:05:19
Context
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
16:05
Better debug logging of the pager. (CVS 1892) check-in: 1cc0323f user: drh tags: trunk
15:58
Be more agressive about not creating or opening the TEMP database if there are no TEMP tables. (CVS 1891) check-in: 6b2b6b2d 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.156 2004/08/18 15:58:23 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.157 2004/08/18 16:05:19 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   
................................................................................
  2515   2515           PgHistory *pHist = PGHDR_TO_HIST(pPg, pPager);
  2516   2516           TRACE3("JOURNAL %d page %d\n", pPager->fd.h, pPg->pgno);
  2517   2517           assert( pHist->pOrig==0 );
  2518   2518           pHist->pOrig = sqliteMallocRaw( pPager->pageSize );
  2519   2519           if( pHist->pOrig ){
  2520   2520             memcpy(pHist->pOrig, PGHDR_TO_DATA(pPg), pPager->pageSize);
  2521   2521           }
  2522         -        pPg->inJournal = 1;
  2523   2522         }else{
  2524   2523           u32 cksum;
  2525   2524           CODEC(pPager, pData, pPg->pgno, 7);
  2526   2525           cksum = pager_cksum(pPager, pPg->pgno, pData);
  2527   2526           saved = *(u32*)PGHDR_TO_EXTRA(pPg, pPager);
  2528   2527           store32bits(cksum, pPg, pPager->pageSize);
  2529   2528           szPg = pPager->pageSize+8;
................................................................................
  2539   2538             pPager->errMask |= PAGER_ERR_FULL;
  2540   2539             return rc;
  2541   2540           }
  2542   2541           pPager->nRec++;
  2543   2542           assert( pPager->aInJournal!=0 );
  2544   2543           pPager->aInJournal[pPg->pgno/8] |= 1<<(pPg->pgno&7);
  2545   2544           pPg->needSync = !pPager->noSync;
  2546         -        pPg->inJournal = 1;
  2547   2545           if( pPager->stmtInUse ){
  2548   2546             pPager->aInStmt[pPg->pgno/8] |= 1<<(pPg->pgno&7);
  2549   2547             page_add_to_stmt_list(pPg);
  2550   2548           }
  2551   2549         }
  2552   2550       }else{
  2553   2551         pPg->needSync = !pPager->journalStarted && !pPager->noSync;
  2554   2552         TRACE4("APPEND %d page %d needSync=%d\n",
  2555   2553                 pPager->fd.h, pPg->pgno, pPg->needSync);
  2556   2554       }
  2557   2555       if( pPg->needSync ){
  2558   2556         pPager->needSync = 1;
  2559   2557       }
         2558  +    pPg->inJournal = 1;
  2560   2559     }
  2561   2560   
  2562   2561     /* If the statement journal is open and the page is not in it,
  2563   2562     ** then write the current page to the statement journal.  Note that
  2564   2563     ** the statement journal format differs from the standard journal format
  2565   2564     ** in that it omits the checksums and the header.
  2566   2565     */

Changes to test/attach2.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the ATTACH and DETACH commands
    13     13   # and related functionality.
    14     14   #
    15         -# $Id: attach2.test,v 1.24 2004/08/18 15:58:24 drh Exp $
           15  +# $Id: attach2.test,v 1.25 2004/08/18 16:05:20 drh Exp $
    16     16   #
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   
    22     22   # Ticket #354
................................................................................
    60     60     catchsql {
    61     61       ATTACH 'test2.db' AS t2;
    62     62     }
    63     63   } {0 {}}
    64     64   do_test attach2-2.2 {
    65     65     # make sure test2.db did get attached.
    66     66     db_list db
    67         -} {0 main 1 temp 2 t2}
           67  +} {0 main 2 t2}
    68     68   db2 eval {COMMIT}
    69     69   
    70     70   do_test attach2-2.5 {
    71     71     # Make sure we can read test2.db from db
    72     72     catchsql {
    73     73       SELECT name FROM t2.sqlite_master;
    74     74     }