-C Rework\sthe\sway\strees\sof\sMergeEngine\sobjects\sare\sbuilt\sin\svdbesort.c\sto\smake\sit\seasier\sto\sfollow.\sFix\smemory\sleaks\sthat\scould\sfollow\san\sOOM\sor\sIO\serror.\sAdd\svarious\scomments\sto\sexplain\sfunctions\sin\svdbesort.c.
-D 2014-04-16T16:43:05.014
+C Change\sthe\sname\sof\svdbeIncrInit2\sto\svdbePmaReaderIncrInit.\sAdd\sa\sheader\scomment\sto\sthe\ssame\sfunction.
+D 2014-04-16T17:41:22.128
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ad0921c4b2780d01868cf69b419a4f102308d125
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/vdbeaux.c d8dc38965507a34b0e150c0d7fc82b02f8cf25ea
F src/vdbeblob.c 15377abfb59251bccedd5a9c7d014a895f0c04aa
F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447
-F src/vdbesort.c 30505a846dd55e7ff62bccad455d465342487887
+F src/vdbesort.c 70e42f93ebc6c4b08fff55f3f3bc6b25916cfeda
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd
F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 2f94f9ce9bf11f1599bbc640b3fc8c15da588416
-R 826dd10e19d54d131d0af65a48be33dc
+P 69026ec7dc3bd3e33bbe17c221a53cf1dd0f8945
+R ed75157562bc112af42ea8e3070ab11f
U dan
-Z b3fd9ee2f5beb1e7affcfabe59de18f9
+Z ff87db58800fcd075476469fa2fb9f2f
#define INCRINIT2_NORMAL 0
#define INCRINIT2_TASK 1
#define INCRINIT2_ROOT 2
-static int vdbeIncrInit2(PmaReader *pIter, int eMode);
+static int vdbePmaReaderIncrInit(PmaReader *pIter, int eMode);
/*
** Initialize the merger argument passed as the second argument. Once this
** its first key.
**
** Otherwise, if eMode is any value other than INCRINIT2_ROOT, then use
-** vdbeIncrInit2() to initialize each PmaReader that feeds data to pMerger.
+** vdbePmaReaderIncrInit() to initialize each PmaReader that feeds data
+** to pMerger.
**
** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
*/
if( eMode==INCRINIT2_ROOT ){
rc = vdbePmaReaderNext(&pMerger->aIter[i]);
}else{
- rc = vdbeIncrInit2(&pMerger->aIter[i], INCRINIT2_NORMAL);
+ rc = vdbePmaReaderIncrInit(&pMerger->aIter[i], INCRINIT2_NORMAL);
}
}
return rc;
}
-static int vdbeIncrInit2(PmaReader *pIter, int eMode){
+static int vdbePmaReaderIncrInit(PmaReader *pIter, int eMode){
int rc = SQLITE_OK;
IncrMerger *pIncr = pIter->pIncr;
if( pIncr ){
#if SQLITE_MAX_WORKER_THREADS>0
/*
-** The main routine for vdbeIncrInit2() operations run in background threads.
+** The main routine for vdbePmaReaderIncrInit() operations run in
+** background threads.
*/
-static void *vdbeIncrInit2Thread(void *pCtx){
+static void *vdbePmaReaderBgInit(void *pCtx){
PmaReader *pReader = (PmaReader*)pCtx;
- void *pRet = SQLITE_INT_TO_PTR( vdbeIncrInit2(pReader, INCRINIT2_TASK) );
+ void *pRet = SQLITE_INT_TO_PTR(vdbePmaReaderIncrInit(pReader,INCRINIT2_TASK));
pReader->pIncr->pTask->bDone = 1;
return pRet;
}
/*
-** Use a background thread to invoke vdbeIncrInit2(INCRINIT2_TASK) on the
-** the PmaReader object passed as the first argument.
+** Use a background thread to invoke vdbePmaReaderIncrInit(INCRINIT2_TASK)
+** on the the PmaReader object passed as the first argument.
**
** This call will initialize the various fields of the pIter->pIncr
** structure and, if it is a multi-threaded IncrMerger, launch a
** background thread to populate aFile[1].
*/
-static int vdbeIncrBgInit2(PmaReader *pIter){
+static int vdbePmaReaderBgIncrInit(PmaReader *pIter){
void *pCtx = (void*)pIter;
- return vdbeSorterCreateThread(pIter->pIncr->pTask, vdbeIncrInit2Thread, pCtx);
+ return vdbeSorterCreateThread(pIter->pIncr->pTask, vdbePmaReaderBgInit, pCtx);
}
#endif
}
/*
-** Populate iterator *pIter so that it may be used to iterate through all
-** keys stored in all PMAs created by this sorter.
+** This function is called as part of an sqlite3VdbeSorterRewind() operation
+** on a sorter that has written two or more PMAs to temporary files. It sets
+** up either VdbeSorter.pMerger (for single threaded sorters) or pReader
+** (for multi-threaded sorters) so that it can be used to iterate through
+** all records stored in the sorter.
+**
+** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
*/
-static int vdbePmaReaderIncrInit(VdbeSorter *pSorter){
+static int vdbeSorterSetupMerge(VdbeSorter *pSorter){
int rc; /* Return code */
SortSubtask *pTask0 = &pSorter->aTask[0];
MergeEngine *pMain = 0;
for(iTask=0; rc==SQLITE_OK && iTask<pSorter->nTask; iTask++){
PmaReader *p = &pMain->aIter[iTask];
assert( p->pIncr==0 || p->pIncr->pTask==&pSorter->aTask[iTask] );
- if( p->pIncr ){ rc = vdbeIncrBgInit2(p); }
+ if( p->pIncr ){ rc = vdbePmaReaderBgIncrInit(p); }
}
}
}
}
if( rc==SQLITE_OK ){
int eMode = (pSorter->nTask>1 ? INCRINIT2_ROOT : INCRINIT2_NORMAL);
- rc = vdbeIncrInit2(pIter, eMode);
+ rc = vdbePmaReaderIncrInit(pIter, eMode);
}
}else
#endif
** incrementally read and merge all remaining PMAs. */
assert( pSorter->pReader==0 );
if( rc==SQLITE_OK ){
- rc = vdbePmaReaderIncrInit(pSorter);
+ rc = vdbeSorterSetupMerge(pSorter);
*pbEof = 0;
}