SQLite

Check-in [f97b12e095]
Login

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

Overview
Comment:Fix another bug in the incremental merge code.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | fts4-incr-merge
Files: files | file ages | folders
SHA1: f97b12e0955c4c29f9c31a186d72d87f7407782e
User & Date: dan 2012-03-14 11:51:31.020
Context
2012-03-14
12:17
Avoid allocating a large object on the stack in the incremental merge code. Use sqlite3_malloc() instead. (check-in: 36ae510de4 user: dan tags: fts4-incr-merge)
11:51
Fix another bug in the incremental merge code. (check-in: f97b12e095 user: dan tags: fts4-incr-merge)
2012-03-13
19:56
Fix some bugs in the incremental merge code. Some remain. (check-in: bff2168370 user: dan tags: fts4-incr-merge)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/fts3/fts3_write.c.
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
      pWriter->iIdx = iIdx;

      for(i=nHeight+1; i<FTS_MAX_APPENDABLE_HEIGHT; i++){
        pWriter->aLayer[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;
      }

      pLayer = &pWriter->aLayer[nHeight];
      pLayer->iBlock = pWriter->iStart;
      pLayer->iBlock += pWriter->nLeafEst*FTS_MAX_APPENDABLE_HEIGHT;
      blobGrowBuffer(&pLayer->block, MAX(nRoot, p->nNodeSize), &rc);
      if( rc==SQLITE_OK ){
        memcpy(pLayer->block.a, aRoot, nRoot);
        pLayer->block.n = nRoot;
      }

      for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){







|
<







3722
3723
3724
3725
3726
3727
3728
3729

3730
3731
3732
3733
3734
3735
3736
      pWriter->iIdx = iIdx;

      for(i=nHeight+1; i<FTS_MAX_APPENDABLE_HEIGHT; i++){
        pWriter->aLayer[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;
      }

      pLayer = &pWriter->aLayer[nHeight];
      pLayer->iBlock = pWriter->iStart + pWriter->nLeafEst*nHeight;

      blobGrowBuffer(&pLayer->block, MAX(nRoot, p->nNodeSize), &rc);
      if( rc==SQLITE_OK ){
        memcpy(pLayer->block.a, aRoot, nRoot);
        pLayer->block.n = nRoot;
      }

      for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
          pLayer->key.n = reader.term.n;
          if( i>0 ){
            char *aBlock = 0;
            int nBlock = 0;
            pLayer = &pWriter->aLayer[i-1];
            pLayer->iBlock = reader.iChild;
            rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0);
            blobGrowBuffer(&pLayer->block, nBlock, &rc);
            if( rc==SQLITE_OK ){
              memcpy(pLayer->block.a, aBlock, nBlock);
              pLayer->block.n = nBlock;
            }
            sqlite3_free(aBlock);
          }
        }







|







3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
          pLayer->key.n = reader.term.n;
          if( i>0 ){
            char *aBlock = 0;
            int nBlock = 0;
            pLayer = &pWriter->aLayer[i-1];
            pLayer->iBlock = reader.iChild;
            rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0);
            blobGrowBuffer(&pLayer->block, MAX(nBlock, p->nNodeSize), &rc);
            if( rc==SQLITE_OK ){
              memcpy(pLayer->block.a, aBlock, nBlock);
              pLayer->block.n = nBlock;
            }
            sqlite3_free(aBlock);
          }
        }