Lines Matching defs:pIncr

95108   IncrMerger *pIncr;          /* Incremental merger */
95113 ** within a temp file. However, if the PmaReader.pIncr variable points to
95220 vdbeIncrFree(pReadr->pIncr);
95385 assert( pReadr->pIncr==0 || pReadr->pIncr->bEof==0 );
95430 IncrMerger *pIncr = pReadr->pIncr;
95432 if( pIncr ){
95433 rc = vdbeIncrSwap(pIncr);
95434 if( rc==SQLITE_OK && pIncr->bEof==0 ){
95436 pIncr->pTask, pReadr, &pIncr->aFile[0], pIncr->iStartOff
95959 static void vdbeIncrFree(IncrMerger *pIncr){
95960 if( pIncr ){
95962 if( pIncr->bUseThread ){
95963 vdbeSorterJoinThread(pIncr->pTask);
95964 if( pIncr->aFile[0].pFd ) sqlite3OsCloseFree(pIncr->aFile[0].pFd);
95965 if( pIncr->aFile[1].pFd ) sqlite3OsCloseFree(pIncr->aFile[1].pFd);
95968 vdbeMergeEngineFree(pIncr->pMerger);
95969 sqlite3_free(pIncr);
96620 ** Read keys from pIncr->pMerger and populate pIncr->aFile[1]. The format
96624 static int vdbeIncrPopulate(IncrMerger *pIncr){
96627 i64 iStart = pIncr->iStartOff;
96628 SorterFile *pOut = &pIncr->aFile[1];
96629 SortSubtask *pTask = pIncr->pTask;
96630 MergeEngine *pMerger = pIncr->pMerger;
96632 assert( pIncr->bEof==0 );
96646 if( (iEof + nKey + sqlite3VarintLen(nKey))>(iStart + pIncr->mxSz) ) break;
96651 assert( pIncr->pMerger->pTask==pTask );
96652 rc = vdbeMergeEngineStep(pIncr->pMerger, &dummy);
96667 IncrMerger *pIncr = (IncrMerger*)pCtx;
96668 void *pRet = SQLITE_INT_TO_PTR( vdbeIncrPopulate(pIncr) );
96669 pIncr->pTask->bDone = 1;
96674 ** Launch a background thread to populate aFile[1] of pIncr.
96676 static int vdbeIncrBgPopulate(IncrMerger *pIncr){
96677 void *p = (void*)pIncr;
96678 assert( pIncr->bUseThread );
96679 return vdbeSorterCreateThread(pIncr->pTask, vdbeIncrPopulateThread, p);
96684 ** This function is called when the PmaReader corresponding to pIncr has
96690 ** keys from pIncr->pMerger and repopulating aFile[0].
96700 static int vdbeIncrSwap(IncrMerger *pIncr){
96704 if( pIncr->bUseThread ){
96705 rc = vdbeSorterJoinThread(pIncr->pTask);
96708 SorterFile f0 = pIncr->aFile[0];
96709 pIncr->aFile[0] = pIncr->aFile[1];
96710 pIncr->aFile[1] = f0;
96714 if( pIncr->aFile[0].iEof==pIncr->iStartOff ){
96715 pIncr->bEof = 1;
96717 rc = vdbeIncrBgPopulate(pIncr);
96723 rc = vdbeIncrPopulate(pIncr);
96724 pIncr->aFile[0] = pIncr->aFile[1];
96725 if( pIncr->aFile[0].iEof==pIncr->iStartOff ){
96726 pIncr->bEof = 1;
96745 IncrMerger *pIncr = *ppOut = (IncrMerger*)
96746 (sqlite3FaultSim(100) ? 0 : sqlite3MallocZero(sizeof(*pIncr)));
96747 if( pIncr ){
96748 pIncr->pMerger = pMerger;
96749 pIncr->pTask = pTask;
96750 pIncr->mxSz = MAX(pTask->pSorter->mxKeysize+9,pTask->pSorter->mxPmaSize/2);
96751 pTask->file2.iEof += pIncr->mxSz;
96761 ** Set the "use-threads" flag on object pIncr.
96763 static void vdbeIncrMergerSetThreads(IncrMerger *pIncr){
96764 pIncr->bUseThread = 1;
96765 pIncr->pTask->file2.iEof -= pIncr->mxSz;
96903 ** incremental-reader (pReadr->pIncr!=0). This function serves to open
96905 ** object at (pReadr->pIncr).
96927 ** that pReadr->pIncr is a multi-threaded IncrMerge objects, and that all
96936 IncrMerger *pIncr = pReadr->pIncr;
96937 SortSubtask *pTask = pIncr->pTask;
96943 rc = vdbeMergeEngineInit(pTask, pIncr->pMerger, eMode);
96945 /* Set up the required files for pIncr. A multi-theaded IncrMerge object
96949 int mxSz = pIncr->mxSz;
96951 if( pIncr->bUseThread ){
96952 rc = vdbeSorterOpenTempFile(db, mxSz, &pIncr->aFile[0].pFd);
96954 rc = vdbeSorterOpenTempFile(db, mxSz, &pIncr->aFile[1].pFd);
96958 /*if( !pIncr->bUseThread )*/{
96965 pIncr->aFile[1].pFd = pTask->file2.pFd;
96966 pIncr->iStartOff = pTask->file2.iEof;
96973 if( rc==SQLITE_OK && pIncr->bUseThread ){
96977 ** pIncr->pTask->thread.
96985 rc = vdbeIncrPopulate(pIncr);
97006 pReader->pIncr->pTask->bDone = 1;
97013 ** (if pReadr->pIncr==0), then this function is a no-op. Otherwise, it invokes
97023 IncrMerger *pIncr = pReadr->pIncr; /* Incremental merger */
97025 if( pIncr ){
97027 assert( pIncr->bUseThread==0 || eMode==INCRINIT_TASK );
97028 if( pIncr->bUseThread ){
97030 rc = vdbeSorterCreateThread(pIncr->pTask, vdbePmaReaderBgIncrInit, pCtx);
97120 IncrMerger *pIncr;
97122 rc = vdbeIncrMergerNew(pTask, pLeaf, &pIncr);
97132 if( pReadr->pIncr==0 ){
97137 rc = vdbeIncrMergerNew(pTask, pNew, &pReadr->pIncr);
97141 p = pReadr->pIncr->pMerger;
97147 p->aReadr[iSeq % SORTER_MAX_MERGE_COUNT].pIncr = pIncr;
97149 vdbeIncrFree(pIncr);
97214 rc = vdbeIncrMergerNew(pTask, pRoot, &pMain->aReadr[iTask].pIncr);
97272 rc = vdbeIncrMergerNew(pLast, pMain, &pReadr->pIncr);
97274 vdbeIncrMergerSetThreads(pReadr->pIncr);
97276 IncrMerger *pIncr;
97277 if( (pIncr = pMain->aReadr[iTask].pIncr) ){
97278 vdbeIncrMergerSetThreads(pIncr);
97279 assert( pIncr->pTask!=pLast );
97293 assert( p->pIncr==0 || (
97294 (p->pIncr->pTask==&pSorter->aTask[iTask]) /* a */
97295 && (iTask!=pSorter->nTask-1 || p->pIncr->bUseThread==0) /* b */