/ Check-in [262b6fca]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Add testcase macros to verify that all return values from walTryBeginRead() are tested.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 262b6fca0b7a251c02604c684a9f7e7a1434d630
User & Date: drh 2011-02-19 16:51:45
Context
2011-02-19
17:02
Change a testcase() added by the previous checkin into an assert(). check-in: 6f3dad32 user: drh tags: trunk
16:51
Add testcase macros to verify that all return values from walTryBeginRead() are tested. check-in: 262b6fca user: drh tags: trunk
15:22
Changes to make WAL more robust against SQLITE_PROTOCOL errors. check-in: fd578a32 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wal.c.

  2179   2179   int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
  2180   2180     int rc;                         /* Return code */
  2181   2181     int cnt = 0;                    /* Number of TryBeginRead attempts */
  2182   2182   
  2183   2183     do{
  2184   2184       rc = walTryBeginRead(pWal, pChanged, 0, ++cnt);
  2185   2185     }while( rc==WAL_RETRY );
         2186  +  testcase( (rc&0xff)==SQLITE_BUSY );
         2187  +  testcase( (rc&0xff)==SQLITE_IOERR );
         2188  +  testcase( rc==SQLITE_PROTOCOL );
         2189  +  testcase( rc==SQLITE_OK );
  2186   2190     return rc;
  2187   2191   }
  2188   2192   
  2189   2193   /*
  2190   2194   ** Finish with a read transaction.  All this does is release the
  2191   2195   ** read-lock.
  2192   2196   */
................................................................................
  2532   2536       walUnlockShared(pWal, WAL_READ_LOCK(0));
  2533   2537       pWal->readLock = -1;
  2534   2538       cnt = 0;
  2535   2539       do{
  2536   2540         int notUsed;
  2537   2541         rc = walTryBeginRead(pWal, &notUsed, 1, ++cnt);
  2538   2542       }while( rc==WAL_RETRY );
         2543  +    testcase( (rc&0xff)==SQLITE_BUSY );
         2544  +    testcase( (rc&0xff)==SQLITE_IOERR );
         2545  +    testcase( rc==SQLITE_PROTOCOL );
         2546  +    testcase( rc==SQLITE_OK );
  2539   2547     }
  2540   2548     return rc;
  2541   2549   }
  2542   2550   
  2543   2551   /* 
  2544   2552   ** Write a set of frames to the log. The caller must hold the write-lock
  2545   2553   ** on the log file (obtained using sqlite3WalBeginWriteTransaction()).