ExternalSortRunLoader Class Reference

ExternalSortRunLoader manages the state of a run as it is being loaded and sorted in memory. More...

#include <ExternalSortRunLoader.h>

Inheritance diagram for ExternalSortRunLoader:

ExternalSortSubStream List of all members.

Public Member Functions

 ExternalSortRunLoader (ExternalSortInfo &info)
virtual ~ExternalSortRunLoader ()
void startRun ()
 Prepares this loader to begin a new run.
bool isStarted ()
 
Returns:
whether this loader has been started and not yet fetched

ExternalSortRC loadRun (ExecStreamBufAccessor &bufAccessor)
 Loads data from buffer into a run.
void sort ()
 Sorts loaded run.
uint getLoadedTupleCount ()
 
Returns:
number of tuples loaded so far in current run

void releaseResources ()
 Releases any resources acquired by this loader.
virtual ExternalSortFetchArraybindFetchArray ()
 Binds the fetch array which will be used implicitly by subsequent calls to fetch().
virtual ExternalSortRC fetch (uint nTuplesRequested)
 Fetches tuples via the previously bound fetch array.

Public Attributes

bool runningParallelTask
 Flag used only during parallel sort.

Private Member Functions

PBuffer allocateBuffer ()
 Allocates one page buffer.
bool allocateDataBuffer ()
 Allocates one data buffer.
bool allocateIndexBuffer ()
 Allocates one index buffer.
PBuffergetPointerArrayEntry (uint iTuple)
 Dereferences a pointer array entry during quicksort.
void quickSortSwap (uint l, uint r)
uint quickSortPartition (uint i, uint j, PBuffer pivot)
PBuffer quickSortFindPivot (uint l, uint r)
void quickSort (uint l, uint r)

Private Attributes

ExternalSortInfosortInfo
 Global information.
SegPageLock bufferLock
 Cache page lock used to allocate pages of scratch memory.
uint nMemPagesMax
 Maximum number of memory pages which can be allocated by this loader.
std::vector< PBufferfreeBuffers
 Array of allocated page buffers which have been recycled but not yet reused.
std::vector< PBufferindexBuffers
 Array of page buffers which have been allocated as index buffers.
std::vector< PBufferdataBuffers
 Array of page buffers which have been allocated as data buffers.
uint indexToPageShift
 Precomputed bit rightshift count for converting a tuple index to a page number (0-based position within indexBuffers array).
uint indexPageMask
 Precomputed bitmask for converting a tuple index to a 0-based position in pointer array on containing index page.
PBuffer pDataBuffer
 Pointer to first free byte in current data buffer.
PBuffer pDataBufferEnd
 Pointer to end of current data buffer.
PBuffer pIndexBuffer
 Pointer to first free byte in current index buffer.
PBuffer pIndexBufferEnd
 Pointer to end of current index buffer.
uint nTuplesLoaded
 Number of tuples loaded so far.
uint nTuplesFetched
 Number of tuples fetched so far.
ExternalSortFetchArray fetchArray
 Array used to return fetch results.
TupleAccessor tupleAccessor
TupleAccessor tupleAccessor2
TupleProjectionAccessor keyAccessor
TupleProjectionAccessor keyAccessor2
TupleData keyData
TupleData keyData2

Detailed Description

ExternalSortRunLoader manages the state of a run as it is being loaded and sorted in memory.

As unsorted tuple data is loaded, it is saved in discontiguous memory pages (called data buffers). In addition, byte pointers to the loaded tuple images are recorded in separately allocated memory pages (called index buffers, and also discontiguous). When the loader's memory page quota is exhausted, the run is considered full. Before a run is stored or returned, it is sorted in memory using quicksort. The quicksort operates on the index buffers (moving pointers only, not data). Each pointer array access during the quicksort requires an indirection computation (first find the right page, and then find the tuple on that page).

Definition at line 52 of file ExternalSortRunLoader.h.


Constructor & Destructor Documentation

ExternalSortRunLoader::ExternalSortRunLoader ( ExternalSortInfo info  )  [explicit]

Definition at line 31 of file ExternalSortRunLoader.cpp.

