]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Enhancement the progress callback mechanism so that the progress callback
authordrh <drh@noemail.net>
Tue, 12 Feb 2019 21:04:33 +0000 (21:04 +0000)
committerdrh <drh@noemail.net>
Tue, 12 Feb 2019 21:04:33 +0000 (21:04 +0000)
is always invoked at least once at the end of a prepared statement if the
opcode count has been exceeded.  This makes the progress callback more
effective at limiting run times.  This check-in also includes and unrelated
performance enhancement to OP_Column.

FossilOrigin-Name: 68cce272e7f7cbc0c319ee8b7ff674d652cb1e95e903d99d848c41dff2b5d304

manifest
manifest.uuid
src/vdbe.c

index a6491a69267c3d6d77fa96c0cbaf316b825e05fc..5c73685344391666c49cbcc895468a5d3220b6d4 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Further\sperformance\simprovements\sto\sbtreeInitPage().
-D 2019-02-12T16:58:26.325
+C Enhancement\sthe\sprogress\scallback\smechanism\sso\sthat\sthe\sprogress\scallback\nis\salways\sinvoked\sat\sleast\sonce\sat\sthe\send\sof\sa\sprepared\sstatement\sif\sthe\s\nopcode\scount\shas\sbeen\sexceeded.\s\sThis\smakes\sthe\sprogress\scallback\smore\neffective\sat\slimiting\srun\stimes.\s\sThis\scheck-in\salso\sincludes\sand\sunrelated\nperformance\senhancement\sto\sOP_Column.
+D 2019-02-12T21:04:33.203
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in 178d8eb6840771149cee40b322d1b3be30d330198c522c903c1b66fb5a1bfca4
@@ -585,7 +585,7 @@ F src/upsert.c 0dd81b40206841814d46942a7337786932475f085716042d0cb2fc7791bf8ca4
 F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
 F src/util.c 82a2e3f691a3b654be872e305dab1f455e565dedf5e6a90c818c1ab307c00432
 F src/vacuum.c a9f389f41556c0ec310bc9169dc9476603c30a0a913ad92bfbc75c86886967ca
-F src/vdbe.c b7b6f965153607072917dbd81d654a268abf4872c58d556701d1549550766c02
+F src/vdbe.c f72cc550d2c63f6d98f00991e6ed18b25232d5b216c059db52aeb73002c8202b
 F src/vdbe.h 712bca562eaed1c25506b9faf9680bdc75fc42e2f4a1cd518d883fa79c7a4237
 F src/vdbeInt.h a76d5eed62c76bcd8de7afd3147fac1bc40c5a870582664bcd7d071ef437c37f
 F src/vdbeapi.c 57a2d794a8833f269b878dbc24e955369bdb379af6c4e93ebc5ce1a20fa3daf4
@@ -1804,7 +1804,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 6eb38c59a81d27b7c1f3edad84b27a1114df6f1607282b2be1b5de9c7decc512
-R cc90c00a72cee7c141819cd12b6430c9
+P 93ae382e97c23c90312739481e47ef7f9bc475a8382c063a2de2986c950c0aec
+R 5a73d1580b6ec582f25521606ec44ea5
 U drh
-Z ba80ee88206970e9c79aaddf47903f84
+Z 5e5592ea1699abe7b2bf0590d6631ed0
index ed488bb4f53f44d04c0a900dc72541a4676f367f..7ef8d1855ee590c1a576da8bd2aeaf9731bfaa46 100644 (file)
@@ -1 +1 @@
-93ae382e97c23c90312739481e47ef7f9bc475a8382c063a2de2986c950c0aec
\ No newline at end of file
+68cce272e7f7cbc0c319ee8b7ff674d652cb1e95e903d99d848c41dff2b5d304
\ No newline at end of file
index 98df0a39772f3f4df28b926a8c88fe3254bd7e50..7ade29cb78e26e8e025115205bdf112643e49412 100644 (file)
@@ -823,6 +823,7 @@ check_for_interrupt:
     assert( db->nProgressOps!=0 );
     nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps);
     if( db->xProgress(db->pProgressArg) ){
+      nProgressLimit = 0xffffffff;
       rc = SQLITE_INTERRUPT;
       goto abort_due_to_error;
     }
@@ -1368,18 +1369,6 @@ case OP_ResultRow: {
   assert( pOp->p1>0 );
   assert( pOp->p1+pOp->p2<=(p->nMem+1 - p->nCursor)+1 );
 
-#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
-  /* Run the progress counter just before returning.
-  */
-  if( db->xProgress!=0
-   && nVmStep>=nProgressLimit 
-   && db->xProgress(db->pProgressArg)!=0
-  ){
-    rc = SQLITE_INTERRUPT;
-    goto abort_due_to_error;
-  }
-#endif
-
   /* If this statement has violated immediate foreign key constraints, do
   ** not return the number of rows modified. And do not RELEASE the statement
   ** transaction. It needs to be rolled back.  */
@@ -2606,15 +2595,15 @@ case OP_Column: {
       zEndHdr = zData + aOffset[0];
       testcase( zHdr>=zEndHdr );
       do{
-        if( (t = zHdr[0])<0x80 ){
+        if( (pC->aType[i] = t = zHdr[0])<0x80 ){
           zHdr++;
           offset64 += sqlite3VdbeOneByteSerialTypeLen(t);
         }else{
           zHdr += sqlite3GetVarint32(zHdr, &t);
+          pC->aType[i] = t;
           offset64 += sqlite3VdbeSerialTypeLen(t);
         }
-        pC->aType[i++] = t;
-        aOffset[i] = (u32)(offset64 & 0xffffffff);
+        aOffset[++i] = (u32)(offset64 & 0xffffffff);
       }while( i<=p2 && zHdr<zEndHdr );
 
       /* The record is corrupt if any of the following are true:
@@ -7595,7 +7584,15 @@ abort_due_to_error:
   ** release the mutexes on btrees that were acquired at the
   ** top. */
 vdbe_return:
-  testcase( nVmStep>0 );
+#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
+  if( nVmStep>=nProgressLimit && db->xProgress!=0 ){
+    if( db->xProgress(db->pProgressArg) ){
+      nProgressLimit = 0xffffffff;
+      rc = SQLITE_INTERRUPT;
+      goto abort_due_to_error;
+    }
+  }
+#endif
   p->aCounter[SQLITE_STMTSTATUS_VM_STEP] += (int)nVmStep;
   sqlite3VdbeLeave(p);
   assert( rc!=SQLITE_OK || nExtraDelete==0