/ Check-in [7cd3f6cd]
Login

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

Overview
Comment:Change the rollback journal so that it invokes sqlite3_log() make a record of a recovery, just as the WAL journal does.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7cd3f6cd3a39ed1c4bbf9e3508824150632c5bd9
User & Date: drh 2013-04-09 18:36:36
Context
2013-04-09
20:04
Limit integrity_check output to 10 lines in mptester scripts. check-in: 67ee0dc0 user: drh tags: trunk
18:36
Change the rollback journal so that it invokes sqlite3_log() make a record of a recovery, just as the WAL journal does. check-in: 7cd3f6cd user: drh tags: trunk
16:19
Add extra #ifndef statements in os_unix.c and os_win.c to make sure the memory mapped I/O really is disabled when SQLITE_DISABLE_MMAP is set. check-in: c1e2523c user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to mptest/mptest.c.

   319    319   /*
   320    320   ** SQL error log callback
   321    321   */
   322    322   static void sqlErrorCallback(void *pArg, int iErrCode, const char *zMsg){
   323    323     UNUSED_PARAMETER(pArg);
   324    324     if( (iErrCode&0xff)==SQLITE_SCHEMA && g.iTrace<3 ) return;
   325    325     if( g.iTimeout==0 && (iErrCode&0xff)==SQLITE_BUSY && g.iTrace<3 ) return;
   326         -  errorMessage("(errcode=%d) %s", iErrCode, zMsg);
          326  +  if( iErrCode==SQLITE_OK ){
          327  +    logMessage("(info) %s", zMsg);
          328  +  }else{
          329  +    errorMessage("(errcode=%d) %s", iErrCode, zMsg);
          330  +  }
   327    331   }
   328    332   
   329    333   /*
   330    334   ** Prepare an SQL statement.  Issue a fatal error if unable.
   331    335   */
   332    336   static sqlite3_stmt *prepareSql(const char *zFormat, ...){
   333    337     va_list ap;

Changes to src/pager.c.

  2654   2654     u32 nRec;                /* Number of Records in the journal */
  2655   2655     u32 u;                   /* Unsigned loop counter */
  2656   2656     Pgno mxPg = 0;           /* Size of the original file in pages */
  2657   2657     int rc;                  /* Result code of a subroutine */
  2658   2658     int res = 1;             /* Value returned by sqlite3OsAccess() */
  2659   2659     char *zMaster = 0;       /* Name of master journal file if any */
  2660   2660     int needPagerReset;      /* True to reset page prior to first page rollback */
         2661  +  int nPlayback = 0;       /* Total number of pages restored from journal */
  2661   2662   
  2662   2663     /* Figure out how many records are in the journal.  Abort early if
  2663   2664     ** the journal is empty.
  2664   2665     */
  2665   2666     assert( isOpen(pPager->jfd) );
  2666   2667     rc = sqlite3OsFileSize(pPager->jfd, &szJ);
  2667   2668     if( rc!=SQLITE_OK ){
................................................................................
  2754   2755       */
  2755   2756       for(u=0; u<nRec; u++){
  2756   2757         if( needPagerReset ){
  2757   2758           pager_reset(pPager);
  2758   2759           needPagerReset = 0;
  2759   2760         }
  2760   2761         rc = pager_playback_one_page(pPager,&pPager->journalOff,0,1,0);
  2761         -      if( rc!=SQLITE_OK ){
         2762  +      if( rc==SQLITE_OK ){
         2763  +        nPlayback++;
         2764  +      }else{
  2762   2765           if( rc==SQLITE_DONE ){
  2763   2766             pPager->journalOff = szJ;
  2764   2767             break;
  2765   2768           }else if( rc==SQLITE_IOERR_SHORT_READ ){
  2766   2769             /* If the journal has been truncated, simply stop reading and
  2767   2770             ** processing the journal. This might happen if the journal was
  2768   2771             ** not completely written and synced prior to a crash.  In that
................................................................................
  2824   2827     if( rc==SQLITE_OK && zMaster[0] && res ){
  2825   2828       /* If there was a master journal and this routine will return success,
  2826   2829       ** see if it is possible to delete the master journal.
  2827   2830       */
  2828   2831       rc = pager_delmaster(pPager, zMaster);
  2829   2832       testcase( rc!=SQLITE_OK );
  2830   2833     }
         2834  +  if( isHot && nPlayback ){
         2835  +    sqlite3_log(SQLITE_OK, "Recovered %d pages from %s",
         2836  +                nPlayback, pPager->zJournal);
         2837  +  }
  2831   2838   
  2832   2839     /* The Pager.sectorSize variable may have been updated while rolling
  2833   2840     ** back a journal created by a process with a different sector size
  2834   2841     ** value. Reset it to the correct value for this process.
  2835   2842     */
  2836   2843     setSectorSize(pPager);
  2837   2844     return rc;