References SegPageLock::accessSegment(), TupleProjectionAccessor::bind(), bufferLock, ExternalSortInfo::cbPage, TupleData::compute(), TupleAccessor::compute(), indexPageMask, indexToPageShift, keyAccessor, keyAccessor2, keyData, keyData2, ExternalSortInfo::keyDesc, ExternalSortInfo::keyProj, ExternalSortInfo::memSegmentAccessor, nMemPagesMax, nTuplesFetched, nTuplesLoaded, pDataBuffer, pIndexBuffer, runningParallelTask, sortInfo, tupleAccessor, tupleAccessor2, and ExternalSortInfo::tupleDesc.

00032     : sortInfo(sortInfoIn)
00033 {
00034     nMemPagesMax = 0;
00035     pDataBuffer = NULL;
00036     pIndexBuffer = NULL;
00037 
00038     nTuplesLoaded = nTuplesFetched = 0;
00039 
00040     runningParallelTask = false;
00041 
00042     bufferLock.accessSegment(sortInfo.memSegmentAccessor);
00043 
00044     tupleAccessor.compute(sortInfo.tupleDesc);
00045     tupleAccessor2.compute(sortInfo.tupleDesc);
00046 
00047     keyData.compute(sortInfo.keyDesc);
00048     keyData2 = keyData;
00049 
00050     keyAccessor.bind(tupleAccessor,sortInfo.keyProj);
00051     keyAccessor2.bind(tupleAccessor2,sortInfo.keyProj);
00052 
00053     // TODO:  utility methods for calculations below, and assert block
00054     // size is power of 2
00055     uint nKeysPerPage = sortInfo.cbPage / sizeof(PBuffer);
00056     assert(nKeysPerPage > 1);
00057     nKeysPerPage >>= 1;
00058     indexToPageShift = 1;
00059     indexPageMask = 1;
00060     while ((nKeysPerPage & indexPageMask) == 0) {
00061         ++indexToPageShift;
00062         indexPageMask <<= 1;
00063         ++indexPageMask;
00064     }
00065 }

ExternalSortRunLoader::~ExternalSortRunLoader (  )  [virtual]

Definition at line 67 of file ExternalSortRunLoader.cpp.

References releaseResources().

00068 {
00069     releaseResources();
00070 }


Member Function Documentation

PBuffer ExternalSortRunLoader::allocateBuffer (  )  [private]

Allocates one page buffer.

Returns:
the allocated buffer, or NULL if quota has been reached

Definition at line 110 of file ExternalSortRunLoader.cpp.

References SegPageLock::allocatePage(), bufferLock, dataBuffers, freeBuffers, SegPageLock::getPage(), CachePage::getWritableData(), indexBuffers, nMemPagesMax, and SegPageLock::unlock().

Referenced by allocateDataBuffer(), and allocateIndexBuffer().

00111 {
00112     PBuffer pBuffer;
00113 
00114     if (!freeBuffers.empty()) {
00115         pBuffer = freeBuffers.back();
00116         freeBuffers.pop_back();
00117         return pBuffer;
00118     }
00119 
00120     if ((indexBuffers.size() + dataBuffers.size()) >= nMemPagesMax) {
00121         return NULL;
00122     }
00123 
00124     bufferLock.allocatePage();
00125     pBuffer = bufferLock.getPage().getWritableData();
00126 
00127     // REVIEW jvs 12-June-2004:  we rely on the fact that the underlying
00128     // ScratchSegment keeps the page pinned for us; need to make this
00129     // official.
00130     bufferLock.unlock();
00131 
00132     return pBuffer;
00133 }

bool ExternalSortRunLoader::allocateDataBuffer (  )  [private]

Allocates one data buffer.

Returns:
whether the buffer was allocated successfully

Definition at line 135 of file ExternalSortRunLoader.cpp.

References allocateBuffer(), ExternalSortInfo::cbPage, dataBuffers, pDataBuffer, pDataBufferEnd, and sortInfo.

Referenced by loadRun(), and startRun().

