/ Check-in [0c5db18d]
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:Progress handler improvements: (1) Invoke the callback after OP_Program opcodes (2) Invoke the callback multiple times in a row to catch up after a long run of no progress checks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0c5db18d79366d9c23925ce3ed835500311f32a10aa7dbfdd09148b1e8a2507b
User & Date: drh 2019-02-20 13:55:45
Context
2019-02-20
18:13
Avoid the use of function pointers in columnName(), as function pointers appear to be a source of consternation to LLVM. check-in: c48f6f39 user: drh tags: trunk
13:55
Progress handler improvements: (1) Invoke the callback after OP_Program opcodes (2) Invoke the callback multiple times in a row to catch up after a long run of no progress checks. check-in: 0c5db18d user: drh tags: trunk
12:52
When an IN operator drives a query loop, mark it as "CODED" so that it will not be used afterwards for a (pointless) membership test. This is a better fix for ticket [df46dfb631f75694] than the previous fix that is now on a branch as it preserves the full optimization of check-in [e130319317e76119]. check-in: fa792714 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

   815    815   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
   816    816     /* Call the progress callback if it is configured and the required number
   817    817     ** of VDBE ops have been executed (either since this invocation of
   818    818     ** sqlite3VdbeExec() or since last time the progress callback was called).
   819    819     ** If the progress callback returns non-zero, exit the virtual machine with
   820    820     ** a return code SQLITE_ABORT.
   821    821     */
   822         -  if( nVmStep>=nProgressLimit && db->xProgress!=0 ){
          822  +  while( nVmStep>=nProgressLimit && db->xProgress!=0 ){
   823    823       assert( db->nProgressOps!=0 );
   824         -    nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps);
          824  +    nProgressLimit += db->nProgressOps;
   825    825       if( db->xProgress(db->pProgressArg) ){
   826    826         nProgressLimit = 0xffffffff;
   827    827         rc = SQLITE_INTERRUPT;
   828    828         goto abort_due_to_error;
   829    829       }
   830    830     }
   831    831   #endif
................................................................................
  6170   6170       for(i=0; i<p->nMem; i++){
  6171   6171         aMem[i].pScopyFrom = 0;  /* Prevent false-positive AboutToChange() errs */
  6172   6172         aMem[i].flags |= MEM_Undefined; /* Cause a fault if this reg is reused */
  6173   6173       }
  6174   6174     }
  6175   6175   #endif
  6176   6176     pOp = &aOp[-1];
  6177         -
  6178         -  break;
         6177  +  goto check_for_interrupt;
  6179   6178   }
  6180   6179   
  6181   6180   /* Opcode: Param P1 P2 * * *
  6182   6181   **
  6183   6182   ** This opcode is only ever present in sub-programs called via the 
  6184   6183   ** OP_Program instruction. Copy a value currently stored in a memory 
  6185   6184   ** cell of the calling (parent) frame to cell P2 in the current frames 
................................................................................
  7581   7580     }
  7582   7581   
  7583   7582     /* This is the only way out of this procedure.  We have to
  7584   7583     ** release the mutexes on btrees that were acquired at the
  7585   7584     ** top. */
  7586   7585   vdbe_return:
  7587   7586   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  7588         -  if( nVmStep>=nProgressLimit && db->xProgress!=0 ){
         7587  +  while( nVmStep>=nProgressLimit && db->xProgress!=0 ){
         7588  +    nProgressLimit += db->nProgressOps;
  7589   7589       if( db->xProgress(db->pProgressArg) ){
  7590   7590         nProgressLimit = 0xffffffff;
  7591   7591         rc = SQLITE_INTERRUPT;
  7592   7592         goto abort_due_to_error;
  7593   7593       }
  7594   7594     }
  7595   7595   #endif