/ Check-in [8c9ee1d7]
Login

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

Overview
Comment:Amplification of a comment in wal.c. Change the aReadMark[] processing so that one read mark is left at zero when a WAL resets.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8c9ee1d78f99394eef73a177141ca9e1c67e4e07
User & Date: drh 2012-07-17 02:56:05
References
2012-07-17
17:46
Cherrypick [8c9ee1d78f] and [e416359633] from trunk: Ensure that there is always at least one aReadMark slot usable by an unprivileged reader while a checkpoint is running. Also, if one or more transactions are recovered from a log file, initialize one of the aReadMark slots to contain mxFrame as part of the recovery process. check-in: 65035912 user: drh tags: apple-osx
Context
2012-07-17
14:37
Ensure that there is always at least one aReadMark slot usable by an unprivileged reader while a checkpoint is running. Also, if one or more transactions are recovered from a log file, initialize one of the aReadMark slots to contain mxFrame as part of the recovery process. check-in: e4163596 user: dan tags: trunk
02:56
Amplification of a comment in wal.c. Change the aReadMark[] processing so that one read mark is left at zero when a WAL resets. check-in: 8c9ee1d7 user: drh tags: trunk
2012-07-16
23:13
Merge the spellfix1 changes for supporting matchlen into trunk. check-in: 6f167adf user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wal.c.

   138    138   ** connection to it closes.  Because the wal-index is transient, it can
   139    139   ** use an architecture-specific format; it does not have to be cross-platform.
   140    140   ** Hence, unlike the database and WAL file formats which store all values
   141    141   ** as big endian, the wal-index can store multi-byte values in the native
   142    142   ** byte order of the host computer.
   143    143   **
   144    144   ** The purpose of the wal-index is to answer this question quickly:  Given
   145         -** a page number P, return the index of the last frame for page P in the WAL,
   146         -** or return NULL if there are no frames for page P in the WAL.
          145  +** a page number P and a maximum frame index M, return the index of the 
          146  +** last frame in the wal before frame M for page P in the WAL, or return
          147  +** NULL if there are no frames for page P in the WAL prior to M.
   147    148   **
   148    149   ** The wal-index consists of a header region, followed by an one or
   149    150   ** more index blocks.  
   150    151   **
   151    152   ** The wal-index header contains the total number of frames within the WAL
   152    153   ** in the the mxFrame field.  
   153    154   **
................................................................................
  2607   2608   
  2608   2609           pWal->nCkpt++;
  2609   2610           pWal->hdr.mxFrame = 0;
  2610   2611           sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));
  2611   2612           aSalt[1] = salt1;
  2612   2613           walIndexWriteHdr(pWal);
  2613   2614           pInfo->nBackfill = 0;
  2614         -        for(i=1; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
         2615  +        pInfo->aReadMark[1] = 0;
         2616  +        for(i=2; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
  2615   2617           assert( pInfo->aReadMark[0]==0 );
  2616   2618           walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
  2617   2619         }else if( rc!=SQLITE_BUSY ){
  2618   2620           return rc;
  2619   2621         }
  2620   2622       }
  2621   2623       walUnlockShared(pWal, WAL_READ_LOCK(0));