00136 {
00137     pDataBuffer = allocateBuffer();
00138     if (pDataBuffer) {
00139         dataBuffers.push_back(pDataBuffer);
00140         pDataBufferEnd = pDataBuffer + sortInfo.cbPage;
00141         return true;
00142     } else {
00143         return false;
00144     }
00145 }

bool ExternalSortRunLoader::allocateIndexBuffer (  )  [private]

Allocates one index buffer.

Returns:
whether the buffer was allocated successfully

Definition at line 147 of file ExternalSortRunLoader.cpp.

References allocateBuffer(), ExternalSortInfo::cbPage, indexBuffers, pIndexBuffer, pIndexBufferEnd, and sortInfo.

Referenced by loadRun(), and startRun().

00148 {
00149     pIndexBuffer = allocateBuffer();
00150     if (pIndexBuffer) {
00151         indexBuffers.push_back(pIndexBuffer);
00152         pIndexBufferEnd = pIndexBuffer + sortInfo.cbPage;
00153         return true;
00154     } else {
00155         return false;
00156     }
00157 }

PBuffer & ExternalSortRunLoader::getPointerArrayEntry ( uint  iTuple  )  [inline, private]

Dereferences a pointer array entry during quicksort.

Parameters:
iTuple 0-based index of tuple pointer to access
Returns:
read/write reference to pointer to tuple

Definition at line 72 of file ExternalSortRunLoader.cpp.

References indexBuffers, indexPageMask, and indexToPageShift.

Referenced by fetch(), quickSortFindPivot(), quickSortPartition(), and quickSortSwap().

00073 {
00074     // REVIEW jvs 12-June-2004:  This is the price we pay for not using a big
00075     // linear array.  Is it too expensive?
00076     uint iPage = iTuple >> indexToPageShift;
00077     uint iSubKey = iTuple & indexPageMask;
00078     PBuffer *pPage = reinterpret_cast<PBuffer *>(indexBuffers[iPage]);
00079     return pPage[iSubKey];
00080 }

void ExternalSortRunLoader::quickSortSwap ( uint  l,
uint  r 
) [inline, private]

Definition at line 260 of file ExternalSortRunLoader.cpp.

References getPointerArrayEntry().

Referenced by quickSortPartition().

00261 {
00262     std::swap(getPointerArrayEntry(l),getPointerArrayEntry(r));
00263 }

uint ExternalSortRunLoader::quickSortPartition ( uint  i,
uint  j,
PBuffer  pivot 
) [private]

Definition at line 303 of file ExternalSortRunLoader.cpp.

References ExternalSortInfo::compareKeys(), getPointerArrayEntry(), keyAccessor, keyAccessor2, keyData, keyData2, quickSortSwap(), TupleAccessor::setCurrentTupleBuf(), sortInfo, tupleAccessor, tupleAccessor2, and TupleProjectionAccessor::unmarshal().

Referenced by quickSort().

00304 {
00305     l--;
00306     r++;
00307 
00308     tupleAccessor.setCurrentTupleBuf(pivot);
00309     keyAccessor.unmarshal(keyData);
00310     for (;;) {
00311         for (;;) {
00312             ++l;
00313             tupleAccessor2.setCurrentTupleBuf(getPointerArrayEntry(l));
00314             keyAccessor2.unmarshal(keyData2);
00315             if (sortInfo.compareKeys(keyData2,keyData) >= 0) {
00316                 break;
00317             }
00318         }
00319         for (;;) {
00320             --r;
00321             tupleAccessor2.setCurrentTupleBuf(getPointerArrayEntry(r));
00322             keyAccessor2.unmarshal(keyData2);
00323             if (sortInfo.compareKeys(keyData2,keyData) <= 0) {
00324                 break;
00325             }
00326         }
00327         if (l < r) {
00328             quickSortSwap(l, r);
00329         } else {
00330             return l;
00331         }
00332     }
00333 }

PBuffer ExternalSortRunLoader::quickSortFindPivot ( uint  l,
uint  r 
) [private]

Definition at line 268 of file ExternalSortRunLoader.cpp.

