• Home
  • Raw
  • Download

Lines Matching refs:pTask

99821   SortSubtask *pTask;        /* Used by this thread only */
99960 SortSubtask *pTask; /* Task that owns this merger */
100176 static int vdbeSorterMapFile(SortSubtask *pTask, SorterFile *pFile, u8 **pp){
100178 if( pFile->iEof<=(i64)(pTask->pSorter->db->nMaxSorterMmap) ){
100194 SortSubtask *pTask, /* Task context */
100212 rc = vdbeSorterMapFile(pTask, pFile, &pReadr->aMap);
100214 int pgsz = pTask->pSorter->pgsz;
100252 pIncr->pTask, pReadr, &pIncr->aFile[0], pIncr->iStartOff
100288 SortSubtask *pTask, /* Task context */
100301 rc = vdbePmaReaderSeek(pTask, pReadr, pFile, iStart);
100321 SortSubtask *pTask, /* Subtask context (for pKeyInfo) */
100326 UnpackedRecord *r2 = pTask->pUnpacked;
100328 sqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2);
100348 SortSubtask *pTask, /* Subtask context (for pKeyInfo) */
100353 UnpackedRecord *r2 = pTask->pUnpacked;
100355 sqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2);
100367 SortSubtask *pTask, /* Subtask context (for pKeyInfo) */
100389 if( pTask->pSorter->pKeyInfo->nKeyField>1 ){
100391 pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2
100395 assert( !(pTask->pSorter->pKeyInfo->aSortFlags[0]&KEYINFO_ORDER_BIGNULL) );
100396 if( pTask->pSorter->pKeyInfo->aSortFlags[0] ){
100409 SortSubtask *pTask, /* Subtask context (for pKeyInfo) */
100459 if( pTask->pSorter->pKeyInfo->nKeyField>1 ){
100461 pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2
100464 }else if( pTask->pSorter->pKeyInfo->aSortFlags[0] ){
100465 assert( !(pTask->pSorter->pKeyInfo->aSortFlags[0]&KEYINFO_ORDER_BIGNULL) );
100552 SortSubtask *pTask = &pSorter->aTask[i];
100553 pTask->pSorter = pSorter;
100610 static void vdbeSortSubtaskCleanup(sqlite3 *db, SortSubtask *pTask){
100611 sqlite3DbFree(db, pTask->pUnpacked);
100615 if( pTask->list.aMemory ){
100616 sqlite3_free(pTask->list.aMemory);
100620 assert( pTask->list.aMemory==0 );
100621 vdbeSorterRecordFree(0, pTask->list.pList);
100623 if( pTask->file.pFd ){
100624 sqlite3OsCloseFree(pTask->file.pFd);
100626 if( pTask->file2.pFd ){
100627 sqlite3OsCloseFree(pTask->file2.pFd);
100629 memset(pTask, 0, sizeof(SortSubtask));
100633 static void vdbeSorterWorkDebug(SortSubtask *pTask, const char *zEvent){
100635 int iTask = (pTask - pTask->pSorter->aTask);
100636 sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t);
100646 SortSubtask *pTask,
100650 int iTask = (pTask - pTask->pSorter->aTask);
100651 sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t);
100655 SortSubtask *pTask,
100661 sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t);
100676 static int vdbeSorterJoinThread(SortSubtask *pTask){
100678 if( pTask->pThread ){
100680 int bDone = pTask->bDone;
100683 vdbeSorterBlockDebug(pTask, !bDone, "enter");
100684 (void)sqlite3ThreadJoin(pTask->pThread, &pRet);
100685 vdbeSorterBlockDebug(pTask, !bDone, "exit");
100687 assert( pTask->bDone==1 );
100688 pTask->bDone = 0;
100689 pTask->pThread = 0;
100698 SortSubtask *pTask, /* Thread will use this task object */
100702 assert( pTask->pThread==0 && pTask->bDone==0 );
100703 return sqlite3ThreadCreate(&pTask->pThread, xTask, pIn);
100722 SortSubtask *pTask = &pSorter->aTask[i];
100723 int rc2 = vdbeSorterJoinThread(pTask);
100730 # define vdbeSorterJoinThread(pTask) SQLITE_OK
100753 pNew->pTask = 0;
100781 vdbeSorterJoinThread(pIncr->pTask);
100808 SortSubtask *pTask = &pSorter->aTask[i];
100809 vdbeSortSubtaskCleanup(db, pTask);
100810 pTask->pSorter = pSorter;
100895 static int vdbeSortAllocUnpacked(SortSubtask *pTask){
100896 if( pTask->pUnpacked==0 ){
100897 pTask->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pTask->pSorter->pKeyInfo);
100898 if( pTask->pUnpacked==0 ) return SQLITE_NOMEM_BKPT;
100899 pTask->pUnpacked->nField = pTask->pSorter->pKeyInfo->nKeyField;
100900 pTask->pUnpacked->errCode = 0;
100910 SortSubtask *pTask, /* Calling thread context */
100921 res = pTask->xCompare(
100922 pTask, &bCached, SRVAL(p1), p1->nVal, SRVAL(p2), p2->nVal
100965 static int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){
100971 rc = vdbeSortAllocUnpacked(pTask);
100975 pTask->xCompare = vdbeSorterGetCompare(pTask->pSorter);
100993 p = vdbeSorterMerge(pTask, p, aSlot[i]);
101003 p = p ? vdbeSorterMerge(pTask, p, aSlot[i]) : aSlot[i];
101007 assert( pTask->pUnpacked->errCode==SQLITE_OK
101008 || pTask->pUnpacked->errCode==SQLITE_NOMEM
101010 return pTask->pUnpacked->errCode;
101111 static int vdbeSorterListToPMA(SortSubtask *pTask, SorterList *pList){
101112 sqlite3 *db = pTask->pSorter->db;
101119 i64 iSz = pList->szPMA + sqlite3VarintLen(pList->szPMA) + pTask->file.iEof;
101122 vdbeSorterWorkDebug(pTask, "enter");
101127 if( pTask->file.pFd==0 ){
101128 rc = vdbeSorterOpenTempFile(db, 0, &pTask->file.pFd);
101129 assert( rc!=SQLITE_OK || pTask->file.pFd );
101130 assert( pTask->file.iEof==0 );
101131 assert( pTask->nPMA==0 );
101136 vdbeSorterExtendFile(db, pTask->file.pFd, pTask->file.iEof+pList->szPMA+9);
101141 rc = vdbeSorterSort(pTask, pList);
101148 vdbePmaWriterInit(pTask->file.pFd, &writer, pTask->pSorter->pgsz,
101149 pTask->file.iEof);
101150 pTask->nPMA++;
101159 rc = vdbePmaWriterFinish(&writer, &pTask->file.iEof);
101162 vdbeSorterWorkDebug(pTask, "exit");
101164 assert( rc!=SQLITE_OK || pTask->file.iEof==iSz );
101181 SortSubtask *pTask = pMerger->pTask;
101206 iRes = pTask->xCompare(pTask, &bCached,
101239 return (rc==SQLITE_OK ? pTask->pUnpacked->errCode : rc);
101247 SortSubtask *pTask = (SortSubtask*)pCtx;
101249 assert( pTask->bDone==0 );
101250 rc = vdbeSorterListToPMA(pTask, &pTask->list);
101251 pTask->bDone = 1;
101267 SortSubtask *pTask = 0; /* Thread context used to create new PMA */
101284 pTask = &pSorter->aTask[iTest];
101285 if( pTask->bDone ){
101286 rc = vdbeSorterJoinThread(pTask);
101288 if( rc!=SQLITE_OK || pTask->pThread==0 ) break;
101300 assert( pTask!=0 );
101301 assert( pTask->pThread==0 && pTask->bDone==0 );
101302 assert( pTask->list.pList==0 );
101303 assert( pTask->list.aMemory==0 || pSorter->list.aMemory!=0 );
101305 aMem = pTask->list.aMemory;
101306 pCtx = (void*)pTask;
101307 pSorter->iPrev = (u8)(pTask - pSorter->aTask);
101308 pTask->list = pSorter->list;
101319 rc = vdbeSorterCreateThread(pTask, vdbeSorterFlushThread, pCtx);
101447 SortSubtask *pTask = pIncr->pTask;
101452 vdbeSorterPopulateDebug(pTask, "enter");
101454 vdbePmaWriterInit(pOut->pFd, &writer, pTask->pSorter->pgsz, iStart);
101469 assert( pIncr->pMerger->pTask==pTask );
101475 vdbeSorterPopulateDebug(pTask, "exit");
101487 pIncr->pTask->bDone = 1;
101497 return vdbeSorterCreateThread(pIncr->pTask, vdbeIncrPopulateThread, p);
101523 rc = vdbeSorterJoinThread(pIncr->pTask);
101558 SortSubtask *pTask, /* The thread that will be using the new IncrMerger */
101567 pIncr->pTask = pTask;
101568 pIncr->mxSz = MAX(pTask->pSorter->mxKeysize+9,pTask->pSorter->mxPmaSize/2);
101569 pTask->file2.iEof += pIncr->mxSz;
101584 pIncr->pTask->file2.iEof -= pIncr->mxSz;
101623 SortSubtask *pTask = pMerger->pTask;
101626 assert( pTask->pUnpacked!=0 ); /* from vdbeSortSubtaskMain() */
101627 res = pTask->xCompare(
101628 pTask, &bCached, p1->aKey, p1->nKey, p2->aKey, p2->nKey
101678 SortSubtask *pTask, /* Thread that will run pMerger */
101694 assert( pMerger->pTask==0 );
101695 pMerger->pTask = pTask;
101717 return pTask->pUnpacked->errCode;
101756 SortSubtask *pTask = pIncr->pTask;
101757 sqlite3 *db = pTask->pSorter->db;
101762 rc = vdbeMergeEngineInit(pTask, pIncr->pMerger, eMode);
101778 if( pTask->file2.pFd==0 ){
101779 assert( pTask->file2.iEof>0 );
101780 rc = vdbeSorterOpenTempFile(db, pTask->file2.iEof, &pTask->file2.pFd);
101781 pTask->file2.iEof = 0;
101784 pIncr->aFile[1].pFd = pTask->file2.pFd;
101785 pIncr->iStartOff = pTask->file2.iEof;
101786 pTask->file2.iEof += mxSz;
101825 pReader->pIncr->pTask->bDone = 1;
101849 rc = vdbeSorterCreateThread(pIncr->pTask, vdbePmaReaderBgIncrInit, pCtx);
101872 SortSubtask *pTask, /* Sorter task to read from */
101888 rc = vdbePmaReaderInit(pTask, &pTask->file, iOff, pReadr, &nDummy);
101929 SortSubtask *pTask, /* Task context */
101941 rc = vdbeIncrMergerNew(pTask, pLeaf, &pIncr);
101956 rc = vdbeIncrMergerNew(pTask, pNew, &pReadr->pIncr);
102004 SortSubtask *pTask = &pSorter->aTask[iTask];
102005 assert( pTask->nPMA>0 || SQLITE_MAX_WORKER_THREADS>0 );
102006 if( SQLITE_MAX_WORKER_THREADS==0 || pTask->nPMA ){
102008 int nDepth = vdbeSorterTreeDepth(pTask->nPMA);
102011 if( pTask->nPMA<=SORTER_MAX_MERGE_COUNT ){
102012 rc = vdbeMergeEngineLevel0(pTask, pTask->nPMA, &iReadOff, &pRoot);
102018 for(i=0; i<pTask->nPMA && rc==SQLITE_OK; i += SORTER_MAX_MERGE_COUNT){
102022 nReader = MIN(pTask->nPMA - i, SORTER_MAX_MERGE_COUNT);
102023 rc = vdbeMergeEngineLevel0(pTask, nReader, &iReadOff, &pMerger);
102025 rc = vdbeSorterAddToTree(pTask, nDepth, iSeq++, pRoot, pMerger);
102033 rc = vdbeIncrMergerNew(pTask, pRoot, &pMain->aReadr[iTask].pIncr);
102098 assert( pIncr->pTask!=pLast );
102113 (p->pIncr->pTask==&pSorter->aTask[iTask]) /* a */
102217 assert( pSorter->pMerger->pTask==(&pSorter->aTask[0]) );