Remove an unnecessary parameter from vdbeMergeEngineStep(). Rename a couple
other routines to be more descriptive of what they do. FossilOrigin-Name: f2407a40f339fa6c2cec194f78ae7c93655b1ec1
This commit is contained in:
parent
d906514d98
commit
bde27aaa5a
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Rename\svdbeIncrMergerInit()\sto\svdbeMergeEngineInit()\s-\sa\smuch\smore\saccurate\nname.
|
||||
D 2014-07-28T19:58:41.375
|
||||
C Remove\san\sunnecessary\sparameter\sfrom\svdbeMergeEngineStep().\s\sRename\sa\scouple\nother\sroutines\sto\sbe\smore\sdescriptive\sof\swhat\sthey\sdo.
|
||||
D 2014-07-28T20:16:41.054
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -291,7 +291,7 @@ F src/vdbeapi.c 24e40422382beb774daab11fe9fe9d37e8a04949
|
||||
F src/vdbeaux.c 3f1d2baa4a8cbdad33cb255a5f4fd1af7a414683
|
||||
F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac
|
||||
F src/vdbemem.c d90a1e8acf8b63dc9d14cbbea12bfec6cec31394
|
||||
F src/vdbesort.c 143de4b9da4e42a4270cb615dddfc9e8d5224373
|
||||
F src/vdbesort.c e78efeed9c87d47d7a09df7d176f3fbf6dcb77e2
|
||||
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
|
||||
F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd
|
||||
F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a
|
||||
@ -1189,7 +1189,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 09d50d9f0fe7df26dadb0a332731683a07a89fde
|
||||
R 174b1c88fd5de2d3dafe85889f7f84b2
|
||||
P 5b084a2dd581141b2d0cd9d1a5975625f65ec34d
|
||||
R 73873dcfe41a2b7643bb45186ddcf360
|
||||
U drh
|
||||
Z dbe81e54bc35480cf09bd2aae1bd678b
|
||||
Z 40695df9717fb1b9f124285f8dbce47e
|
||||
|
@ -1 +1 @@
|
||||
5b084a2dd581141b2d0cd9d1a5975625f65ec34d
|
||||
f2407a40f339fa6c2cec194f78ae7c93655b1ec1
|
@ -1407,23 +1407,19 @@ static int vdbeSorterListToPMA(SortSubtask *pTask, SorterList *pList){
|
||||
}
|
||||
|
||||
/*
|
||||
** Advance the MergeEngine pMerge (passed as the second argument) to
|
||||
** its next entry. Set *pbEof to true there is no next entry because
|
||||
** Advance the MergeEngine to its next entry.
|
||||
** Set *pbEof to true there is no next entry because
|
||||
** the MergeEngine has reached the end of all its inputs.
|
||||
**
|
||||
** Return SQLITE_OK if successful or an error code if an error occurs.
|
||||
*/
|
||||
static int vdbeMergeEngineStep(
|
||||
SortSubtask *pTask, /* The thread in which this MergeEngine runs */
|
||||
MergeEngine *pMerger, /* The merge engine to advance to the next row */
|
||||
int *pbEof /* Set TRUE at EOF. Set false for more content */
|
||||
){
|
||||
int rc;
|
||||
int iPrev = pMerger->aTree[1];/* Index of PmaReader to advance */
|
||||
|
||||
/* A MergeEngine object is only used by a single thread */
|
||||
assert( pMerger->pTask==0 || pMerger->pTask==pTask );
|
||||
pMerger->pTask = pTask;
|
||||
SortSubtask *pTask = pMerger->pTask;
|
||||
|
||||
/* Advance the current PmaReader */
|
||||
rc = vdbePmaReaderNext(&pMerger->aReadr[iPrev]);
|
||||
@ -1693,7 +1689,8 @@ static int vdbeIncrPopulate(IncrMerger *pIncr){
|
||||
/* Write the next key to the output. */
|
||||
vdbePmaWriteVarint(&writer, nKey);
|
||||
vdbePmaWriteBlob(&writer, pReader->aKey, nKey);
|
||||
rc = vdbeMergeEngineStep(pTask, pIncr->pMerger, &dummy);
|
||||
assert( pIncr->pMerger->pTask==pTask );
|
||||
rc = vdbeMergeEngineStep(pIncr->pMerger, &dummy);
|
||||
}
|
||||
|
||||
rc2 = vdbePmaWriterFinish(&writer, &pOut->iEof);
|
||||
@ -1780,7 +1777,7 @@ static int vdbeIncrSwap(IncrMerger *pIncr){
|
||||
** If an OOM condition is encountered, return NULL. In this case free the
|
||||
** pMerger argument before returning.
|
||||
*/
|
||||
static int vdbeIncrNew(
|
||||
static int vdbeIncrMergerNew(
|
||||
SortSubtask *pTask, /* The thread that will be using the new IncrMerger */
|
||||
MergeEngine *pMerger, /* The MergeEngine that the IncrMerger will control */
|
||||
IncrMerger **ppOut /* Write the new IncrMerger here */
|
||||
@ -1804,7 +1801,7 @@ static int vdbeIncrNew(
|
||||
/*
|
||||
** Set the "use-threads" flag on object pIncr.
|
||||
*/
|
||||
static void vdbeIncrSetThreads(IncrMerger *pIncr){
|
||||
static void vdbeIncrMergerSetThreads(IncrMerger *pIncr){
|
||||
pIncr->bUseThread = 1;
|
||||
pIncr->pTask->file2.iEof -= pIncr->mxSz;
|
||||
}
|
||||
@ -1902,7 +1899,7 @@ static int vdbeMergeEngineInit(
|
||||
int nTree = pMerger->nTree;
|
||||
|
||||
/* Verify that the MergeEngine is assigned to a single thread */
|
||||
assert( pMerger->pTask==0 || pMerger->pTask==pTask );
|
||||
assert( pMerger->pTask==0 ); // || pMerger->pTask==pTask );
|
||||
pMerger->pTask = pTask;
|
||||
|
||||
for(i=0; i<nTree; i++){
|
||||
@ -2125,7 +2122,7 @@ static int vdbeSorterAddToTree(
|
||||
MergeEngine *p = pRoot;
|
||||
IncrMerger *pIncr;
|
||||
|
||||
rc = vdbeIncrNew(pTask, pLeaf, &pIncr);
|
||||
rc = vdbeIncrMergerNew(pTask, pLeaf, &pIncr);
|
||||
|
||||
for(i=1; i<nDepth; i++){
|
||||
nDiv = nDiv * SORTER_MAX_MERGE_COUNT;
|
||||
@ -2140,7 +2137,7 @@ static int vdbeSorterAddToTree(
|
||||
if( pNew==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = vdbeIncrNew(pTask, pNew, &pReadr->pIncr);
|
||||
rc = vdbeIncrMergerNew(pTask, pNew, &pReadr->pIncr);
|
||||
}
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
@ -2216,7 +2213,7 @@ static int vdbeSorterMergeTreeBuild(
|
||||
if( rc==SQLITE_OK ){
|
||||
#if SQLITE_MAX_WORKER_THREADS>0
|
||||
if( pMain!=0 ){
|
||||
rc = vdbeIncrNew(pTask, pRoot, &pMain->aReadr[iTask].pIncr);
|
||||
rc = vdbeIncrMergerNew(pTask, pRoot, &pMain->aReadr[iTask].pIncr);
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
@ -2269,13 +2266,13 @@ static int vdbeSorterSetupMerge(VdbeSorter *pSorter){
|
||||
if( pReadr==0 ) rc = SQLITE_NOMEM;
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = vdbeIncrNew(pLast, pMain, &pReadr->pIncr);
|
||||
rc = vdbeIncrMergerNew(pLast, pMain, &pReadr->pIncr);
|
||||
if( rc==SQLITE_OK ){
|
||||
vdbeIncrSetThreads(pReadr->pIncr);
|
||||
vdbeIncrMergerSetThreads(pReadr->pIncr);
|
||||
for(iTask=0; iTask<(pSorter->nTask-1); iTask++){
|
||||
IncrMerger *pIncr;
|
||||
if( (pIncr = pMain->aReadr[iTask].pIncr) ){
|
||||
vdbeIncrSetThreads(pIncr);
|
||||
vdbeIncrMergerSetThreads(pIncr);
|
||||
assert( pIncr->pTask!=pLast );
|
||||
}
|
||||
}
|
||||
@ -2379,7 +2376,8 @@ int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr, int *pbEof){
|
||||
}else
|
||||
#endif
|
||||
/*if( !pSorter->bUseThreads )*/ {
|
||||
rc = vdbeMergeEngineStep(&pSorter->aTask[0], pSorter->pMerger, pbEof);
|
||||
assert( pSorter->pMerger->pTask==(&pSorter->aTask[0]) );
|
||||
rc = vdbeMergeEngineStep(pSorter->pMerger, pbEof);
|
||||
}
|
||||
}else{
|
||||
SorterRecord *pFree = pSorter->list.pList;
|
||||
|
Loading…
Reference in New Issue
Block a user