References ExternalSortInfo::compareKeys(), getPointerArrayEntry(), keyAccessor, keyAccessor2, keyData, keyData2, TupleAccessor::setCurrentTupleBuf(), sortInfo, step_factor, tupleAccessor, tupleAccessor2, and TupleProjectionAccessor::unmarshal().

Referenced by quickSort().

00269 {
00270     uint i, j, cnt, step;
00271     PBuffer vals[step_factor];
00272 
00273     if (r <= l) {
00274         return NULL;
00275     }
00276 
00277     cnt = 0;
00278     step = ((r - l) / step_factor) + 1;
00279     for (i = l; i <= r; i += step) {
00280         vals[cnt] = getPointerArrayEntry(i);
00281         j = cnt++;
00282         while (j > 0) {
00283             tupleAccessor.setCurrentTupleBuf(vals[j]);
00284             tupleAccessor2.setCurrentTupleBuf(vals[j - 1]);
00285             keyAccessor.unmarshal(keyData);
00286             keyAccessor2.unmarshal(keyData2);
00287             if (sortInfo.compareKeys(keyData,keyData2) >= 0) {
00288                 break;
00289             }
00290             std::swap(vals[j],vals[j - 1]);
00291             j--;
00292         }
00293     }
00294     if (step == 1) {
00295         for (i = 0; i < cnt; ++i) {
00296             getPointerArrayEntry(l + i) = vals[i];
00297         }
00298         return NULL;
00299     }
00300     return vals[(cnt >> 1)];
00301 }

void ExternalSortRunLoader::quickSort ( uint  l,
uint  r 
) [private]

Definition at line 335 of file ExternalSortRunLoader.cpp.

References quickSortFindPivot(), and quickSortPartition().

Referenced by sort().

00336 {
00337     PBuffer pPivotTuple;
00338     uint x;
00339 
00340     pPivotTuple = quickSortFindPivot(l,r);
00341     if (pPivotTuple) {
00342         x = quickSortPartition(l,r,pPivotTuple);
00343         if (x == l) {
00344             // pPivotTuple was lowest value in partition and was at position l
00345             // - move off of it and keep going
00346             x++;
00347         }
00348         quickSort(l,x - 1);
00349         quickSort(x,r);
00350     }
00351 }

void ExternalSortRunLoader::startRun (  ) 

Prepares this loader to begin a new run.

Definition at line 82 of file ExternalSortRunLoader.cpp.

References allocateDataBuffer(), allocateIndexBuffer(), dataBuffers, fetchArray, freeBuffers, indexBuffers, nMemPagesMax, ExternalSortInfo::nSortMemPagesPerRun, ExternalSortFetchArray::nTuples, nTuplesFetched, nTuplesLoaded, pDataBuffer, pIndexBuffer, and sortInfo.

Referenced by ExternalSortExecStreamImpl::computeFirstResult(), and ExternalSortExecStreamImpl::computeFirstResultParallel().

00083 {
00084     if (!nMemPagesMax) {
00085         nMemPagesMax = sortInfo.nSortMemPagesPerRun;
00086     }
00087 
00088     freeBuffers.insert(
00089         freeBuffers.end(),indexBuffers.begin(),indexBuffers.end());
00090     freeBuffers.insert(
00091         freeBuffers.end(),dataBuffers.begin(),dataBuffers.end());
00092     indexBuffers.clear();
00093     dataBuffers.clear();
00094     pDataBuffer = NULL;
00095     pIndexBuffer = NULL;
00096 
00097     if (!allocateDataBuffer()) {
00098         permAssert(false);
00099     }
00100 
00101     if (!allocateIndexBuffer()) {
00102         permAssert(false);
00103     }
00104 
00105     nTuplesLoaded = nTuplesFetched = 0;
00106 
00107     fetchArray.nTuples = 0;
00108 }

bool ExternalSortRunLoader::isStarted (  ) 

Returns:
whether this loader has been started and not yet fetched

Definition at line 358 of file ExternalSortRunLoader.cpp.

References nTuplesFetched, and nTuplesLoaded.

Referenced by ExternalSortExecStreamImpl::computeFirstResult(), and ExternalSortExecStreamImpl::execute().

