/ Check-in [8d3af201]
Login

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

Overview
Comment:Add a defense-in-depth NEVER() test to the WAL cleanup code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8d3af2010f4f652865f5c0d18e3bc793de05f8e75e75cc77786f61004b2ad28f
User & Date: drh 2019-04-03 17:48:10
Context
2019-04-04
14:00
Only preserve rowid values for VACUUM INTO. Keep the legacy behavior of renumbering rowids for ordinary VACUUM. check-in: 13a0ea64 user: drh tags: trunk
2019-04-03
17:54
Add a defense-in-depth NEVER() test to the WAL cleanup code. Leaf check-in: 1109942a user: drh tags: branch-3.27
17:48
Add a defense-in-depth NEVER() test to the WAL cleanup code. check-in: 8d3af201 user: drh tags: trunk
16:27
Fix a couple of problems with "RANGE BETWEEN <expr> PRECEDING AND <expr> PRECEDING" frames. check-in: 39225cc7 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wal.c.

   982    982   ** actually needed.
   983    983   */
   984    984   static void walCleanupHash(Wal *pWal){
   985    985     WalHashLoc sLoc;                /* Hash table location */
   986    986     int iLimit = 0;                 /* Zero values greater than this */
   987    987     int nByte;                      /* Number of bytes to zero in aPgno[] */
   988    988     int i;                          /* Used to iterate through aHash[] */
          989  +  int rc;                         /* Return code form walHashGet() */
   989    990   
   990    991     assert( pWal->writeLock );
   991    992     testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 );
   992    993     testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE );
   993    994     testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 );
   994    995   
   995    996     if( pWal->hdr.mxFrame==0 ) return;
   996    997   
   997    998     /* Obtain pointers to the hash-table and page-number array containing 
   998    999     ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed
   999         -  ** that the page said hash-table and array reside on is already mapped.
         1000  +  ** that the page said hash-table and array reside on is already mapped.(1)
  1000   1001     */
  1001   1002     assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) );
  1002   1003     assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] );
  1003         -  walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &sLoc);
         1004  +  rc = walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &sLoc);
         1005  +  if( NEVER(rc) ) return; /* Defense-in-depth, in case (1) above is wrong */
  1004   1006   
  1005   1007     /* Zero all hash-table entries that correspond to frame numbers greater
  1006   1008     ** than pWal->hdr.mxFrame.
  1007   1009     */
  1008   1010     iLimit = pWal->hdr.mxFrame - sLoc.iZero;
  1009   1011     assert( iLimit>0 );
  1010   1012     for(i=0; i<HASHTABLE_NSLOT; i++){