• Home
  • Raw
  • Download

Lines Matching refs:pWriter

58652   Btree *pWriter;       /* Btree with currently open write transaction */
59469 assert( eLock==READ_LOCK || (p==pBt->pWriter && p->inTrans==TRANS_WRITE) );
59480 if( pBt->pWriter!=p && (pBt->btsFlags & BTS_EXCLUSIVE)!=0 ){
59481 sqlite3ConnectionBlocked(p->db, pBt->pWriter->db);
59500 assert( p==pBt->pWriter );
59602 assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree );
59615 assert( (pBt->btsFlags & BTS_PENDING)==0 || pBt->pWriter );
59616 if( pBt->pWriter==p ){
59617 pBt->pWriter = 0;
59638 if( pBt->pWriter==p ){
59640 pBt->pWriter = 0;
62449 pBlock = pBt->pWriter->db;
62521 assert( !pBt->pWriter );
62522 pBt->pWriter = p;
158278 SegmentWriter *pWriter = *ppWriter;
158280 if( !pWriter ){
158285 pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter));
158286 if( !pWriter ) return SQLITE_NOMEM;
158287 memset(pWriter, 0, sizeof(SegmentWriter));
158288 *ppWriter = pWriter;
158291 pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize);
158292 if( !pWriter->aData ) return SQLITE_NOMEM;
158293 pWriter->nSize = p->nNodeSize;
158299 pWriter->iFree = sqlite3_column_int64(pStmt, 0);
158300 pWriter->iFirst = pWriter->iFree;
158305 nData = pWriter->nData;
158307 nPrefix = fts3PrefixCompress(pWriter->zTerm, pWriter->nTerm, zTerm, nTerm);
158321 rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, nData);
158338 rc = fts3NodeAddTerm(p, &pWriter->pTree, isCopyTerm, zTerm, nPrefix+1);
158342 pWriter->nTerm = 0;
158354 pWriter->nLeafData += nReq;
158359 if( nReq>pWriter->nSize ){
158360 char *aNew = sqlite3_realloc(pWriter->aData, nReq);
158362 pWriter->aData = aNew;
158363 pWriter->nSize = nReq;
158365 assert( nData+nReq<=pWriter->nSize );
158368 nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nPrefix);
158369 nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nSuffix);
158370 memcpy(&pWriter->aData[nData], &zTerm[nPrefix], nSuffix);
158372 nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nDoclist);
158373 memcpy(&pWriter->aData[nData], aDoclist, nDoclist);
158374 pWriter->nData = nData + nDoclist;
158382 if( nTerm>pWriter->nMalloc ){
158383 char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2);
158387 pWriter->nMalloc = nTerm*2;
158388 pWriter->zMalloc = zNew;
158389 pWriter->zTerm = zNew;
158391 assert( pWriter->zTerm==pWriter->zMalloc );
158392 memcpy(pWriter->zTerm, zTerm, nTerm);
158394 pWriter->zTerm = (char *)zTerm;
158396 pWriter->nTerm = nTerm;
158409 SegmentWriter *pWriter, /* SegmentWriter to flush to the db */
158414 if( pWriter->pTree ){
158420 iLastLeaf = pWriter->iFree;
158421 rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, pWriter->nData);
158423 rc = fts3NodeWrite(p, pWriter->pTree, 1,
158424 pWriter->iFirst, pWriter->iFree, &iLast, &zRoot, &nRoot);
158428 pWriter->iFirst, iLastLeaf, iLast, pWriter->nLeafData, zRoot, nRoot);
158433 0, 0, 0, pWriter->nLeafData, pWriter->aData, pWriter->nData);
158443 static void fts3SegWriterFree(SegmentWriter *pWriter){
158444 if( pWriter ){
158445 sqlite3_free(pWriter->aData);
158446 sqlite3_free(pWriter->zMalloc);
158447 fts3NodeFree(pWriter->pTree);
158448 sqlite3_free(pWriter);
159237 SegmentWriter *pWriter = 0; /* Used to write the new, merged, segment */
159294 rc = fts3SegWriterAdd(p, &pWriter, 1,
159298 assert( pWriter || bIgnoreEmpty );
159306 if( pWriter ){
159307 rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx);
159310 rc = fts3PromoteSegments(p, iNewLevel, pWriter->nLeafData);
159316 fts3SegWriterFree(pWriter);
159859 IncrmergeWriter *pWriter, /* Writer object */
159863 sqlite3_int64 iPtr = pWriter->aNodeWriter[0].iBlock;
159869 NodeWriter *pNode = &pWriter->aNodeWriter[iLayer];
160010 IncrmergeWriter *pWriter, /* Writer object */
160023 pLeaf = &pWriter->aNodeWriter[0];
160036 pWriter->nWork++;
160051 rc = fts3IncrmergePush(p, pWriter, zTerm, nPrefix+1);
160065 pWriter->nLeafData += nSpace;
160095 IncrmergeWriter *pWriter, /* Merge-writer object */
160108 NodeWriter *pNode = &pWriter->aNodeWriter[iRoot];
160135 Blob *pBlock = &pWriter->aNodeWriter[1].block;
160140 &pBlock->a[1], pWriter->aNodeWriter[0].iBlock
160145 pRoot = &pWriter->aNodeWriter[iRoot];
160149 NodeWriter *pNode = &pWriter->aNodeWriter[i];
160160 pWriter->iAbsLevel+1, /* level */
160161 pWriter->iIdx, /* idx */
160162 pWriter->iStart, /* start_block */
160163 pWriter->aNodeWriter[0].iBlock, /* leaves_end_block */
160164 pWriter->iEnd, /* end_block */
160165 (pWriter->bNoLeafData==0 ? pWriter->nLeafData : 0), /* end_block */
160246 IncrmergeWriter *pWriter /* Populate this object */
160267 fts3ReadEndBlockField(pSelect, 3, &iEnd, &pWriter->nLeafData);
160268 if( pWriter->nLeafData<0 ){
160269 pWriter->nLeafData = pWriter->nLeafData * -1;
160271 pWriter->bNoLeafData = (pWriter->nLeafData==0);
160310 pWriter->nLeafEst = (int)((iEnd - iStart) + 1)/FTS_MAX_APPENDABLE_HEIGHT;
160311 pWriter->iStart = iStart;
160312 pWriter->iEnd = iEnd;
160313 pWriter->iAbsLevel = iAbsLevel;
160314 pWriter->iIdx = iIdx;
160317 pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;
160320 pNode = &pWriter->aNodeWriter[nHeight];
160321 pNode->iBlock = pWriter->iStart + pWriter->nLeafEst*nHeight;
160330 pNode = &pWriter->aNodeWriter[i];
160341 pNode = &pWriter->aNodeWriter[i-1];
160422 IncrmergeWriter *pWriter /* Populate this object */
160446 pWriter->iStart = sqlite3_column_int64(pFirstBlock, 0);
160447 pWriter->iEnd = pWriter->iStart - 1;
160448 pWriter->iEnd += nLeafEst * FTS_MAX_APPENDABLE_HEIGHT;
160457 rc = fts3WriteSegment(p, pWriter->iEnd, 0, 0);
160460 pWriter->iAbsLevel = iAbsLevel;
160461 pWriter->nLeafEst = nLeafEst;
160462 pWriter->iIdx = iIdx;
160466 pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;
160883 IncrmergeWriter *pWriter; /* Writer object */
160890 const int nAlloc = sizeof(*pCsr) + sizeof(*pFilter) + sizeof(*pWriter);
160891 pWriter = (IncrmergeWriter *)sqlite3_malloc(nAlloc);
160892 if( !pWriter ) return SQLITE_NOMEM;
160893 pFilter = (Fts3SegFilter *)&pWriter[1];
160954 memset(pWriter, 0, nAlloc);
160979 rc = fts3IncrmergeLoad(p, iAbsLevel, iIdx-1, zKey, nKey, pWriter);
160981 rc = fts3IncrmergeWriter(p, iAbsLevel, iIdx, pCsr, pWriter);
160984 if( rc==SQLITE_OK && pWriter->nLeafEst ){
160987 rc = fts3IncrmergeAppend(p, pWriter, pCsr);
160989 if( pWriter->nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK;
160994 nRem -= (1 + pWriter->nWork);
161004 pWriter->nLeafData = pWriter->nLeafData * -1;
161006 fts3IncrmergeRelease(p, pWriter, &rc);
161007 if( nSeg==0 && pWriter->bNoLeafData==0 ){
161008 fts3PromoteSegments(p, iAbsLevel+1, pWriter->nLeafData);
161020 sqlite3_free(pWriter);
172327 sqlite3_stmt *pWriter;
172345 pWriter = pIter->pDelete;
172347 pWriter = pIter->pInsert;
172368 p->rc = sqlite3_bind_value(pWriter, i+1, pVal);
172387 p->rc = sqlite3_bind_value(pWriter, pIter->nCol+1, pVal);
172391 sqlite3_step(pWriter);
172392 p->rc = resetAndCollectError(pWriter, &p->zErrmsg);
185656 Fts5PoslistWriter *pWriter,
185661 sqlite3Fts5PoslistSafeAppend(pBuf, &pWriter->iPrev, iPos);
187395 Fts5PoslistWriter *pWriter = &a[i].writer;
187396 if( a[i].pOut->n==0 || iPos!=pWriter->iPrev ){
187397 sqlite3Fts5PoslistWriterAppend(a[i].pOut, pWriter, iPos);
190430 sqlite3_stmt *pWriter; /* "INSERT ... %_data VALUES(?,?)" */
190876 if( p->pWriter==0 ){
190878 fts5IndexPrepareStmt(p, &p->pWriter, sqlite3_mprintf(
190885 sqlite3_bind_int64(p->pWriter, 1, iRowid);
190886 sqlite3_bind_blob(p->pWriter, 2, pData, nData, SQLITE_STATIC);
190887 sqlite3_step(p->pWriter);
190888 p->rc = sqlite3_reset(p->pWriter);
193765 Fts5SegWriter *pWriter,
193769 assert( bFlush==0 || (pWriter->nDlidx>0 && pWriter->aDlidx[0].buf.n>0) );
193770 for(i=0; i<pWriter->nDlidx; i++){
193771 Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[i];
193776 FTS5_DLIDX_ROWID(pWriter->iSegid, i, pDlidx->pgno),
193791 Fts5SegWriter *pWriter,
193794 if( p->rc==SQLITE_OK && nLvl>=pWriter->nDlidx ){
193796 pWriter->aDlidx, sizeof(Fts5DlidxWriter) * nLvl
193801 int nByte = sizeof(Fts5DlidxWriter) * (nLvl - pWriter->nDlidx);
193802 memset(&aDlidx[pWriter->nDlidx], 0, nByte);
193803 pWriter->aDlidx = aDlidx;
193804 pWriter->nDlidx = nLvl;
193815 static int fts5WriteFlushDlidx(Fts5Index *p, Fts5SegWriter *pWriter){
193820 if( pWriter->aDlidx[0].buf.n>0 && pWriter->nEmpty>=FTS5_MIN_DLIDX_SIZE ){
193823 fts5WriteDlidxClear(p, pWriter, bFlag);
193824 pWriter->nEmpty = 0;
193839 static void fts5WriteFlushBtree(Fts5Index *p, Fts5SegWriter *pWriter){
193842 assert( pWriter->iBtPage || pWriter->nEmpty==0 );
193843 if( pWriter->iBtPage==0 ) return;
193844 bFlag = fts5WriteFlushDlidx(p, pWriter);
193847 const char *z = (pWriter->btterm.n>0?(const char*)pWriter->btterm.p:"");
193850 sqlite3_bind_blob(p->pIdxWriter, 2, z, pWriter->btterm.n, SQLITE_STATIC);
193851 sqlite3_bind_int64(p->pIdxWriter, 3, bFlag + ((i64)pWriter->iBtPage<<1));
193855 pWriter->iBtPage = 0;
193869 Fts5SegWriter *pWriter, /* Writer object */
193872 fts5WriteFlushBtree(p, pWriter);
193873 fts5BufferSet(&p->rc, &pWriter->btterm, nTerm, pTerm);
193874 pWriter->iBtPage = pWriter->writer.pgno;
193883 Fts5SegWriter *pWriter /* Writer object */
193887 if( pWriter->bFirstRowidInPage && pWriter->aDlidx[0].buf.n>0 ){
193888 Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[0];
193894 pWriter->nEmpty++;
193913 Fts5SegWriter *pWriter,
193921 Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[i];
193931 FTS5_DLIDX_ROWID(pWriter->iSegid, i, pDlidx->pgno),
193934 fts5WriteDlidxGrow(p, pWriter, i+2);
193935 pDlidx = &pWriter->aDlidx[i];
193958 i64 iPgno = (i==0 ? pWriter->writer.pgno : pDlidx[-1].pgno);
193971 static void fts5WriteFlushLeaf(Fts5Index *p, Fts5SegWriter *pWriter){
193973 Fts5PageWriter *pPage = &pWriter->writer;
193976 assert( (pPage->pgidx.n==0)==(pWriter->bFirstTermInPage) );
193982 if( pWriter->bFirstTermInPage ){
193985 fts5WriteBtreeNoTerm(p, pWriter);
193992 iRowid = FTS5_SEGMENT_ROWID(pWriter->iSegid, pPage->pgno);
194003 pWriter->nLeafWritten++;
194006 pWriter->bFirstTermInPage = 1;
194007 pWriter->bFirstRowidInPage = 1;
194019 Fts5SegWriter *pWriter,
194023 Fts5PageWriter *pPage = &pWriter->writer;
194024 Fts5Buffer *pPgidx = &pWriter->writer.pgidx;
194028 assert( pPage->buf.n>4 || pWriter->bFirstTermInPage );
194033 fts5WriteFlushLeaf(p, pWriter);
194048 if( pWriter->bFirstTermInPage ){
194068 fts5WriteBtreeTerm(p, pWriter, n, pTerm);
194069 pPage = &pWriter->writer;
194083 pWriter->bFirstTermInPage = 0;
194085 pWriter->bFirstRowidInPage = 0;
194086 pWriter->bFirstRowidInDoclist = 1;
194088 assert( p->rc || (pWriter->nDlidx>0 && pWriter->aDlidx[0].buf.n==0) );
194089 pWriter->aDlidx[0].pgno = pPage->pgno;
194097 Fts5SegWriter *pWriter,
194101 Fts5PageWriter *pPage = &pWriter->writer;
194104 fts5WriteFlushLeaf(p, pWriter);
194110 if( pWriter->bFirstRowidInPage ){
194112 fts5WriteDlidxAppend(p, pWriter, iRowid);
194116 if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){
194119 assert( p->rc || iRowid>pWriter->iPrevRowid );
194120 fts5BufferAppendVarint(&p->rc, &pPage->buf, iRowid - pWriter->iPrevRowid);
194122 pWriter->iPrevRowid = iRowid;
194123 pWriter->bFirstRowidInDoclist = 0;
194124 pWriter->bFirstRowidInPage = 0;
194130 Fts5SegWriter *pWriter,
194134 Fts5PageWriter *pPage = &pWriter->writer;
194151 fts5WriteFlushLeaf(p, pWriter);
194164 Fts5SegWriter *pWriter, /* Writer object */
194168 Fts5PageWriter *pLeaf = &pWriter->writer;
194172 fts5WriteFlushLeaf(p, pWriter);
194176 fts5WriteFlushBtree(p, pWriter);
194182 fts5BufferFree(&pWriter->btterm);
194184 for(i=0; i<pWriter->nDlidx; i++){
194185 sqlite3Fts5BufferFree(&pWriter->aDlidx[i].buf);
194187 sqlite3_free(pWriter->aDlidx);
194192 Fts5SegWriter *pWriter,
194197 memset(pWriter, 0, sizeof(Fts5SegWriter));
194198 pWriter->iSegid = iSegid;
194200 fts5WriteDlidxGrow(p, pWriter, 1);
194201 pWriter->writer.pgno = 1;
194202 pWriter->bFirstTermInPage = 1;
194203 pWriter->iBtPage = 1;
194205 assert( pWriter->writer.buf.n==0 );
194206 assert( pWriter->writer.pgidx.n==0 );
194209 sqlite3Fts5BufferSize(&p->rc, &pWriter->writer.pgidx, nBuffer);
194210 sqlite3Fts5BufferSize(&p->rc, &pWriter->writer.buf, nBuffer);
194222 memset(pWriter->writer.buf.p, 0, 4);
194223 pWriter->writer.buf.n = 4;
194228 sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid);
194299 Fts5SegWriter *pWriter = (Fts5SegWriter*)pCtx;
194300 fts5WriteAppendPoslistData(p, pWriter, pChunk, nChunk);
195352 sqlite3_finalize(p->pWriter);