00359 {
00360     return nTuplesLoaded > nTuplesFetched;
00361 }

ExternalSortRC ExternalSortRunLoader::loadRun ( ExecStreamBufAccessor bufAccessor  ) 

Loads data from buffer into a run.

Parameters:
bufAccessor buffer from which to read run
Returns:
result of load

Definition at line 173 of file ExternalSortRunLoader.cpp.

References allocateDataBuffer(), allocateIndexBuffer(), ExecStreamBufAccessor::consumeData(), ExecStreamBufAccessor::demandData(), EXTSORT_OVERFLOW, EXTSORT_SUCCESS, TupleAccessor::getBufferByteCount(), ExecStreamBufAccessor::getConsumptionAvailable(), ExecStreamBufAccessor::getConsumptionStart(), TupleAccessor::getMaxByteCount(), nTuplesLoaded, pDataBuffer, pDataBufferEnd, pIndexBuffer, pIndexBufferEnd, and tupleAccessor.

Referenced by ExternalSortExecStreamImpl::computeFirstResult().

00175 {
00176     for (;;) {
00177         if (!bufAccessor.demandData()) {
00178             break;
00179         }
00180         uint cbAvailable = bufAccessor.getConsumptionAvailable();
00181         assert(cbAvailable);
00182         PConstBuffer pSrc = bufAccessor.getConsumptionStart();
00183         bool overflow = false;
00184         uint cbCopy = 0;
00185         while (cbCopy < cbAvailable) {
00186             PConstBuffer pSrcTuple = pSrc + cbCopy;
00187             uint cbTuple = tupleAccessor.getBufferByteCount(pSrcTuple);
00188             assert(cbTuple);
00189             assert(cbTuple <= tupleAccessor.getMaxByteCount());
00190 
00191             // first make sure we have room for the key pointer
00192             if (pIndexBuffer >= pIndexBufferEnd) {
00193                 if (!allocateIndexBuffer()) {
00194                     overflow = true;
00195                     break;
00196                 }
00197             }
00198 
00199             // now make sure we have enough room for the data
00200             if (pDataBuffer + cbCopy + cbTuple > pDataBufferEnd) {
00201                 if (!cbCopy) {
00202                     // first tuple:  try to allocate a new buffer
00203                     if (!allocateDataBuffer()) {
00204                         // since cbCopy is zero, we can return right now
00205                         return EXTSORT_OVERFLOW;
00206                     }
00207                 }
00208                 // copy whatever we've calculated so far;
00209                 // next time through the for loop, we'll allocate a fresh buffer
00210                 break;
00211             }
00212 
00213             *((PBuffer *) pIndexBuffer) = pDataBuffer + cbCopy;
00214             pIndexBuffer += sizeof(PBuffer);
00215             nTuplesLoaded++;
00216             cbCopy += cbTuple;
00217         }
00218         if (cbCopy) {
00219             memcpy(pDataBuffer,pSrc,cbCopy);
00220             pDataBuffer += cbCopy;
00221             bufAccessor.consumeData(pSrc + cbCopy);
00222         }
00223         if (overflow) {
00224             return EXTSORT_OVERFLOW;
00225         }
00226     }
00227 
00228     assert(nTuplesLoaded);
00229     return EXTSORT_SUCCESS;
00230 }

void ExternalSortRunLoader::sort (  ) 

Sorts loaded run.

Definition at line 232 of file ExternalSortRunLoader.cpp.

References nTuplesLoaded, and quickSort().

Referenced by ExternalSortExecStreamImpl::sortRun().

00233 {
00234     assert (nTuplesLoaded);
00235 
00236     quickSort(0,nTuplesLoaded - 1);
00237 }

uint ExternalSortRunLoader::getLoadedTupleCount (  ) 

Returns:
number of tuples loaded so far in current run

Definition at line 353 of file ExternalSortRunLoader.cpp.

References nTuplesLoaded.

Referenced by ExternalSortExecStreamImpl::sortRun().

00354 {
00355     return nTuplesLoaded;
00356 }

void ExternalSortRunLoader::releaseResources (  ) 

Releases any resources acquired by this loader.

