/ Check-in [2aeacf81]
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:Increase the WAL-mode SQLITE_PROTOCOL timeout to 10 seconds.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2aeacf81df92b4fe5d1825c1dc1cd176b8af8bd9
User & Date: drh 2014-06-12 17:10:18
Context
2014-06-13
13:08
Add an extension that implements compress() and uncompress() SQL functions. check-in: d5c17d1a user: drh tags: trunk
2014-06-12
17:10
Increase the WAL-mode SQLITE_PROTOCOL timeout to 10 seconds. check-in: 2aeacf81 user: drh tags: trunk
15:46
Simplify the estLog() routine. check-in: 6c68d758 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wal.c.

  2092   2092     ** during the few nanoseconds that it is holding the lock.  In that case,
  2093   2093     ** it might take longer than normal for the lock to free.
  2094   2094     **
  2095   2095     ** After 5 RETRYs, we begin calling sqlite3OsSleep().  The first few
  2096   2096     ** calls to sqlite3OsSleep() have a delay of 1 microsecond.  Really this
  2097   2097     ** is more of a scheduler yield than an actual delay.  But on the 10th
  2098   2098     ** an subsequent retries, the delays start becoming longer and longer, 
  2099         -  ** so that on the 100th (and last) RETRY we delay for 21 milliseconds.
  2100         -  ** The total delay time before giving up is less than 1 second.
         2099  +  ** so that on the 100th (and last) RETRY we delay for 323 milliseconds.
         2100  +  ** The total delay time before giving up is less than 10 seconds.
  2101   2101     */
  2102   2102     if( cnt>5 ){
  2103   2103       int nDelay = 1;                      /* Pause time in microseconds */
  2104   2104       if( cnt>100 ){
  2105   2105         VVA_ONLY( pWal->lockError = 1; )
  2106   2106         return SQLITE_PROTOCOL;
  2107   2107       }
  2108         -    if( cnt>=10 ) nDelay = (cnt-9)*238;  /* Max delay 21ms. Total delay 996ms */
         2108  +    if( cnt>=10 ) nDelay = (cnt-9)*(cnt-9)*39;
  2109   2109       sqlite3OsSleep(pWal->pVfs, nDelay);
  2110   2110     }
  2111   2111   
  2112   2112     if( !useWal ){
  2113   2113       rc = walIndexReadHdr(pWal, pChanged);
  2114   2114       if( rc==SQLITE_BUSY ){
  2115   2115         /* If there is not a recovery running in another thread or process