SQLite

Check-in [eb95dac7]
Login

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

Overview
Comment:Do an early close of virtual table cursors to avoid unnecessary cursor contention in UPDATE for some virtual table implementations. Ticket [56a74875be799b85]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: eb95dac7f6482c36853a23234c5ce7af37c7beed8e3675d6a49c4d3a8307e076
User & Date: drh 2019-12-23 19:28:34
Context
2019-12-24
21:01
Backout the early VTable cursor close change from yesterday, as Yongheng and Rui have found a test case for which it fails. The new test case is added to fuzzcheck. (check-in: ddb10f03 user: drh tags: trunk)
2019-12-23
20:07
Remove an extra deflateInit2() call accidently left in check-in [f5ee30426e8876e7] (check-in: 953e6aa6 user: drh tags: trunk)
19:28
Do an early close of virtual table cursors to avoid unnecessary cursor contention in UPDATE for some virtual table implementations. Ticket [56a74875be799b85] (check-in: eb95dac7 user: drh tags: trunk)
18:02
Early detection of database corruption in balance_deeper(). (check-in: 61c22336 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/where.c.

5336
5337
5338
5339
5340
5341
5342



5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
    if( pTabItem->fg.viaCoroutine ){
      testcase( pParse->db->mallocFailed );
      translateColumnToCopy(pParse, pLevel->addrBody, pLevel->iTabCur,
                            pTabItem->regResult, 0);
      continue;
    }




#ifdef SQLITE_ENABLE_EARLY_CURSOR_CLOSE
    /* Close all of the cursors that were opened by sqlite3WhereBegin.
    ** Except, do not close cursors that will be reused by the OR optimization
    ** (WHERE_OR_SUBCLAUSE).  And do not close the OP_OpenWrite cursors
    ** created for the ONEPASS optimization.
    */
    if( (pTab->tabFlags & TF_Ephemeral)==0
     && pTab->pSelect==0
     && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0
    ){
      int ws = pLoop->wsFlags;
      if( pWInfo->eOnePass==ONEPASS_OFF && (ws & WHERE_IDX_ONLY)==0 ){
        sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor);
      }







>
>
>






|







5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
    if( pTabItem->fg.viaCoroutine ){
      testcase( pParse->db->mallocFailed );
      translateColumnToCopy(pParse, pLevel->addrBody, pLevel->iTabCur,
                            pTabItem->regResult, 0);
      continue;
    }

    if( IsVirtual(pTab) ){
      sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor);
    }
#ifdef SQLITE_ENABLE_EARLY_CURSOR_CLOSE
    /* Close all of the cursors that were opened by sqlite3WhereBegin.
    ** Except, do not close cursors that will be reused by the OR optimization
    ** (WHERE_OR_SUBCLAUSE).  And do not close the OP_OpenWrite cursors
    ** created for the ONEPASS optimization.
    */
    else if( (pTab->tabFlags & TF_Ephemeral)==0
     && pTab->pSelect==0
     && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0
    ){
      int ws = pLoop->wsFlags;
      if( pWInfo->eOnePass==ONEPASS_OFF && (ws & WHERE_IDX_ONLY)==0 ){
        sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor);
      }