Definition at line 159 of file ExternalSortRunLoader.cpp.

References dataBuffers, freeBuffers, indexBuffers, ExternalSortInfo::memSegmentAccessor, nMemPagesMax, NULL_PAGE_ID, SegmentAccessor::pSegment, and sortInfo.

Referenced by ~ExternalSortRunLoader().

00160 {
00161     freeBuffers.clear();
00162     indexBuffers.clear();
00163     dataBuffers.clear();
00164     nMemPagesMax = 0;
00165 
00166     // REVIEW jvs 12-June-2004:  see corresponding comment above in
00167     // allocateBuffer()
00168 
00169     sortInfo.memSegmentAccessor.pSegment->deallocatePageRange(
00170         NULL_PAGE_ID,NULL_PAGE_ID);
00171 }

ExternalSortFetchArray & ExternalSortRunLoader::bindFetchArray (  )  [virtual]

Binds the fetch array which will be used implicitly by subsequent calls to fetch().

Returns:
bound fetch array

Implements ExternalSortSubStream.

Definition at line 239 of file ExternalSortRunLoader.cpp.

References fetchArray.

00240 {
00241     return fetchArray;
00242 }

ExternalSortRC ExternalSortRunLoader::fetch ( uint  nTuplesRequested  )  [virtual]

Fetches tuples via the previously bound fetch array.

Parameters:
nTuplesRequested maximum number of tuples to be returned from fetch (actual count may be less at callee's discretion; this does not indicate end of stream)
Returns:
result of fetch (either EXTSORT_ENDOFDATA or EXTSORT_SUCCESS)

Implements ExternalSortSubStream.

Definition at line 244 of file ExternalSortRunLoader.cpp.

References EXTSORT_ENDOFDATA, EXTSORT_SUCCESS, fetchArray, getPointerArrayEntry(), indexPageMask, min(), ExternalSortFetchArray::nTuples, nTuplesFetched, nTuplesLoaded, and ExternalSortFetchArray::ppTupleBuffers.

00245 {
00246     if (nTuplesFetched >= nTuplesLoaded) {
00247         return EXTSORT_ENDOFDATA;
00248     }
00249 
00250     fetchArray.ppTupleBuffers = (PBuffer *)
00251         &(getPointerArrayEntry(nTuplesFetched));
00252     uint pageEnd = (nTuplesFetched | indexPageMask) + 1;
00253     pageEnd = std::min(pageEnd,nTuplesLoaded);
00254     fetchArray.nTuples = std::min(nTuplesRequested,pageEnd - nTuplesFetched);
00255     nTuplesFetched += fetchArray.nTuples;
00256 
00257     return EXTSORT_SUCCESS;
00258 }


Member Data Documentation

ExternalSortInfo& ExternalSortRunLoader::sortInfo [private]

Global information.

Definition at line 58 of file ExternalSortRunLoader.h.

Referenced by allocateDataBuffer(), allocateIndexBuffer(), ExternalSortRunLoader(), quickSortFindPivot(), quickSortPartition(), releaseResources(), and startRun().

SegPageLock ExternalSortRunLoader::bufferLock [private]

Cache page lock used to allocate pages of scratch memory.

Definition at line 63 of file ExternalSortRunLoader.h.

Referenced by allocateBuffer(), and ExternalSortRunLoader().

uint ExternalSortRunLoader::nMemPagesMax [private]

Maximum number of memory pages which can be allocated by this loader.

Definition at line 68 of file ExternalSortRunLoader.h.

Referenced by allocateBuffer(), ExternalSortRunLoader(), releaseResources(), and startRun().

std::vector<PBuffer> ExternalSortRunLoader::freeBuffers [private]

Array of allocated page buffers which have been recycled but not yet reused.

Definition at line 74 of file ExternalSortRunLoader.h.

Referenced by allocateBuffer(), releaseResources(), and startRun().

std::vector<PBuffer> ExternalSortRunLoader::indexBuffers [private]

Array of page buffers which have been allocated as index buffers.

These contain arrays of pointers to tuple data stored in separate data buffers. Order is significant, since an index entry is decomposed into a page and a position on that page.

Definition at line 82 of file ExternalSortRunLoader.h.

Referenced by allocateBuffer(), allocateIndexBuffer(), getPointerArrayEntry(), releaseResources(), and startRun().

std::vector<PBuffer> ExternalSortRunLoader::dataBuffers [private]

Array of page buffers which have been allocated as data buffers.

These store marshalled tuple data. Order is not significant.

Definition at line 88 of file ExternalSortRunLoader.h.

Referenced by allocateBuffer(), allocateDataBuffer(), releaseResources(), and startRun().

uint ExternalSortRunLoader::indexToPageShift [private]

Precomputed bit rightshift count for converting a tuple index to a page number (0-based position within indexBuffers array).

Definition at line 94 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), and getPointerArrayEntry().

uint ExternalSortRunLoader::indexPageMask [private]

Precomputed bitmask for converting a tuple index to a 0-based position in pointer array on containing index page.

Definition at line 100 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), fetch(), and getPointerArrayEntry().

PBuffer ExternalSortRunLoader::pDataBuffer [private]

Pointer to first free byte in current data buffer.

Definition at line 105 of file ExternalSortRunLoader.h.

Referenced by allocateDataBuffer(), ExternalSortRunLoader(), loadRun(), and startRun().

PBuffer ExternalSortRunLoader::pDataBufferEnd [private]

Pointer to end of current data buffer.

Definition at line 110 of file ExternalSortRunLoader.h.

Referenced by allocateDataBuffer(), and loadRun().

PBuffer ExternalSortRunLoader::pIndexBuffer [private]

Pointer to first free byte in current index buffer.

Definition at line 115 of file ExternalSortRunLoader.h.

Referenced by allocateIndexBuffer(), ExternalSortRunLoader(), loadRun(), and startRun().

PBuffer ExternalSortRunLoader::pIndexBufferEnd [private]

Pointer to end of current index buffer.

Definition at line 120 of file ExternalSortRunLoader.h.

Referenced by allocateIndexBuffer(), and loadRun().

uint ExternalSortRunLoader::nTuplesLoaded [private]

Number of tuples loaded so far.

Definition at line 125 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), fetch(), getLoadedTupleCount(), isStarted(), loadRun(), sort(), and startRun().

uint ExternalSortRunLoader::nTuplesFetched [private]

Number of tuples fetched so far.

Definition at line 130 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), fetch(), isStarted(), and startRun().

ExternalSortFetchArray ExternalSortRunLoader::fetchArray [private]

Array used to return fetch results.

This gets bound to successive index buffer contents during fetch.

Definition at line 136 of file ExternalSortRunLoader.h.

Referenced by bindFetchArray(), fetch(), and startRun().

TupleAccessor ExternalSortRunLoader::tupleAccessor [private]

Definition at line 139 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), loadRun(), quickSortFindPivot(), and quickSortPartition().

TupleAccessor ExternalSortRunLoader::tupleAccessor2 [private]

Definition at line 140 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), quickSortFindPivot(), and quickSortPartition().

TupleProjectionAccessor ExternalSortRunLoader::keyAccessor [private]

Definition at line 141 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), quickSortFindPivot(), and quickSortPartition().

TupleProjectionAccessor ExternalSortRunLoader::keyAccessor2 [private]

Definition at line 142 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), quickSortFindPivot(), and quickSortPartition().

TupleData ExternalSortRunLoader::keyData [private]

Definition at line 143 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), quickSortFindPivot(), and quickSortPartition().

TupleData ExternalSortRunLoader::keyData2 [private]

Definition at line 144 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), quickSortFindPivot(), and quickSortPartition().

bool ExternalSortRunLoader::runningParallelTask

Flag used only during parallel sort.

When set, this loader has been allocated to a particular thread. When clear, this loader is available for use by the next thread that needs one. Access to this flag is synchronized in ExternalSortStreamImpl.

Definition at line 192 of file ExternalSortRunLoader.h.

Referenced by ExternalSortRunLoader(), and ExternalSortExecStreamImpl::unreserveRunLoader().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:32 2009 for Fennel by  doxygen 1.5.1