LbmSearchTest Class Reference

Testcase for scanning a single bitmap index using equality search on all index keys. More...

Inheritance diagram for LbmSearchTest:

LbmExecStreamTestBase ExecStreamUnitTestBase ExecStreamTestBase SegStorageTestBase CacheTestBase TestBase TraceTarget List of all members.

Public Member Functions

 LbmSearchTest ()
void testCaseSetUp ()
 Equivalent to JUnit TestCase.setUp; this is called before each test case method is invoked.
void testCaseTearDown ()
 Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked.
void testScans (uint nRows)
void testScanOneLevel ()
void testScanTwoLevel ()
void testMultipleRanges ()
virtual void openStorage (DeviceMode openMode)
virtual void openSegmentStorage (DeviceMode openMode)
virtual void openRandomSegment ()
SharedSegment createLinearDeviceSegment (DeviceId deviceId, uint nPages)
void closeLinearSegment ()
void closeRandomSegment ()
void closeVersionedRandomSegment ()
void closeSnapshotRandomSegment ()
virtual void closeStorage ()
CachegetCache ()
virtual SharedCache newCache ()
SharedRandomAccessDevice openDevice (std::string devName, DeviceMode openMode, uint nDevicePages, DeviceId deviceId)
void closeDevice (DeviceId deviceId, SharedRandomAccessDevice &pDevice)
TestSuitereleaseTestSuite ()
void beforeTestCase (std::string testCaseName)
void afterTestCase (std::string testCaseName)
virtual void notifyTrace (std::string source, TraceLevel level, std::string message)
 Receives notification when a trace event occurs.
virtual TraceLevel getSourceTraceLevel (std::string source)
 Gets the level at which a particular source should be traced.

Static Public Member Functions

static uint getTupleInterval (std::vector< int > const &repeatSeqValues, uint nKeys=0)
 Find the interval for which an entire tuple's sequence repeats.
static void readParams (int argc, char **argv)
 Parses the command line.

Static Public Attributes

static ParamName paramTestSuiteName
static ParamName paramTraceFileName
static ParamName paramDictionaryFileName
static ParamName paramTraceLevel
static ParamName paramStatsFileName
static ParamName paramTraceStdout
static ParamName paramDegreeOfParallelism
static ConfigMap configMap
 Configuration parameters.

Protected Types

enum  VictimPolicy { victimTwoQ, victimLRU, victimRandom }
 The available victim policy implementations. More...

Protected Member Functions

void initBTreeExecStreamParam (BTreeExecStreamParams &param, shared_ptr< BTreeDescriptor > pBTreeDesc)
 Initializes a BTreeExecStreamParam structure.
void initBTreeParam (BTreeParams &param, shared_ptr< BTreeDescriptor > pBTreeDesc)
 Initializes BTreeParams structure.
void initClusterScanDef (LcsRowScanBaseExecStreamParams &generatorParams, struct LcsClusterScanDef &clusterScanDef, uint bTreeIndex)
 Initializes a cluster scan def structure for a LcsRowScanBase exec stream.
void initBTreeBitmapDesc (TupleDescriptor &tupleDesc, TupleProjection &keyProj, uint nKeys)
 Initializes BTreeExecStreamParam corresponding to a bitmap index.
void initBTreeTupleDesc (TupleDescriptor &tupleDesc, uint nKeys)
 Initializes a tuple descriptor corresponding to a bitmap index.
void loadTableAndIndex (uint nRows, uint nClusters, std::vector< int > const &repeatSeqValues, bool newRoot)
 Loads a table with nClusters clusters, 1 column per cluster, and nRows rows.
void testScanFullKey (uint nRows, uint nKeys, std::vector< int > const &repeatSeqValues, bool useDynamicKeys, bool includeRid)
 Tests equality scan on the table created in loadTableAndIndex, using the entire index key (minus the rid).
void testScanPartialKey (uint nRows, uint nKeys, std::vector< int > const &repeatSeqValues)
 Tests equality scan on the table created in loadTableAndIndex, using the all keys except the rid and the last key.
void testScanIdx (uint totalKeys, uint nKeys, uint bufSize, boost::shared_array< FixedBuffer > inputBuffer, uint expectedNBitmaps, PBuffer expectedBitmaps, bool dynamicRootPageId, bool useDynamicKeys, bool includeRid, const boost::scoped_array< uint64_t > &vals)
 Performs an index search using the key values/directives passed in.
void initEqualSearch (uint nKeys, uint nInputTuples, boost::scoped_array< uint64_t > &vals, char &lowerDirective, char &upperDirective, TupleAccessor &inputTupleAccessor, TupleData &inputTupleData, boost::shared_array< FixedBuffer > &inputBuffer, bool useDynamicKeys)
 Initializes input search key and directives for an equality search.
void setSearchKey (char lowerDirective, char upperDirective, uint64_t lowerVal, uint64_t upperVal, PBuffer inputBuf, uint &offset, TupleAccessor &inputTupleAccessor, TupleData &inputTupleData)
void initBitmapInput (BitmapInput &bmInput, uint nRows, InputData const &inputData)
void initBitmapInput (BitmapInput &bmInput, uint nRows, LbmNumberStreamInput input)
void generateBitmaps (uint nRows, LbmNumberStreamInput input, BitmapInput &bmInput)
void generateBitmaps (uint nRows, uint start, uint skipRows, PBuffer pBuf, uint &bufSize, uint fullBufSize, uint &nBitmaps, bool includeKeys=false)
 Generate bitmaps to used in verifying result of bitmap index scan.
void produceEntry (LbmEntry &lbmEntry, TupleAccessor &bitmapTupleAccessor, BitmapInput &bmInput)
void produceEntry (LbmEntry &lbmEntry, TupleAccessor &bitmapTupleAccessor, PBuffer pBuf, uint &bufSize, uint &nBitmaps, bool includeKeys)
void initValuesExecStream (uint idx, ValuesExecStreamParams &valuesParams, ExecStreamEmbryo &valuesStreamEmbryo, BitmapInput &bmInput)
void initSorterExecStream (ExternalSortExecStreamParams &params, ExecStreamEmbryo &embryo, TupleDescriptor const &outputDesc, uint nKeys=1)
void initNormalizerExecStream (LbmNormalizerExecStreamParams &params, ExecStreamEmbryo &embryo, uint nKeys)
uint resultBitmapSize (uint start, uint end)
 Calculates size of result bitmap.
uint resultBitmapSize (uint nRids)
void initKeyBitmap (uint nRows, std::vector< int > const &repeatSeqValues)
 Initialize bitmaps with keys.
SharedExecStream prepareSourceGraph (ExecStreamEmbryo &sourceStreamEmbryo)
 Defines and prepares a graph consisting of one source stream.
SharedExecStream prepareTransformGraph (ExecStreamEmbryo &sourceStreamEmbryo, ExecStreamEmbryo &transformStreamEmbryo)
 Defines and prepares a graph consisting of one source stream and one transform stream.
SharedExecStream prepareTransformGraph (ExecStreamEmbryo &sourceStreamEmbryo, std::vector< ExecStreamEmbryo > &transforms)
 Defines and prepares a graph consisting of one source stream and one or multiple transform streams.
SharedExecStream prepareConfluenceGraph (ExecStreamEmbryo &sourceStreamEmbryo1, ExecStreamEmbryo &sourceStreamEmbryo2, ExecStreamEmbryo &confluenceStreamEmbryo)
 Defines and prepares a graph consisting of two source streams and one confluence stream.
SharedExecStream prepareConfluenceGraph (std::vector< ExecStreamEmbryo > &sourceStreamEmbryos, ExecStreamEmbryo &confluenceStreamEmbryo)
 Defines and prepares a graph consisting of a list of source streams and one confluence stream.
SharedExecStream prepareConfluenceGraph (std::vector< std::vector< ExecStreamEmbryo > > &sourceStreamEmbryosList, ExecStreamEmbryo &confluenceStreamEmbryo)
 Defines and prepares a graph consisting of one or more source streams and one confluence stream.
SharedExecStream prepareConfluenceTransformGraph (ExecStreamEmbryo &sourceStreamEmbryo1, ExecStreamEmbryo &sourceStreamEmbryo2, ExecStreamEmbryo &confluenceStreamEmbryo, ExecStreamEmbryo &transformStreamEmbryo)
 Defines and prepares a graph consisting of two source streams, one confluence stream, and one transform stream.
SharedExecStream prepareDAG (ExecStreamEmbryo &srcStreamEmbryo, ExecStreamEmbryo &splitterStreamEmbryo, std::vector< ExecStreamEmbryo > &interStreamEmbryos, ExecStreamEmbryo &destStreamEmbryo, bool createSink=true, bool saveSrc=true)
 Defines and prepares a graph consisting of a source, a splitter, and one or more parallel transform streams which flow together into a confluence stream.
SharedExecStream prepareDAG (ExecStreamEmbryo &srcStreamEmbryo, ExecStreamEmbryo &splitterStreamEmbryo, std::vector< std::vector< ExecStreamEmbryo > > &interStreamEmbryosList, ExecStreamEmbryo &destStreamEmbryo, bool createSink=true, bool saveSrc=true)
 Defines and prepares a graph consisting of a source, a splitter, and one or more parallel transform streams which flow together into a confluence stream.
void verifyOutput (ExecStream &stream, uint nRowsExpected, MockProducerExecStreamGenerator &verifier, bool stopEarly=false)
 Executes the prepared stream graph and verifies that its output matches that produced by a value generator.
void verifyConstantOutput (ExecStream &stream, const TupleData &expectedTuple, uint nRowsExpected)
 Executes the prepared stream graph and verifies that all output tuples matche an expected and given one.
void verifyBufferedOutput (ExecStream &stream, TupleDescriptor outputTupleDesc, uint nRowsExpected, PBuffer expectedBuffer)
 Executes the prepared stream graph and verifies the resultant tuples against a set of tuples supplied in an input buffer.
void resetExecStreamTest ()
 Reset stream graph so multiple iterations of a method can be called within a single testcase.
virtual void tearDownExecStreamTest ()
 ExecStream-specific handler called from testCaseTearDown.
virtual SharedExecStreamGraph newStreamGraph ()
 Creates a stream graph.
virtual SharedExecStreamGraphEmbryo newStreamGraphEmbryo (SharedExecStreamGraph)
 Creates an embryo for a stream graph.
virtual ExecStreamSchedulernewScheduler ()
 Creates a scheduler.
virtual ExecStreamGovernornewResourceGovernor (ExecStreamResourceKnobs const &knobSettings, ExecStreamResourceQuantity const &resourcesAvailable)
 Creates the resource governor.
void snooze (uint nSeconds)

Static Protected Member Functions

static const std::string & getTraceName ()

Protected Attributes

TupleAttributeDescriptor attrDesc_char1
TupleAttributeDescriptor attrDesc_nullableInt64
vector< boost::shared_ptr<
BTreeDescriptor > > 
bTreeClusters
 BTrees corresponding to the clusters.
vector< PageId > savedBTreeClusterRootIds
 Saved root pageids of btrees corresponding to clusters; used to append to existing table and to read from them.
vector< boost::shared_ptr<
BTreeDescriptor > > 
bTreeBitmaps
 BTrees corresponding to the bitmaps.
vector< PageId > savedBTreeBitmapRootIds
 Saved root pageids of btrees corresponding to bitmaps; used to append to existing table and to read from them.
StandardTypeDescriptorFactory stdTypeFactory
TupleAttributeDescriptor attrDesc_int64
TupleAttributeDescriptor attrDesc_bitmap
uint bitmapColSize
 Size of bitmap columns.
TupleDescriptor bitmapTupleDesc
 Tuple descriptor, tupledata, and accessor for a bitmap segment: (rid, segment descriptor, bitmap segments).
TupleData bitmapTupleData
TupleAccessor bitmapTupleAccessor
TupleDescriptor keyBitmapTupleDesc
 Tuple descriptor, data, and accessor for key-containting bitmaps (keys, srid, segment descriptor, bitmap segments).
TupleData keyBitmapTupleData
TupleAccessor keyBitmapTupleAccessor
boost::shared_array< FixedBufferkeyBitmapBuf
uint keyBitmapBufSize
SharedExecStreamGraph pGraph
SharedExecStreamGraphEmbryo pGraphEmbryo
SharedExecStreamScheduler pScheduler
SharedExecStreamGovernor pResourceGovernor
SharedCacheAccessor pCacheAccessor
SharedSegmentFactory pSegmentFactory
SharedSegment pLinearSegment
 Segment supporting linear page allocation.
SharedSegment pRandomSegment
 (Optional) segment supporting random page allocation.
SharedSegment pVersionedRandomSegment
 (Optional) segment supporting versioned random page allocation.
SharedSegment pSnapshotRandomSegment
 (Optional) segment supporting snapshot random page allocation.
VictimPolicy victimPolicy
 VictimPolicy to instantiate.
CacheParams cacheParams
 Parameters for cache initialization.
SharedCache pCache
 Cache instance being tested.
SharedRandomAccessDevice pRandomAccessDevice
 The default cached device.
uint nMemPages
 Size of cache in memory pages.
uint nDiskPages
 Size of device in disk pages.
uint cbPageFull
 Disk page size.
DeviceId dataDeviceId
 Fixed ID to assign to data device.
TestSuitepTestSuite
 Boost test suite.
boost::shared_ptr< TestBasepTestObj
std::ofstream traceStream
 Output file stream for tracing.
StrictMutex traceMutex
 Protects traceStream.
std::string testName
 Name of test.
TraceLevel traceLevel
 Level at which to trace test execution.
FileStatsTarget statsTarget
 Output for stats.
StatsTimer statsTimer
 Timer for stats collection.
bool traceStdout
 Copy trace output to stdout.
bool traceFile
 Copy trace output to file.
TestCaseGroup defaultTests
TestCaseGroup extraTests

Static Protected Attributes

static const uint DefaultCacheReservePercent = 5
static const uint DefaultConcurrentStatements = 4
static bool runAll
 Run all test cases, including the extra tests.
static std::string runSingle
 Run only the test case of this name.

Detailed Description

Testcase for scanning a single bitmap index using equality search on all index keys.

Definition at line 55 of file LbmSearchTest.cpp.


Member Enumeration Documentation

enum CacheTestBase::VictimPolicy [protected, inherited]

The available victim policy implementations.

Enumerator:
victimTwoQ 
victimLRU 
victimRandom 

Definition at line 44 of file CacheTestBase.h.

00044                       {
00045         victimTwoQ,
00046         victimLRU,
00047         victimRandom
00048     };


Constructor & Destructor Documentation

LbmSearchTest::LbmSearchTest (  )  [inline, explicit]

Definition at line 236 of file LbmSearchTest.cpp.

References testMultipleRanges(), testScanOneLevel(), and testScanTwoLevel().

00237     {
00238         FENNEL_UNIT_TEST_CASE(LbmSearchTest, testScanOneLevel);
00239         FENNEL_UNIT_TEST_CASE(LbmSearchTest, testScanTwoLevel);
00240         FENNEL_UNIT_TEST_CASE(LbmSearchTest, testMultipleRanges);
00241     }


Member Function Documentation

void LbmSearchTest::initBTreeExecStreamParam ( BTreeExecStreamParams param,
shared_ptr< BTreeDescriptor pBTreeDesc 
) [protected]

Initializes a BTreeExecStreamParam structure.

Definition at line 790 of file LbmSearchTest.cpp.

References initBTreeParam(), CacheTestBase::pCache, ExecStreamParams::pCacheAccessor, SegStorageTestBase::pSegmentFactory, and ExecStreamParams::scratchAccessor.

Referenced by loadTableAndIndex(), and testScanIdx().

00792 {
00793     param.scratchAccessor = pSegmentFactory->newScratchSegment(pCache, 15);
00794     param.pCacheAccessor = pCache;
00795     initBTreeParam(param, pBTreeDesc);
00796 }

void LbmSearchTest::initBTreeParam ( BTreeParams param,
shared_ptr< BTreeDescriptor pBTreeDesc 
) [protected]

Initializes BTreeParams structure.

Definition at line 798 of file LbmSearchTest.cpp.

References BTreeParams::keyProj, BTreeParams::pageOwnerId, CacheTestBase::pCache, SegStorageTestBase::pRandomSegment, BTreeParams::pRootMap, BTreeParams::pSegment, BTreeParams::rootPageIdParamId, BTreeParams::segmentId, and BTreeParams::tupleDesc.

Referenced by initBTreeExecStreamParam(), and loadTableAndIndex().

00800 {
00801     param.pSegment = pRandomSegment;
00802     param.pRootMap = 0;
00803     param.rootPageIdParamId = DynamicParamId(0);
00804 
00805     pBTreeDesc->segmentAccessor.pSegment = param.pSegment;
00806     pBTreeDesc->segmentAccessor.pCacheAccessor = pCache;
00807     pBTreeDesc->tupleDescriptor = param.tupleDesc;
00808     pBTreeDesc->keyProjection = param.keyProj;
00809     param.pageOwnerId = pBTreeDesc->pageOwnerId;
00810     param.segmentId = pBTreeDesc->segmentId;
00811 }

void LbmSearchTest::initClusterScanDef ( LcsRowScanBaseExecStreamParams generatorParams,
struct LcsClusterScanDef clusterScanDef,
uint  bTreeIndex 
) [protected]

Initializes a cluster scan def structure for a LcsRowScanBase exec stream.

Definition at line 813 of file LbmSearchTest.cpp.

References bTreeClusters, BTreeParams::keyProj, LcsRowScanBaseExecStreamParams::lcsClusterScanDefs, BTreeParams::pageOwnerId, ExecStreamParams::pCacheAccessor, BTreeParams::pRootMap, BTreeParams::pSegment, BTreeParams::rootPageId, BTreeParams::rootPageIdParamId, BTreeParams::segmentId, and BTreeParams::tupleDesc.

Referenced by loadTableAndIndex().

00817 {
00818     clusterScanDef.pSegment =
00819         bTreeClusters[bTreeIndex]->segmentAccessor.pSegment;
00820     clusterScanDef.pCacheAccessor =
00821         bTreeClusters[bTreeIndex]->segmentAccessor.pCacheAccessor;
00822     clusterScanDef.tupleDesc = bTreeClusters[bTreeIndex]->tupleDescriptor;
00823     clusterScanDef.keyProj = bTreeClusters[bTreeIndex]->keyProjection;
00824     clusterScanDef.rootPageId = bTreeClusters[bTreeIndex]->rootPageId;
00825     clusterScanDef.pageOwnerId = bTreeClusters[bTreeIndex]->pageOwnerId;
00826     clusterScanDef.segmentId = bTreeClusters[bTreeIndex]->segmentId;
00827     clusterScanDef.pRootMap = 0;
00828     clusterScanDef.rootPageIdParamId = DynamicParamId(0);
00829     rowScanParams.lcsClusterScanDefs.push_back(clusterScanDef);
00830 }

void LbmSearchTest::initBTreeBitmapDesc ( TupleDescriptor tupleDesc,
TupleProjection keyProj,
uint  nKeys 
) [protected]

Initializes BTreeExecStreamParam corresponding to a bitmap index.

Parameters:
tupleDesc tuple descriptor corresponding to bitmap index
keyProj projection corresponding to the bitmap index keys; excludes start rid
nKeys number of keys in the bitmap index; excludes start rid from key count

Definition at line 832 of file LbmSearchTest.cpp.

References initBTreeTupleDesc(), BTreeParams::keyProj, and BTreeParams::tupleDesc.

Referenced by loadTableAndIndex(), and testScanIdx().

00834 {
00835     initBTreeTupleDesc(tupleDesc, nKeys);
00836 
00837     // btree key consists of the key columns and the start rid
00838     for (uint j = 0; j < nKeys + 1; j++) {
00839         keyProj.push_back(j);
00840     }
00841 }

void LbmSearchTest::initBTreeTupleDesc ( TupleDescriptor tupleDesc,
uint  nKeys 
) [protected]

Initializes a tuple descriptor corresponding to a bitmap index.

Parameters:
tupleDesc tuple descriptor corresponding to bitmap index
nKeys number of keys in the bitmap index; excludes start rid from key count

Definition at line 843 of file LbmSearchTest.cpp.

References LbmExecStreamTestBase::attrDesc_int64, LbmExecStreamTestBase::bitmapTupleDesc, and BTreeParams::tupleDesc.

Referenced by initBTreeBitmapDesc(), and loadTableAndIndex().

00845 {
00846     for (uint i = 0; i < nKeys; i++) {
00847         tupleDesc.push_back(attrDesc_int64);
00848     }
00849     // add on the rid and bitmaps
00850     tupleDesc.push_back(bitmapTupleDesc[0]);
00851     tupleDesc.push_back(bitmapTupleDesc[1]);
00852     tupleDesc.push_back(bitmapTupleDesc[2]);
00853 }

void LbmSearchTest::loadTableAndIndex ( uint  nRows,
uint  nClusters,
std::vector< int > const &  repeatSeqValues,
bool  newRoot 
) [protected]

Loads a table with nClusters clusters, 1 column per cluster, and nRows rows.

Each column has a repeating sequence of values based on the value in the repeatSeqValues vector. E.g., a repeating sequence of n will have values:

(0, 1, 2, ..., n-1, 0, 1, 2, ..., n-1, 0, 1, 2, ...).

Then a single bitmap index is created on all columns.

Parameters:
nRows number of rows to load
nClusters number of clusters to create
repeatSeqValues repeating sequence values for each column
newRoot if true, append to existing table

Definition at line 549 of file LbmSearchTest.cpp.

References LbmExecStreamTestBase::attrDesc_int64, BARRIER_RET_ANY_INPUT, bTreeBitmaps, bTreeClusters, LbmSplicerExecStreamParams::bTreeParams, LcsClusterScanDef::clusterTupleDesc, BTreeBuilder::createEmptyRoot(), LbmGeneratorExecStreamParams::createIndex, LbmSplicerExecStreamParams::createNewIndex, ExternalSortExecStreamParams::distinctness, DUP_ALLOW, ExternalSortExecStreamParams::earlyClose, ExternalSortExecStreamParams::estimatedNumRows, BTreeAccessBase::getRootPageId(), ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), initBTreeBitmapDesc(), initBTreeExecStreamParam(), initBTreeParam(), initBTreeTupleDesc(), initClusterScanDef(), LbmSplicerExecStreamParams::insertRowCountParamId, LbmGeneratorExecStreamParams::insertRowCountParamId, ExternalSortExecStreamParams::keyProj, BTreeParams::keyProj, MAXU, ExternalSortExecStream::newExternalSortExecStream(), MockProducerExecStreamParams::nRows, LcsRowScanBaseExecStreamParams::outputProj, DiffluenceExecStreamParams::outputTupleDesc, SingleOutputExecStreamParams::outputTupleDesc, CacheTestBase::pCache, MockProducerExecStreamParams::pGenerator, SegStorageTestBase::pRandomSegment, ExecStreamUnitTestBase::prepareDAG(), SegStorageTestBase::pSegmentFactory, ExternalSortExecStreamParams::pTempSegment, BarrierExecStreamParams::returnMode, BTreeParams::rootPageId, savedBTreeBitmapRootIds, savedBTreeClusterRootIds, ExternalSortExecStreamParams::storeFinalRun, BTreeParams::tupleDesc, ExecStreamUnitTestBase::verifyOutput(), and LbmSplicerExecStreamParams::writeRowCountParamId.

Referenced by testMultipleRanges(), and testScans().

00552 {
00553     // 0. reset member fields.
00554     for (uint i = 0; i < bTreeClusters.size(); i++) {
00555         bTreeClusters[i]->segmentAccessor.reset();
00556     }
00557     for (uint i = 0; i < bTreeBitmaps.size(); i++) {
00558         bTreeBitmaps[i]->segmentAccessor.reset();
00559     }
00560     bTreeClusters.clear();
00561     bTreeBitmaps.clear();
00562 
00563     // 1. setup mock input stream
00564 
00565     MockProducerExecStreamParams mockParams;
00566     for (uint i = 0; i < nClusters; i++) {
00567         mockParams.outputTupleDesc.push_back(attrDesc_int64);
00568     }
00569     mockParams.nRows = nRows;
00570 
00571     vector<boost::shared_ptr<ColumnGenerator<int64_t> > > columnGenerators;
00572     SharedInt64ColumnGenerator col;
00573     assert(repeatSeqValues.size() == nClusters);
00574     for (uint i = 0; i < repeatSeqValues.size(); i++) {
00575         col =
00576             SharedInt64ColumnGenerator(
00577                 new RepeatingSeqColumnGenerator(repeatSeqValues[i]));
00578         columnGenerators.push_back(col);
00579     }
00580     mockParams.pGenerator.reset(
00581         new CompositeExecStreamGenerator(columnGenerators));
00582 
00583     ExecStreamEmbryo mockStreamEmbryo;
00584     mockStreamEmbryo.init(new MockProducerExecStream(), mockParams);
00585     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00586 
00587     // 2. setup splitter stream for cluster loads
00588 
00589     SplitterExecStreamParams splitterParams;
00590     ExecStreamEmbryo splitterStreamEmbryo;
00591     splitterStreamEmbryo.init(new SplitterExecStream(), splitterParams);
00592     splitterStreamEmbryo.getStream()->setName("ClusterSplitterExecStream");
00593 
00594     // 3. setup loader streams
00595 
00596     vector<ExecStreamEmbryo> lcsAppendEmbryos;
00597     for (uint i = 0; i < nClusters; i++) {
00598         LcsClusterAppendExecStreamParams lcsAppendParams;
00599         boost::shared_ptr<BTreeDescriptor> pBTreeDesc =
00600             boost::shared_ptr<BTreeDescriptor> (new BTreeDescriptor());
00601         bTreeClusters.push_back(pBTreeDesc);
00602 
00603         // initialize the btree parameter portion of lcsAppendParams
00604         // BTree tuple desc has two columns (rid, clusterPageid)
00605         (lcsAppendParams.tupleDesc).push_back(attrDesc_int64);
00606         (lcsAppendParams.tupleDesc).push_back(attrDesc_int64);
00607 
00608         // BTree key only has one column which is the first column.
00609         (lcsAppendParams.keyProj).push_back(0);
00610 
00611         initBTreeExecStreamParam(lcsAppendParams, pBTreeDesc);
00612 
00613         // output two values (rows inserted, starting rid value)
00614         lcsAppendParams.outputTupleDesc.push_back(attrDesc_int64);
00615         lcsAppendParams.outputTupleDesc.push_back(attrDesc_int64);
00616 
00617         lcsAppendParams.inputProj.push_back(i);
00618 
00619         // create an empty page to start the btree
00620 
00621         if (newRoot) {
00622             BTreeBuilder builder(*pBTreeDesc, pRandomSegment);
00623             builder.createEmptyRoot();
00624             savedBTreeClusterRootIds.push_back(builder.getRootPageId());
00625         }
00626         lcsAppendParams.rootPageId = pBTreeDesc->rootPageId =
00627             savedBTreeClusterRootIds[i];
00628 
00629         // Now use the above initialized parameter
00630 
00631         ExecStreamEmbryo lcsAppendStreamEmbryo;
00632         lcsAppendStreamEmbryo.init(
00633             new LcsClusterAppendExecStream(), lcsAppendParams);
00634         std::ostringstream oss;
00635         oss << "LcsClusterAppendExecStream" << "#" << i;
00636         lcsAppendStreamEmbryo.getStream()->setName(oss.str());
00637         lcsAppendEmbryos.push_back(lcsAppendStreamEmbryo);
00638     }
00639 
00640     // 4. setup barrier stream for cluster loads
00641 
00642     BarrierExecStreamParams barrierParams;
00643     barrierParams.outputTupleDesc.push_back(attrDesc_int64);
00644     barrierParams.outputTupleDesc.push_back(attrDesc_int64);
00645     barrierParams.returnMode = BARRIER_RET_ANY_INPUT;
00646 
00647     ExecStreamEmbryo clusterBarrierStreamEmbryo;
00648     clusterBarrierStreamEmbryo.init(new BarrierExecStream(), barrierParams);
00649     clusterBarrierStreamEmbryo.getStream()->setName("ClusterBarrierExecStream");
00650 
00651     // create a DAG with the above, but without the final output sink
00652     prepareDAG(
00653         mockStreamEmbryo, splitterStreamEmbryo, lcsAppendEmbryos,
00654         clusterBarrierStreamEmbryo, false);
00655 
00656     // 5. setup splitter stream for create bitmaps
00657 
00658     splitterStreamEmbryo.init(
00659         new SplitterExecStream(), splitterParams);
00660     splitterStreamEmbryo.getStream()->setName("BitmapSplitterExecStream");
00661 
00662     // create streams for bitmap generator, sort, and bitmap splicer to
00663     // build an index on all columns
00664 
00665     std::vector<std::vector<ExecStreamEmbryo> > createBitmapStreamList;
00666         std::vector<ExecStreamEmbryo> createBitmapStream;
00667 
00668     // 6. setup generator
00669 
00670     LbmGeneratorExecStreamParams generatorParams;
00671     struct LcsClusterScanDef clusterScanDef;
00672     clusterScanDef.clusterTupleDesc.push_back(attrDesc_int64);
00673 
00674     for (uint j = 0; j < nClusters; j++) {
00675         initClusterScanDef(generatorParams, clusterScanDef, j);
00676     }
00677 
00678     TupleProjection proj;
00679     for (uint j = 0; j < nClusters; j++) {
00680         proj.push_back(j);
00681     }
00682     generatorParams.outputProj = proj;
00683     generatorParams.insertRowCountParamId = DynamicParamId(1);
00684     generatorParams.createIndex = false;
00685 
00686     boost::shared_ptr<BTreeDescriptor> pBTreeDesc =
00687         boost::shared_ptr<BTreeDescriptor> (new BTreeDescriptor());
00688     bTreeBitmaps.push_back(pBTreeDesc);
00689 
00690     // BTree tuple desc has the key columns + starting Rid + varbinary
00691     // field for bit segments/bit descriptors
00692     uint nKeys = nClusters;
00693     initBTreeTupleDesc(generatorParams.outputTupleDesc, nKeys);
00694 
00695     initBTreeBitmapDesc(
00696         generatorParams.tupleDesc, generatorParams.keyProj, nKeys);
00697     initBTreeExecStreamParam(generatorParams, pBTreeDesc);
00698 
00699     // create an empty page to start the btree
00700 
00701     if (newRoot) {
00702         BTreeBuilder builder(*pBTreeDesc, pRandomSegment);
00703         builder.createEmptyRoot();
00704         savedBTreeBitmapRootIds.push_back(builder.getRootPageId());
00705     }
00706     generatorParams.rootPageId = pBTreeDesc->rootPageId =
00707         savedBTreeBitmapRootIds[0];
00708 
00709     ExecStreamEmbryo generatorStreamEmbryo;
00710     generatorStreamEmbryo.init(
00711         new LbmGeneratorExecStream(), generatorParams);
00712     std::ostringstream oss;
00713     oss << "LbmGeneratorExecStream" << "#" << 0;
00714     generatorStreamEmbryo.getStream()->setName(oss.str());
00715     createBitmapStream.push_back(generatorStreamEmbryo);
00716 
00717     // 7. setup sorter
00718 
00719     ExternalSortExecStreamParams sortParams;
00720     initBTreeBitmapDesc(
00721         sortParams.outputTupleDesc, sortParams.keyProj, nKeys);
00722     sortParams.distinctness = DUP_ALLOW;
00723     sortParams.pTempSegment = pRandomSegment;
00724     sortParams.pCacheAccessor = pCache;
00725     sortParams.scratchAccessor =
00726         pSegmentFactory->newScratchSegment(pCache, 10);
00727     sortParams.storeFinalRun = false;
00728     sortParams.estimatedNumRows = MAXU;
00729     sortParams.earlyClose = false;
00730 
00731     ExecStreamEmbryo sortStreamEmbryo;
00732     sortStreamEmbryo.init(
00733         ExternalSortExecStream::newExternalSortExecStream(), sortParams);
00734     sortStreamEmbryo.getStream()->setName("ExternalSortExecStream");
00735     std::ostringstream oss2;
00736     oss2 << "ExternalSortExecStream" << "#" << 0;
00737     sortStreamEmbryo.getStream()->setName(oss2.str());
00738     createBitmapStream.push_back(sortStreamEmbryo);
00739 
00740     // 8. setup splicer
00741 
00742     LbmSplicerExecStreamParams splicerParams;
00743     splicerParams.createNewIndex = false;
00744     splicerParams.scratchAccessor =
00745         pSegmentFactory->newScratchSegment(pCache, 15);
00746     splicerParams.pCacheAccessor = pCache;
00747     BTreeParams bTreeParams;
00748     initBTreeBitmapDesc(
00749         bTreeParams.tupleDesc, bTreeParams.keyProj, nKeys);
00750     initBTreeParam(bTreeParams, pBTreeDesc);
00751     bTreeParams.rootPageId = pBTreeDesc->rootPageId;
00752     splicerParams.bTreeParams.push_back(bTreeParams);
00753     splicerParams.insertRowCountParamId = DynamicParamId(1);
00754     splicerParams.writeRowCountParamId = DynamicParamId(0);
00755     splicerParams.outputTupleDesc.push_back(attrDesc_int64);
00756 
00757     ExecStreamEmbryo splicerStreamEmbryo;
00758     splicerStreamEmbryo.init(new LbmSplicerExecStream(), splicerParams);
00759     std::ostringstream oss3;
00760     oss3 << "LbmSplicerExecStream" << "#" << 0;
00761     splicerStreamEmbryo.getStream()->setName(oss3.str());
00762     createBitmapStream.push_back(splicerStreamEmbryo);
00763 
00764     // connect the sorter and splicer to generator and then add this
00765     // newly connected stream to the list of create bitmap stream embryos
00766     createBitmapStreamList.push_back(createBitmapStream);
00767 
00768     // 9. setup barrier stream for create bitmaps
00769 
00770     barrierParams.outputTupleDesc.clear();
00771     barrierParams.outputTupleDesc.push_back(attrDesc_int64);
00772 
00773     ExecStreamEmbryo barrierStreamEmbryo;
00774     barrierStreamEmbryo.init(
00775         new BarrierExecStream(), barrierParams);
00776     barrierStreamEmbryo.getStream()->setName("BitmapBarrierExecStream");
00777 
00778     // create the bitmap stream graph, with the load stream graph from
00779     // above as the source
00780     SharedExecStream pOutputStream = prepareDAG(
00781         clusterBarrierStreamEmbryo, splitterStreamEmbryo,
00782         createBitmapStreamList, barrierStreamEmbryo, true, false);
00783 
00784     // set up a generator which can produce the expected output
00785     RampExecStreamGenerator expectedResultGenerator(mockParams.nRows);
00786 
00787     verifyOutput(*pOutputStream, 1, expectedResultGenerator);
00788 }

void LbmSearchTest::testScanFullKey ( uint  nRows,
uint  nKeys,
std::vector< int > const &  repeatSeqValues,
bool  useDynamicKeys,
bool  includeRid 
) [protected]

Tests equality scan on the table created in loadTableAndIndex, using the entire index key (minus the rid).

Parameters:
nRows total number of rows in the table
nKeys number of keys in the index (excluding startrid)
repeatSeqValues initial repeating sequence values for each column
useDynamicKeys if true, pass search keys through dynamic parameters
includeRid if true, include rid >= 0 in the search

Definition at line 389 of file LbmSearchTest.cpp.

References FixedBuffer, LbmExecStreamTestBase::generateBitmaps(), TupleAccessor::getCurrentByteCount(), initEqualSearch(), TupleAccessor::marshal(), and testScanIdx().

Referenced by testMultipleRanges(), and testScans().

00392 {
00393     // search for key0 = <val0>, key1 = <val1>, ..., key(n-1) = <val(n-1)>
00394     uint nInputTuples = 1;
00395     boost::scoped_array<uint64_t> vals;
00396     char lowerDirective;
00397     char upperDirective;
00398     TupleAccessor inputTupleAccessor;
00399     TupleData inputTupleData;
00400     boost::shared_array<FixedBuffer> inputBuffer;
00401 
00402     initEqualSearch(
00403         nKeys, nInputTuples, vals, lowerDirective, upperDirective,
00404         inputTupleAccessor, inputTupleData, inputBuffer, useDynamicKeys);
00405 
00406     // do a search on each possible key combo
00407     uint skipRows = 1;
00408     for (uint i = 0; i < nKeys; i++) {
00409         skipRows *= repeatSeqValues[i];
00410     }
00411     for (uint i = 0; i < skipRows; i++) {
00412         // generate input keys for search
00413         for (uint j = 0; j < nKeys; j++) {
00414             vals[j] = i % repeatSeqValues[j];
00415         }
00416         inputTupleAccessor.marshal(inputTupleData, inputBuffer.get());
00417 
00418         // generate expected bitmap result
00419         boost::scoped_array<FixedBuffer> expectedBitmaps;
00420         uint bufferSize = (nRows / skipRows + 1) * 16;
00421         expectedBitmaps.reset(new FixedBuffer[bufferSize]);
00422         uint expectedNBitmaps = 0;
00423         uint expectedBufSize = 0;
00424         generateBitmaps(
00425             nRows, i, skipRows, expectedBitmaps.get(), expectedBufSize,
00426             bufferSize, expectedNBitmaps);
00427 
00428         testScanIdx(
00429             nKeys, nKeys, inputTupleAccessor.getCurrentByteCount(),
00430             inputBuffer, expectedNBitmaps, expectedBitmaps.get(), false,
00431             useDynamicKeys, includeRid, vals);
00432     }
00433 }

void LbmSearchTest::testScanPartialKey ( uint  nRows,
uint  nKeys,
std::vector< int > const &  repeatSeqValues 
) [protected]

Tests equality scan on the table created in loadTableAndIndex, using the all keys except the rid and the last key.

Parameters:
nRows total number of rows in the table
nKeys number of keys in the index (excluding startrid)
repeatSeqValues initial repeating sequence values for each column

Definition at line 435 of file LbmSearchTest.cpp.

References FixedBuffer, LbmExecStreamTestBase::generateBitmaps(), TupleAccessor::getCurrentByteCount(), initEqualSearch(), TupleAccessor::marshal(), and testScanIdx().

Referenced by testScans().

00437 {
00438     // search for key0 = 0, key1 = 0, ..., key(n-2) = 0
00439     uint nInputTuples = 1;
00440     boost::scoped_array<uint64_t> vals;
00441     char lowerDirective;
00442     char upperDirective;
00443     TupleAccessor inputTupleAccessor;
00444     TupleData inputTupleData;
00445     boost::shared_array<FixedBuffer> inputBuffer;
00446 
00447     initEqualSearch(
00448         nKeys - 1, nInputTuples, vals, lowerDirective, upperDirective,
00449         inputTupleAccessor, inputTupleData, inputBuffer, false);
00450 
00451     // generate input keys for search
00452     for (uint j = 0; j < nKeys - 1; j++) {
00453         vals[j] = 0;
00454     }
00455     inputTupleAccessor.marshal(inputTupleData, inputBuffer.get());
00456 
00457     // Generate one set of bitmaps for each key combo that can be combined
00458     // with the partial key. E.g., if there are 3 keys, generate the
00459     // bitmaps that would be obtained from searching for (0, 0, 0), (0, 0, 1),
00460     // ..., (0, 0, repeatSeqValues[nKeys-1] - 1)
00461 
00462     uint skipRows = 1;
00463     for (uint i = 0; i < nKeys - 1; i++) {
00464         skipRows *= repeatSeqValues[i];
00465     }
00466     boost::scoped_array<FixedBuffer> expectedBitmaps;
00467     uint bufferSize = (nRows / skipRows / 8 + 1)
00468         * 12 * repeatSeqValues[nKeys - 1];
00469     expectedBitmaps.reset(new FixedBuffer[bufferSize]);
00470     PBuffer bitmapBuf = expectedBitmaps.get();
00471     uint expectedNBitmaps = 0;
00472     uint curBufSize = 0;
00473 
00474     for (uint i = 0; i < repeatSeqValues[nKeys - 1]; i++) {
00475         uint start;
00476         if (i == 0) {
00477             start = 0;
00478         } else {
00479             // look for the first rid where the last key is equal to "i" and
00480             // the preceeding keys are all 0
00481             for (start = i; start < nRows;
00482                  start += repeatSeqValues[nKeys - 1])
00483             {
00484                 uint j;
00485                 for (j = 0; j < nKeys - 1; j++) {
00486                     if (start % repeatSeqValues[j] != 0) {
00487                         break;
00488                     }
00489                 }
00490                 if (j == nKeys - 1) {
00491                     break;
00492                 }
00493             }
00494             if (start >= nRows) {
00495                 continue;
00496             }
00497         }
00498         generateBitmaps(
00499             nRows, start, skipRows * repeatSeqValues[nKeys - 1],
00500             bitmapBuf, curBufSize, bufferSize, expectedNBitmaps);
00501     }
00502     testScanIdx(
00503         nKeys, nKeys - 1, inputTupleAccessor.getCurrentByteCount(),
00504         inputBuffer, expectedNBitmaps, bitmapBuf, false, false, false, vals);
00505 }

void LbmSearchTest::testScanIdx ( uint  totalKeys,
uint  nKeys,
uint  bufSize,
boost::shared_array< FixedBuffer inputBuffer,
uint  expectedNBitmaps,
PBuffer  expectedBitmaps,
bool  dynamicRootPageId,
bool  useDynamicKeys,
bool  includeRid,
const boost::scoped_array< uint64_t > &  vals 
) [protected]

Performs an index search using the key values/directives passed in.

Parameters:
totalKeys total number of keys in the index (excluding startrid)
nKeys number of keys to use in index search; always excludes startrid
bufSize size of input buffer containing search keys/directive
inputBuffer buffer containing search key/directive tuples to be passed into the index scan
expectedNBitmaps expected number of bitmaps in result
expectedBitmaps buffer containing expected bitmap result
dynamicRootPageId if true, pass in the btree rootPageId as a dynamic parameter
useDynamicKeys if true, pass in search key values using dynamic parameters
includeRid include rid in search
vals search key values

Definition at line 882 of file LbmSearchTest.cpp.

References attrDesc_char1, LbmExecStreamTestBase::attrDesc_int64, attrDesc_nullableInt64, LbmExecStreamTestBase::bitmapTupleAccessor, LbmExecStreamTestBase::bitmapTupleDesc, bTreeBitmaps, ValuesExecStreamParams::bufSize, TupleDatum::cbData, ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), initBTreeBitmapDesc(), initBTreeExecStreamParam(), NULL_PAGE_ID, SingleOutputExecStreamParams::outputTupleDesc, TupleDatum::pData, ExecStreamUnitTestBase::pGraph, ExecStreamUnitTestBase::prepareTransformGraph(), ValuesExecStreamParams::pTupleBuffer, ExecStreamUnitTestBase::resetExecStreamTest(), LbmSearchExecStreamParams::rowLimitParamId, savedBTreeBitmapRootIds, TupleAccessor::setCurrentTupleBuf(), LbmSearchExecStreamParams::startRidParamId, and ExecStreamUnitTestBase::verifyBufferedOutput().

Referenced by testMultipleRanges(), testScanFullKey(), and testScanPartialKey().

00890 {
00891     resetExecStreamTest();
00892 
00893     // setup input into index scan; values stream will read tuples from
00894     // inputBuffer
00895 
00896     ValuesExecStreamParams valuesParams;
00897     for (uint i = 0; i < 2; i++) {
00898         valuesParams.outputTupleDesc.push_back(attrDesc_char1);
00899         for (uint j = 0; j < nKeys; j++) {
00900             valuesParams.outputTupleDesc.push_back(attrDesc_nullableInt64);
00901         }
00902     }
00903     valuesParams.pTupleBuffer = inputBuffer;
00904     valuesParams.bufSize = bufSize;
00905 
00906     ExecStreamEmbryo valuesStreamEmbryo;
00907     valuesStreamEmbryo.init(new ValuesExecStream(), valuesParams);
00908     valuesStreamEmbryo.getStream()->setName("ValuesExecStream");
00909 
00910     // setup index scan stream
00911 
00912     LbmSearchExecStreamParams indexScanParams;
00913 
00914     // initialize parameters specific to indexScan
00915     indexScanParams.rowLimitParamId = DynamicParamId(0);
00916     if (includeRid) {
00917         indexScanParams.startRidParamId = DynamicParamId(1);
00918         SharedDynamicParamManager pDynamicParamManager =
00919             pGraph->getDynamicParamManager();
00920         pDynamicParamManager->createParam(DynamicParamId(1), attrDesc_int64);
00921         TupleDatum ridDatum;
00922         LcsRid rid = LcsRid(0);
00923         ridDatum.pData = (PConstBuffer) &rid;
00924         ridDatum.cbData = sizeof(LcsRid);
00925         pDynamicParamManager->writeParam(DynamicParamId(1), ridDatum);
00926     } else {
00927         indexScanParams.startRidParamId = DynamicParamId(0);
00928     }
00929 
00930     // initialize parameters for btree read
00931     initBTreeBitmapDesc(
00932         indexScanParams.tupleDesc, indexScanParams.keyProj, totalKeys);
00933     initBTreeExecStreamParam(indexScanParams, bTreeBitmaps[0]);
00934     bTreeBitmaps[0]->rootPageId = savedBTreeBitmapRootIds[0];
00935 
00936     if (!dynamicRootPageId) {
00937         indexScanParams.rootPageId = savedBTreeBitmapRootIds[0];
00938     } else {
00939         indexScanParams.rootPageId = NULL_PAGE_ID;
00940         indexScanParams.rootPageIdParamId = DynamicParamId(2);
00941         SharedDynamicParamManager pDynamicParamManager =
00942             pGraph->getDynamicParamManager();
00943         pDynamicParamManager->createParam(DynamicParamId(2), attrDesc_int64);
00944         TupleDatum rootPageIdDatum;
00945         rootPageIdDatum.pData = (PConstBuffer) &(savedBTreeBitmapRootIds[0]);
00946         rootPageIdDatum.cbData = sizeof(PageId);
00947         pDynamicParamManager->writeParam(DynamicParamId(2), rootPageIdDatum);
00948     }
00949 
00950     TupleProjection outputProj;
00951     for (uint i = totalKeys; i < totalKeys + 3; i++) {
00952         outputProj.push_back(i);
00953     }
00954     indexScanParams.outputProj = outputProj;
00955 
00956     // initialize parameters for btree search
00957     indexScanParams.outerJoin = false;
00958     TupleProjection inputKeyProj;
00959     for (uint i = 0; i < 2; i++) {
00960         for (uint j = 0; j < nKeys; j++) {
00961             inputKeyProj.push_back(i * (nKeys + 1) + j + 1);
00962         }
00963     }
00964     indexScanParams.inputKeyProj = inputKeyProj;
00965     indexScanParams.inputDirectiveProj.push_back(0);
00966     indexScanParams.inputDirectiveProj.push_back(nKeys + 1);
00967 
00968     // output is bitmap btree tuple without the key values, but with the rid
00969     indexScanParams.outputTupleDesc = bitmapTupleDesc;
00970 
00971     if (useDynamicKeys) {
00972         SharedDynamicParamManager pDynamicParamManager =
00973             pGraph->getDynamicParamManager();
00974         for (uint i = 3; i < nKeys * 2 + 3; i++) {
00975             indexScanParams.searchKeyParams.push_back(
00976                 BTreeSearchKeyParameter(
00977                     DynamicParamId(i),
00978                     i - 3));
00979             pDynamicParamManager->createParam(
00980                 DynamicParamId(i), attrDesc_int64);
00981             TupleDatum keyValDatum;
00982             keyValDatum.pData = (PConstBuffer) &(vals[(i - 3) % nKeys]);
00983             keyValDatum.cbData = sizeof(uint64_t);
00984             pDynamicParamManager->writeParam(DynamicParamId(i), keyValDatum);
00985         }
00986     }
00987 
00988     ExecStreamEmbryo indexScanStreamEmbryo;
00989     indexScanStreamEmbryo.init(new LbmSearchExecStream(), indexScanParams);
00990     indexScanStreamEmbryo.getStream()->setName("IndexScanStream");
00991 
00992     SharedExecStream pOutputStream = prepareTransformGraph(
00993         valuesStreamEmbryo, indexScanStreamEmbryo);
00994 
00995     bitmapTupleAccessor.setCurrentTupleBuf(expectedBitmaps);
00996     verifyBufferedOutput(
00997         *pOutputStream, bitmapTupleDesc, expectedNBitmaps, expectedBitmaps);
00998 }

void LbmSearchTest::initEqualSearch ( uint  nKeys,
uint  nInputTuples,
boost::scoped_array< uint64_t > &  vals,
char &  lowerDirective,
char &  upperDirective,
TupleAccessor inputTupleAccessor,
TupleData inputTupleData,
boost::shared_array< FixedBuffer > &  inputBuffer,
bool  useDynamicKeys 
) [protected]

Initializes input search key and directives for an equality search.

Parameters:
nKeys number of keys to search on
nInputTuples number of search ranges to create
vals values to search on
lowerDirective lower bound search directive
upperDirective upper bound search directive
inputTupleAccessor accessor to marshal/unmarshal search key
inputTupleData tupledata storing search key
inputBuffer buffer storing search key
useDynamicKeys if true, search key values are passed to the search stream using dynamic parameters

Definition at line 507 of file LbmSearchTest.cpp.

References attrDesc_char1, attrDesc_nullableInt64, TupleAccessor::compute(), TupleData::compute(), FixedBuffer, and TupleAccessor::getMaxByteCount().

Referenced by testScanFullKey(), and testScanPartialKey().

00513 {
00514     TupleDescriptor inputTupleDesc;
00515     for (uint i = 0; i < 2; i++) {
00516         inputTupleDesc.push_back(attrDesc_char1);
00517         for (uint j = 0; j < nKeys; j++) {
00518             inputTupleDesc.push_back(attrDesc_nullableInt64);
00519         }
00520     }
00521 
00522     inputTupleData.compute(inputTupleDesc);
00523 
00524     vals.reset(new uint64_t[nKeys]);
00525     lowerDirective = '[';
00526     inputTupleData[0].pData = (PConstBuffer) &lowerDirective;
00527     upperDirective = ']';
00528     inputTupleData[nKeys + 1].pData = (PConstBuffer) &upperDirective;
00529     for (uint i = 0; i < nKeys; i++) {
00530         // If keys are being passed through dynamic parameters, set them to
00531         // NULL in the input row
00532         if (useDynamicKeys) {
00533             inputTupleData[i + 1].pData = NULL;
00534             inputTupleData[i + 1].cbData = 0;
00535             inputTupleData[nKeys + 1 + i + 1].pData = NULL;
00536             inputTupleData[nKeys + 1 + i + 1].cbData = 0;
00537         } else {
00538             inputTupleData[i + 1].pData = (PConstBuffer) &vals[i];
00539             inputTupleData[nKeys + 1 + i + 1].pData = (PConstBuffer) &vals[i];
00540         }
00541     }
00542 
00543     inputTupleAccessor.compute(inputTupleDesc);
00544 
00545     inputBuffer.reset(
00546         new FixedBuffer[nInputTuples * inputTupleAccessor.getMaxByteCount()]);
00547 }

void LbmSearchTest::setSearchKey ( char  lowerDirective,
char  upperDirective,
uint64_t  lowerVal,
uint64_t  upperVal,
PBuffer  inputBuf,
uint offset,
TupleAccessor inputTupleAccessor,
TupleData inputTupleData 
) [protected]

Definition at line 372 of file LbmSearchTest.cpp.

References TupleAccessor::getCurrentByteCount(), and TupleAccessor::marshal().

Referenced by testMultipleRanges().

00376 {
00377     inputTupleData[0].pData = (PConstBuffer) &lowerDirective;
00378     inputTupleData[2].pData = (PConstBuffer) &upperDirective;
00379     if (lowerDirective != '-') {
00380         inputTupleData[1].pData = (PConstBuffer) &lowerVal;
00381     }
00382     if (upperDirective != '+') {
00383         inputTupleData[3].pData = (PConstBuffer) &upperVal;
00384     }
00385     inputTupleAccessor.marshal(inputTupleData, inputBuf + offset);
00386     offset += inputTupleAccessor.getCurrentByteCount();
00387 }

void LbmSearchTest::testCaseSetUp (  )  [virtual]

Equivalent to JUnit TestCase.setUp; this is called before each test case method is invoked.

Default is no-op.

Reimplemented from LbmExecStreamTestBase.

Definition at line 855 of file LbmSearchTest.cpp.

References attrDesc_char1, attrDesc_nullableInt64, StandardTypeDescriptorFactory::newDataType(), STANDARD_TYPE_CHAR, STANDARD_TYPE_INT_64, LbmExecStreamTestBase::stdTypeFactory, and LbmExecStreamTestBase::testCaseSetUp().

void LbmSearchTest::testCaseTearDown (  )  [virtual]

Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked.

Default is no-op.

Reimplemented from ExecStreamTestBase.

Definition at line 866 of file LbmSearchTest.cpp.

References bTreeBitmaps, bTreeClusters, savedBTreeBitmapRootIds, savedBTreeClusterRootIds, and ExecStreamTestBase::testCaseTearDown().

00867 {
00868     for (uint i = 0; i < bTreeClusters.size(); i++) {
00869         bTreeClusters[i]->segmentAccessor.reset();
00870     }
00871     for (uint i = 0; i < bTreeBitmaps.size(); i++) {
00872         bTreeBitmaps[i]->segmentAccessor.reset();
00873     }
00874     bTreeClusters.clear();
00875     bTreeBitmaps.clear();
00876     savedBTreeClusterRootIds.clear();
00877     savedBTreeBitmapRootIds.clear();
00878 
00879     LbmExecStreamTestBase::testCaseTearDown();
00880 }

void LbmSearchTest::testScans ( uint  nRows  ) 

Definition at line 264 of file LbmSearchTest.cpp.

References loadTableAndIndex(), testScanFullKey(), and testScanPartialKey().

Referenced by testScanOneLevel(), and testScanTwoLevel().

00265 {
00266     uint nClusters = 3;
00267     std::vector<int> repeatSeqValues;
00268 
00269     // load the data
00270     repeatSeqValues.push_back(1);
00271     repeatSeqValues.push_back(5);
00272     repeatSeqValues.push_back(9);
00273     loadTableAndIndex(nRows, nClusters, repeatSeqValues, true);
00274 
00275     // Scan on all keys, passing the search keys through the input stream.
00276     // Then do the same, passing the keys via dynamic parameters.  Then,
00277     // finally, do the search, including a rid search.
00278     testScanFullKey(nRows, nClusters, repeatSeqValues, false, false);
00279     testScanFullKey(nRows, nClusters, repeatSeqValues, true, false);
00280     testScanFullKey(nRows, nClusters, repeatSeqValues, false, true);
00281 
00282     // scan on (nClusters - 1) keys
00283     testScanPartialKey(nRows, nClusters, repeatSeqValues);
00284 }

void LbmSearchTest::testScanOneLevel (  ) 

Definition at line 252 of file LbmSearchTest.cpp.

References testScans().

Referenced by LbmSearchTest().

00253 {
00254     // single level btree
00255     testScans(100);
00256 }

void LbmSearchTest::testScanTwoLevel (  ) 

Definition at line 258 of file LbmSearchTest.cpp.

References testScans().

Referenced by LbmSearchTest().

00259 {
00260     // with a 3-key index, 2000 rows will generate a 2-level btree
00261     testScans(2000);
00262 }

void LbmSearchTest::testMultipleRanges (  ) 

Definition at line 286 of file LbmSearchTest.cpp.

References attrDesc_char1, attrDesc_nullableInt64, TupleAccessor::compute(), FixedBuffer, LbmExecStreamTestBase::generateBitmaps(), TupleAccessor::getMaxByteCount(), loadTableAndIndex(), ExecStreamUnitTestBase::resetExecStreamTest(), setSearchKey(), testScanFullKey(), and testScanIdx().

Referenced by LbmSearchTest().

00287 {
00288     uint nRows = 20000;
00289     uint nClusters = 1;
00290     std::vector<int> repeatSeqValues;
00291 
00292     // load a table with a single index on a single column
00293     repeatSeqValues.push_back(100);
00294     loadTableAndIndex(nRows, nClusters, repeatSeqValues, true);
00295 
00296     // scan on all keys, just to make sure all key values really are there
00297     testScanFullKey(nRows, nClusters, repeatSeqValues, false, false);
00298 
00299     resetExecStreamTest();
00300 
00301     // Setup the following search keys.  Note that these keys weren't randomly
00302     // selected.  Some of them correspond to boundary conditions.
00303     // 1. key < 8
00304     // 2. key > 10 && key <= 17
00305     // 3. key >= 44 and key < 60
00306     // 4. key > 71
00307 
00308     TupleDescriptor inputTupleDesc;
00309     for (uint i = 0; i < 2; i++) {
00310         inputTupleDesc.push_back(attrDesc_char1);
00311         inputTupleDesc.push_back(attrDesc_nullableInt64);
00312     }
00313     TupleData inputTupleData(inputTupleDesc);
00314     TupleAccessor inputTupleAccessor;
00315     inputTupleAccessor.compute(inputTupleDesc);
00316 
00317     uint nInputTuples = 4;
00318     boost::shared_array<FixedBuffer> inputBuffer;
00319     inputBuffer.reset(
00320         new FixedBuffer[nInputTuples * inputTupleAccessor.getMaxByteCount()]);
00321     PBuffer inputBuf = inputBuffer.get();
00322     uint offset = 0;
00323 
00324     setSearchKey(
00325         '-', ')', 0, 8, inputBuf, offset, inputTupleAccessor, inputTupleData);
00326     setSearchKey(
00327         '(', ']', 10, 17, inputBuf, offset, inputTupleAccessor,
00328         inputTupleData);
00329     setSearchKey(
00330         '[', ')', 44, 60, inputBuf, offset, inputTupleAccessor,
00331         inputTupleData);
00332     setSearchKey(
00333         '(', '+', 71, 0, inputBuf, offset, inputTupleAccessor,
00334         inputTupleData);
00335 
00336     // setup the expected bitmap result values
00337     boost::scoped_array<FixedBuffer> expectedBitmaps;
00338     uint bufferSize = ((nRows / repeatSeqValues[0] / 8 + 1) * 60) * 24;
00339     expectedBitmaps.reset(new FixedBuffer[bufferSize]);
00340     PBuffer bitmapBuf = expectedBitmaps.get();
00341     uint expectedNBitmaps = 0;
00342     uint expectedBufSize = 0;
00343     // for each range, generate the bitmap values for each key in the desired
00344     // range
00345     for (uint i = 0; i < 8; i++) {
00346         generateBitmaps(
00347             nRows, i, repeatSeqValues[0], bitmapBuf, expectedBufSize,
00348             bufferSize, expectedNBitmaps);
00349     }
00350     for (uint i = 11; i <= 17; i++) {
00351         generateBitmaps(
00352             nRows, i, repeatSeqValues[0], bitmapBuf, expectedBufSize,
00353             bufferSize, expectedNBitmaps);
00354     }
00355     for (uint i = 44; i < 60; i++) {
00356         generateBitmaps(
00357             nRows, i, repeatSeqValues[0], bitmapBuf, expectedBufSize,
00358             bufferSize, expectedNBitmaps);
00359     }
00360     for (uint i = 72; i < repeatSeqValues[0]; i++) {
00361         generateBitmaps(
00362             nRows, i, repeatSeqValues[0], bitmapBuf, expectedBufSize,
00363             bufferSize, expectedNBitmaps);
00364     }
00365 
00366     boost::scoped_array<uint64_t> vals;
00367     testScanIdx(
00368         nClusters, nClusters, offset, inputBuffer, expectedNBitmaps,
00369         bitmapBuf, true, false, false, vals);
00370 }

static const std::string& LbmExecStreamTestBase::getTraceName (  )  [inline, static, protected, inherited]

Definition at line 300 of file LbmExecStreamTestBase.h.

References traceName.

Referenced by LbmExecStreamTestBase::generateBitmaps().

00301     {
00302         return traceName;
00303     }

void LbmExecStreamTestBase::initBitmapInput ( BitmapInput bmInput,
uint  nRows,
InputData const &  inputData 
) [protected, inherited]

Definition at line 27 of file LbmExecStreamTestBase.cpp.

References NumberStream::BIG_NUMBER, InputData::bitmapSize, LbmNumberStreamInput::bitmapSize, opaqueToInt(), LbmNumberStreamInput::pStream, InputData::skipRows, and InputData::startRid.

Referenced by LbmIntersectExecStreamTest::testIntersect(), LbmMinusExecStreamTest::testMinus(), LbmMinusExecStreamTest::testRestartingMinus(), and LbmUnionExecStreamTest::testUnion().

00029 {
00030     LbmNumberStreamInput input;
00031     SharedNumberStream pNumberStream(
00032         new SkipNumberStream(
00033             opaqueToInt(inputData.startRid),
00034             NumberStream::BIG_NUMBER, inputData.skipRows));
00035     input.pStream = pNumberStream;
00036     input.bitmapSize = inputData.bitmapSize;
00037 
00038     initBitmapInput(bmInput, nRows, input);
00039 }

void LbmExecStreamTestBase::initBitmapInput ( BitmapInput bmInput,
uint  nRows,
LbmNumberStreamInput  input 
) [protected, inherited]

Definition at line 41 of file LbmExecStreamTestBase.cpp.

References BitmapInput::bufArray, BitmapInput::currBufSize, FixedBuffer, BitmapInput::fullBufSize, LbmExecStreamTestBase::generateBitmaps(), BitmapInput::nBitmaps, and LbmNumberStreamInput::pStream.

00043 {
00044     bmInput.fullBufSize = input.pStream->getMaxRowCount(nRows) * 16;
00045     bmInput.bufArray.reset(new FixedBuffer[bmInput.fullBufSize]);
00046     bmInput.nBitmaps = 0;
00047     bmInput.currBufSize = 0;
00048     generateBitmaps(nRows, input, bmInput);
00049 }

void LbmExecStreamTestBase::generateBitmaps ( uint  nRows,
LbmNumberStreamInput  input,
BitmapInput bmInput 
) [protected, inherited]

Definition at line 51 of file LbmExecStreamTestBase.cpp.

References LbmExecStreamTestBase::bitmapColSize, LbmNumberStreamInput::bitmapSize, LbmExecStreamTestBase::bitmapTupleAccessor, LbmExecStreamTestBase::bitmapTupleData, LbmExecStreamTestBase::bitmapTupleDesc, BitmapInput::currBufSize, FixedBuffer, BitmapInput::fullBufSize, LbmEntry::getScratchBufferSize(), TestBase::getSourceTraceLevel(), LbmExecStreamTestBase::getTraceName(), LbmEntry::init(), opaqueToInt(), LbmExecStreamTestBase::produceEntry(), LbmNumberStreamInput::pStream, LbmEntry::setEntryTuple(), LbmEntry::setRID(), and TRACE_FINER.

Referenced by LbmExecStreamTestBase::initBitmapInput(), LbmExecStreamTestBase::initKeyBitmap(), testMultipleRanges(), testScanFullKey(), and testScanPartialKey().

00053 {
00054     LbmEntry lbmEntry;
00055     boost::scoped_array<FixedBuffer> entryBuf;
00056     LcsRid rid = LcsRid(input.pStream->getNext());
00057 
00058     // setup an LbmEntry with the initial rid value
00059     uint scratchBufSize = LbmEntry::getScratchBufferSize(bitmapColSize);
00060     entryBuf.reset(new FixedBuffer[scratchBufSize]);
00061     lbmEntry.init(entryBuf.get(), NULL, scratchBufSize, bitmapTupleDesc);
00062     bitmapTupleData[0].pData = (PConstBuffer) &rid;
00063     lbmEntry.setEntryTuple(bitmapTupleData);
00064     TraceLevel level = getSourceTraceLevel(getTraceName());
00065     if (level <= TRACE_FINER) {
00066         std::cout << "Set root: " << rid << std::endl;
00067     }
00068 
00069     // add on the remaining rids
00070     while (input.pStream->hasNext()) {
00071         rid = LcsRid(input.pStream->getNext());
00072         if (rid >= LcsRid(nRows)) {
00073             break;
00074         }
00075         if (level <= TRACE_FINER) {
00076             std::cout << "Set value: " << rid << std::endl;
00077         }
00078         if ((rid > LcsRid(0) &&
00079                 opaqueToInt(rid % (input.bitmapSize*8)) == 0) ||
00080             !lbmEntry.setRID(LcsRid(rid)))
00081         {
00082             // either hit desired number of rids per bitmap segment or
00083             // exhausted buffer space, so write the tuple to the output
00084             // buffer and reset LbmEntry
00085             produceEntry(lbmEntry, bitmapTupleAccessor, bmInput);
00086             lbmEntry.setEntryTuple(bitmapTupleData);
00087         }
00088     }
00089     // write out the last LbmEntry
00090     produceEntry(lbmEntry, bitmapTupleAccessor, bmInput);
00091 
00092     assert(bmInput.currBufSize <= bmInput.fullBufSize);
00093 }

void LbmExecStreamTestBase::generateBitmaps ( uint  nRows,
uint  start,
uint  skipRows,
PBuffer  pBuf,
uint bufSize,
uint  fullBufSize,
uint nBitmaps,
bool  includeKeys = false 
) [protected, inherited]

Generate bitmaps to used in verifying result of bitmap index scan.

Parameters:
nRows number of rows in index
start initial rid value
skipRows generate rids every "skipRows" rows; i.e., if skipRows == 1, there are no gaps in the rids
pBuf buffer where bitmap segment tuples will be marshalled
bufSize amount of space currently used within pBuf
fullBufSize size of pBuf
nBitmaps returns number of bitmaps generated
includeKeys if true, include the keys in the generated bitmap entry

Definition at line 163 of file LbmExecStreamTestBase.cpp.

References LbmExecStreamTestBase::bitmapColSize, LbmExecStreamTestBase::bitmapTupleAccessor, LbmExecStreamTestBase::bitmapTupleData, LbmExecStreamTestBase::bitmapTupleDesc, FixedBuffer, LbmEntry::getScratchBufferSize(), LbmEntry::init(), LbmExecStreamTestBase::produceEntry(), LbmEntry::setEntryTuple(), and LbmEntry::setRID().

00166 {
00167     LbmEntry lbmEntry;
00168     boost::scoped_array<FixedBuffer> entryBuf;
00169     LcsRid rid = LcsRid(start);
00170 
00171     // setup an LbmEntry with the initial rid value
00172     uint scratchBufSize = LbmEntry::getScratchBufferSize(bitmapColSize);
00173     entryBuf.reset(new FixedBuffer[scratchBufSize]);
00174     lbmEntry.init(entryBuf.get(), NULL, scratchBufSize, bitmapTupleDesc);
00175     bitmapTupleData[0].pData = (PConstBuffer) &rid;
00176     lbmEntry.setEntryTuple(bitmapTupleData);
00177 
00178     // add on the remaining rids
00179     for (rid = LcsRid(start + skipRows); rid < LcsRid(nRows); rid += skipRows) {
00180         if (!lbmEntry.setRID(LcsRid(rid))) {
00181             // exhausted buffer space, so write the tuple to the output
00182             // buffer and reset LbmEntry
00183             produceEntry(
00184                 lbmEntry, bitmapTupleAccessor,
00185                 pBuf, bufSize, nBitmaps, includeKeys);
00186             lbmEntry.setEntryTuple(bitmapTupleData);
00187         }
00188     }
00189     // write out the last LbmEntry
00190     produceEntry(
00191         lbmEntry, bitmapTupleAccessor, pBuf, bufSize, nBitmaps, includeKeys);
00192 
00193     assert(bufSize <= fullBufSize);
00194 }

void LbmExecStreamTestBase::produceEntry ( LbmEntry lbmEntry,
TupleAccessor bitmapTupleAccessor,
BitmapInput bmInput 
) [protected, inherited]

Definition at line 95 of file LbmExecStreamTestBase.cpp.

References LbmExecStreamTestBase::bitmapTupleAccessor, BitmapInput::bufArray, BitmapInput::currBufSize, TupleAccessor::getCurrentByteCount(), TupleAccessor::marshal(), BitmapInput::nBitmaps, and LbmEntry::produceEntryTuple().

Referenced by LbmExecStreamTestBase::generateBitmaps().

00098 {
00099     TupleData bitmapTuple = lbmEntry.produceEntryTuple();
00100     bitmapTupleAccessor.marshal(
00101         bitmapTuple, bmInput.bufArray.get() + bmInput.currBufSize);
00102     bmInput.currBufSize += bitmapTupleAccessor.getCurrentByteCount();
00103     ++bmInput.nBitmaps;
00104 }

void LbmExecStreamTestBase::produceEntry ( LbmEntry lbmEntry,
TupleAccessor bitmapTupleAccessor,
PBuffer  pBuf,
uint bufSize,
uint nBitmaps,
bool  includeKeys 
) [protected, inherited]

Definition at line 196 of file LbmExecStreamTestBase.cpp.

References LbmExecStreamTestBase::bitmapTupleAccessor, LbmExecStreamTestBase::bitmapTupleData, TupleAccessor::getCurrentByteCount(), LbmExecStreamTestBase::keyBitmapTupleAccessor, LbmExecStreamTestBase::keyBitmapTupleData, TupleAccessor::marshal(), and LbmEntry::produceEntryTuple().

00199 {
00200     TupleData bitmapTuple = lbmEntry.produceEntryTuple();
00201     if (includeKeys) {
00202         int nKeys = keyBitmapTupleData.size() - bitmapTuple.size();
00203         assert(nKeys > 0);
00204         for (uint i = 0; i < bitmapTupleData.size(); i++) {
00205             keyBitmapTupleData[nKeys + i] = bitmapTuple[i];
00206         }
00207         keyBitmapTupleAccessor.marshal(keyBitmapTupleData, pBuf + bufSize);
00208         bufSize += keyBitmapTupleAccessor.getCurrentByteCount();
00209     } else {
00210         bitmapTupleAccessor.marshal(bitmapTuple, pBuf + bufSize);
00211         bufSize += bitmapTupleAccessor.getCurrentByteCount();
00212     }
00213     ++nBitmaps;
00214 }

void LbmExecStreamTestBase::initValuesExecStream ( uint  idx,
ValuesExecStreamParams valuesParams,
ExecStreamEmbryo valuesStreamEmbryo,
BitmapInput bmInput 
) [protected, inherited]

Definition at line 106 of file LbmExecStreamTestBase.cpp.

References LbmExecStreamTestBase::bitmapTupleDesc, BitmapInput::bufArray, ValuesExecStreamParams::bufSize, BitmapInput::currBufSize, ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), SingleOutputExecStreamParams::outputTupleDesc, and ValuesExecStreamParams::pTupleBuffer.

Referenced by LbmIntersectExecStreamTest::testIntersect(), LbmMinusExecStreamTest::testMinus(), LbmMinusExecStreamTest::testRestartingMinus(), and LbmUnionExecStreamTest::testUnion().

00109 {
00110     valuesParams.outputTupleDesc = bitmapTupleDesc;
00111     valuesParams.pTupleBuffer = bmInput.bufArray;
00112     valuesParams.bufSize = bmInput.currBufSize;
00113 
00114     valuesStreamEmbryo.init(new ValuesExecStream(), valuesParams);
00115     std::ostringstream oss;
00116     oss << "InputValuesExecStream" << "#" << idx;
00117     valuesStreamEmbryo.getStream()->setName(oss.str());
00118 }

void LbmExecStreamTestBase::initSorterExecStream ( ExternalSortExecStreamParams params,
ExecStreamEmbryo embryo,
TupleDescriptor const &  outputDesc,
uint  nKeys = 1 
) [protected, inherited]

Definition at line 120 of file LbmExecStreamTestBase.cpp.

References ExternalSortExecStreamParams::distinctness, DUP_ALLOW, ExternalSortExecStreamParams::earlyClose, ExternalSortExecStreamParams::estimatedNumRows, ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), ExternalSortExecStreamParams::keyProj, MAXU, ExternalSortExecStream::newExternalSortExecStream(), CacheTestBase::pCache, SegStorageTestBase::pRandomSegment, SegStorageTestBase::pSegmentFactory, ExternalSortExecStreamParams::pTempSegment, and ExternalSortExecStreamParams::storeFinalRun.

Referenced by LbmSortedAggExecStreamTest::testSortedAgg(), and LbmUnionExecStreamTest::testUnion().

00125 {
00126     params.outputTupleDesc = outputDesc;
00127     params.distinctness = DUP_ALLOW;
00128     params.pTempSegment = pRandomSegment;
00129     params.pCacheAccessor = pCache;
00130     params.scratchAccessor =
00131         pSegmentFactory->newScratchSegment(pCache, 10);
00132     params.keyProj.clear();
00133     for (uint i = 0; i < nKeys; i++) {
00134         params.keyProj.push_back(i);
00135     }
00136     params.storeFinalRun = false;
00137     params.estimatedNumRows = MAXU;
00138     params.earlyClose = false;
00139 
00140     embryo.init(ExternalSortExecStream::newExternalSortExecStream(), params);
00141     embryo.getStream()->setName("SorterExecStream");
00142 }

void LbmExecStreamTestBase::initNormalizerExecStream ( LbmNormalizerExecStreamParams params,
ExecStreamEmbryo embryo,
uint  nKeys 
) [protected, inherited]

Definition at line 144 of file LbmExecStreamTestBase.cpp.

References ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), LbmExecStreamTestBase::keyBitmapTupleDesc, LbmNormalizerExecStreamParams::keyProj, and TupleDescriptor::projectFrom().

Referenced by LbmNormalizerExecStreamTest::testNormalizer(), and LbmMinusExecStreamTest::testRestartingMinus().

00148 {
00149     TupleProjection keyProj;
00150     for (int i = 0; i < nKeys; i++) {
00151         keyProj.push_back(i);
00152     }
00153     params.keyProj = keyProj;
00154 
00155     TupleDescriptor keyDesc;
00156     keyDesc.projectFrom(keyBitmapTupleDesc, keyProj);
00157     params.outputTupleDesc = keyDesc;
00158 
00159     embryo.init(new LbmNormalizerExecStream(), params);
00160     embryo.getStream()->setName("Normalizer");
00161 }

uint LbmExecStreamTestBase::resultBitmapSize ( uint  start,
uint  end 
) [inline, protected, inherited]

Calculates size of result bitmap.

Parameters:
start start of result range, inclusive
end end of result range, exclusive

Definition at line 339 of file LbmExecStreamTestBase.h.

Referenced by LbmMinusExecStreamTest::test2Inputs(), LbmIntersectExecStreamTest::test2Inputs(), LbmMinusExecStreamTest::test3Inputs(), LbmIntersectExecStreamTest::test3Inputs(), LbmMinusExecStreamTest::testAnchorLarger1(), LbmMinusExecStreamTest::testAnchorLarger2(), LbmMinusExecStreamTest::testChildrenLarger(), LbmIntersectExecStreamTest::testGaps(), LbmIntersectExecStreamTest::testLargeInputs(), LbmMinusExecStreamTest::testLargeOutput(), LbmIntersectExecStreamTest::testLargeOutput(), LbmIntersectExecStreamTest::testSingleBitmaps(), LbmUnionExecStreamTest::testUnion(), and LbmIntersectExecStreamTest::testZeros().

00340     {
00341         return resultBitmapSize(end - start);
00342     }

uint LbmExecStreamTestBase::resultBitmapSize ( uint  nRids  )  [inline, protected, inherited]

Definition at line 344 of file LbmExecStreamTestBase.h.

00345     {
00346         // the result bitmap should be large enough for all rids in range,
00347         // nRids/8, plus extra space that allows the segment builder some
00348         // breathing room to operate
00349         uint extraSpace = 16;
00350         return (nRids / 8) + extraSpace;
00351     }

void LbmExecStreamTestBase::initKeyBitmap ( uint  nRows,
std::vector< int > const &  repeatSeqValues 
) [protected, inherited]

Initialize bitmaps with keys.

Definition at line 216 of file LbmExecStreamTestBase.cpp.

References LbmExecStreamTestBase::attrDesc_int64, LbmExecStreamTestBase::bitmapTupleDesc, TupleData::compute(), TupleAccessor::compute(), FixedBuffer, LbmExecStreamTestBase::generateBitmaps(), TupleAccessor::getMaxByteCount(), LbmExecStreamTestBase::getTupleInterval(), LbmExecStreamTestBase::keyBitmapBuf, LbmExecStreamTestBase::keyBitmapBufSize, LbmExecStreamTestBase::keyBitmapTupleAccessor, LbmExecStreamTestBase::keyBitmapTupleData, and LbmExecStreamTestBase::keyBitmapTupleDesc.

Referenced by LbmNormalizerExecStreamTest::testNormalizer(), LbmMinusExecStreamTest::testRestartingMinus(), and LbmSortedAggExecStreamTest::testSortedAgg().

00219 {
00220     // find the interval for which the entire tuple's sequence repeats
00221     uint skipRows = getTupleInterval(repeatSeqValues);
00222 
00223     // generate a key bitmap for each distinct input value...
00224     // configure descriptor
00225     uint nInputKeys = repeatSeqValues.size();
00226     keyBitmapTupleDesc.clear();
00227     for (uint i = 0; i < nInputKeys; i++) {
00228         keyBitmapTupleDesc.push_back(attrDesc_int64);
00229     }
00230     for (uint i = 0; i < bitmapTupleDesc.size(); i++) {
00231         keyBitmapTupleDesc.push_back(bitmapTupleDesc[i]);
00232     }
00233 
00234     // configure accessor and key data (bitmap data handled elsewhere)
00235     keyBitmapTupleAccessor.compute(keyBitmapTupleDesc);
00236     keyBitmapTupleData.compute(keyBitmapTupleDesc);
00237     boost::scoped_array<uint64_t> vals(new uint64_t[nInputKeys]);
00238     for (uint i = 0; i < nInputKeys; i++) {
00239         keyBitmapTupleData[i].pData = (PConstBuffer) &vals[i];
00240     }
00241 
00242     uint fullBufSize = nRows * keyBitmapTupleAccessor.getMaxByteCount();
00243     keyBitmapBuf.reset(new FixedBuffer[fullBufSize]);
00244     PBuffer pBuf = keyBitmapBuf.get();
00245     keyBitmapBufSize = 0;
00246     uint nBitmaps = 0;
00247     for (uint i = 0; i < skipRows; i++) {
00248         // generate input keys
00249         for (uint j = 0; j < nInputKeys; j++) {
00250             vals[j] = i % repeatSeqValues[j];
00251         }
00252         generateBitmaps(
00253             nRows, i, skipRows, pBuf, keyBitmapBufSize,
00254             fullBufSize, nBitmaps, true);
00255     }
00256 }

uint LbmExecStreamTestBase::getTupleInterval ( std::vector< int > const &  repeatSeqValues,
uint  nKeys = 0 
) [static, inherited]

Find the interval for which an entire tuple's sequence repeats.

Definition at line 261 of file LbmExecStreamTestBase.cpp.

Referenced by LbmExecStreamTestBase::initKeyBitmap(), NormalizerExecStreamGenerator::NormalizerExecStreamGenerator(), RestartingMinusExecStreamGenerator::RestartingMinusExecStreamGenerator(), SortedAggExecStreamGenerator::SortedAggExecStreamGenerator(), and LbmSortedAggExecStreamTest::testSortedAgg().

00263 {
00264     if (nKeys == 0) {
00265         nKeys = repeatSeqValues.size();
00266     }
00267     uint interval = 1;
00268     for (uint i = 0; i < nKeys; i++) {
00269         interval *= repeatSeqValues[i];
00270     }
00271     return interval;
00272 }

SharedExecStream ExecStreamUnitTestBase::prepareSourceGraph ( ExecStreamEmbryo sourceStreamEmbryo  )  [protected, inherited]

Defines and prepares a graph consisting of one source stream.

Parameters:
sourceStreamEmbryo embryonic source stream which produces tuples
Returns:
output buffer stream

Definition at line 41 of file ExecStreamUnitTestBase.cpp.

References ExecStreamUnitTestBase::prepareTransformGraph().

Referenced by FlatFileExecStreamTest::testStream().

00043 {
00044     std::vector<ExecStreamEmbryo> transforms;
00045     return prepareTransformGraph(sourceStreamEmbryo, transforms);
00046 }

SharedExecStream ExecStreamUnitTestBase::prepareTransformGraph ( ExecStreamEmbryo sourceStreamEmbryo,
ExecStreamEmbryo transformStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of one source stream and one transform stream.

Parameters:
sourceStreamEmbryo embryonic source stream which produces tuples
transformStreamEmbryo embryonic transform stream which processes tuples produced by sourceStreamEmbryo
Returns:
output buffer stream

Definition at line 48 of file ExecStreamUnitTestBase.cpp.

Referenced by LcsClusterReplaceExecStreamTest::loadCluster(), LcsRowScanExecStreamTest::loadOneCluster(), ExecStreamUnitTestBase::prepareSourceGraph(), LcsClusterReplaceExecStreamTest::replaceCluster(), LcsMultiClusterAppendTest::scanCols(), LbmSplicerExecStreamTest::spliceInput(), ExecStreamTestSuite::testBTreeInsertExecStream(), CollectExecStreamTestSuite::testCollectCollectUncollectUncollect(), CollectExecStreamTestSuite::testCollectInts(), CollectExecStreamTestSuite::testCollectUncollect(), CalcExecStreamTestSuite::testConstant(), ExecStreamTestSuite::testCopyExecStream(), ExecStreamTestSuite::testCountAggExecStream(), LhxAggExecStreamTest::testCountImpl(), ExecStreamTestSuite::testDoubleBufferExecStream(), ExecStreamTestSuite::testGroupAggExecStreamNrows(), LhxAggExecStreamTest::testGroupCountImpl(), ExternalSortExecStreamTest::testImpl(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), LbmNormalizerExecStreamTest::testNormalizer(), ExecStreamTestSuite::testReshapeExecStream(), LcsRowScanExecStreamTest::testSampleScanCols(), LcsRowScanExecStreamTest::testScanCols(), testScanIdx(), LcsClusterAppendExecStreamTest::testScanMultiCol(), LcsClusterAppendExecStreamTest::testScanSingleCol(), ExecStreamTestSuite::testScratchBufferExecStream(), ExecStreamTestSuite::testSegBufferExecStream(), ExecStreamTestSuite::testSingleValueAggExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), LbmSortedAggExecStreamTest::testSortedAgg(), ExecStreamTestSuite::testSumAggExecStream(), LhxAggExecStreamTest::testSumImpl(), LbmUnionExecStreamTest::testUnion(), and LcsClusterReplaceExecStreamTest::verifyCluster().

00051 {
00052     std::vector<ExecStreamEmbryo> transforms;
00053     transforms.push_back(transformStreamEmbryo);
00054     return prepareTransformGraph(sourceStreamEmbryo, transforms);
00055 }

SharedExecStream ExecStreamUnitTestBase::prepareTransformGraph ( ExecStreamEmbryo sourceStreamEmbryo,
std::vector< ExecStreamEmbryo > &  transforms 
) [protected, inherited]

Defines and prepares a graph consisting of one source stream and one or multiple transform streams.

Parameters:
sourceStreamEmbryo embryonic source stream which produces tuples
transforms embryonic transform streams which process tuples produced by sourceStreamEmbryo or a child stream
Returns:
output buffer stream

Definition at line 57 of file ExecStreamUnitTestBase.cpp.

References BUFPROV_PRODUCER, ExecStreamEmbryo::getStream(), ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

00060 {
00061     pGraphEmbryo->saveStreamEmbryo(sourceStreamEmbryo);
00062     std::vector<ExecStreamEmbryo>::iterator it;
00063 
00064     // save all transforms
00065     for (it = transforms.begin(); it != transforms.end(); ++it) {
00066         pGraphEmbryo->saveStreamEmbryo(*it);
00067     }
00068 
00069     // connect streams in a cascade
00070     ExecStreamEmbryo& previousStream = sourceStreamEmbryo;
00071     for (it = transforms.begin(); it != transforms.end(); ++it) {
00072         pGraphEmbryo->addDataflow(
00073             previousStream.getStream()->getName(),
00074             (*it).getStream()->getName());
00075         previousStream = *it;
00076     }
00077 
00078     SharedExecStream pAdaptedStream =
00079         pGraphEmbryo->addAdapterFor(
00080             previousStream.getStream()->getName(),
00081             0,
00082             BUFPROV_PRODUCER);
00083     pGraph->addOutputDataflow(pAdaptedStream->getStreamId());
00084 
00085     pGraphEmbryo->prepareGraph(shared_from_this(), "");
00086     return pAdaptedStream;
00087 }

SharedExecStream ExecStreamUnitTestBase::prepareConfluenceGraph ( ExecStreamEmbryo sourceStreamEmbryo1,
ExecStreamEmbryo sourceStreamEmbryo2,
ExecStreamEmbryo confluenceStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of two source streams and one confluence stream.

Parameters:
sourceStreamEmbryo1 embryonic source stream which produces tuples
sourceStreamEmbryo2 embryonic source stream which produces tuples
confluenceStreamEmbryo embryonic confluence stream which processes tuples produced by the sourceStreamEmbryos
Returns:
output buffer stream

Definition at line 89 of file ExecStreamUnitTestBase.cpp.

Referenced by ExecStreamUnitTestBase::prepareConfluenceGraph(), ExecStreamTestSuite::testCartesianJoinExecStream(), CorrelationJoinExecStreamTestSuite::testCorrelationJoin(), LcsRowScanExecStreamTest::testFilterCols(), ExecStreamGovernorTest::testGovernor(), LhxJoinExecStreamTest::testImpl(), LbmIntersectExecStreamTest::testIntersect(), ExecStreamTestSuite::testMergeExecStream(), LbmMinusExecStreamTest::testMinus(), and ExecStreamTestSuite::testNestedLoopJoinExecStream().

00093 {
00094     std::vector<ExecStreamEmbryo> sourceStreamEmbryos;
00095     sourceStreamEmbryos.push_back(sourceStreamEmbryo1);
00096     sourceStreamEmbryos.push_back(sourceStreamEmbryo2);
00097     return prepareConfluenceGraph(sourceStreamEmbryos, confluenceStreamEmbryo);
00098 }

SharedExecStream ExecStreamUnitTestBase::prepareConfluenceGraph ( std::vector< ExecStreamEmbryo > &  sourceStreamEmbryos,
ExecStreamEmbryo confluenceStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of a list of source streams and one confluence stream.

Parameters:
sourceStreamEmbryos list of embryonic source streams that produce tuples
confluenceStreamEmbryo embryonic confluence stream which processes tuples produced by the sourceStreamEmbryos
Returns:
output buffer stream

Definition at line 155 of file ExecStreamUnitTestBase.cpp.

References ExecStreamUnitTestBase::prepareConfluenceGraph().

00158 {
00159     std::vector<std::vector<ExecStreamEmbryo> > sourceStreamEmbryosList;
00160     std::vector<ExecStreamEmbryo>::iterator it;
00161     std::vector<ExecStreamEmbryo> sourceStreamList;
00162     for (it = sourceStreamEmbryos.begin(); it != sourceStreamEmbryos.end();
00163         it++)
00164     {
00165         sourceStreamList.clear();
00166         sourceStreamList.push_back(*it);
00167         sourceStreamEmbryosList.push_back(sourceStreamList);
00168     }
00169 
00170     return
00171         prepareConfluenceGraph(sourceStreamEmbryosList, confluenceStreamEmbryo);
00172 }

SharedExecStream ExecStreamUnitTestBase::prepareConfluenceGraph ( std::vector< std::vector< ExecStreamEmbryo > > &  sourceStreamEmbryosList,
ExecStreamEmbryo confluenceStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of one or more source streams and one confluence stream.

Each source stream can be a list of streams.

Parameters:
sourceStreamEmbryosList list of embryonic source streams which produce tuples
confluenceStreamEmbryo embryonic confluence stream which processes tuples produced by the source streams
Returns:
output buffer stream

Definition at line 174 of file ExecStreamUnitTestBase.cpp.

References BUFPROV_PRODUCER, ExecStreamEmbryo::getStream(), ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

00177 {
00178     pGraphEmbryo->saveStreamEmbryo(confluenceStreamEmbryo);
00179 
00180     for (int i = 0; i < sourceStreamEmbryosList.size(); i++) {
00181         for (int j = 0; j < sourceStreamEmbryosList[i].size(); j++) {
00182             pGraphEmbryo->saveStreamEmbryo(sourceStreamEmbryosList[i][j]);
00183         }
00184 
00185         // connect streams in each sourceStreamEmbryos list in a cascade
00186         for (int j = 1; j < sourceStreamEmbryosList[i].size(); j++) {
00187             pGraphEmbryo->addDataflow(
00188                 sourceStreamEmbryosList[i][j - 1].getStream()->getName(),
00189                 sourceStreamEmbryosList[i][j].getStream()->getName());
00190         }
00191         pGraphEmbryo->addDataflow(
00192             sourceStreamEmbryosList[i].back().getStream()->getName(),
00193             confluenceStreamEmbryo.getStream()->getName());
00194     }
00195 
00196     SharedExecStream pAdaptedStream =
00197         pGraphEmbryo->addAdapterFor(
00198             confluenceStreamEmbryo.getStream()->getName(), 0,
00199             BUFPROV_PRODUCER);
00200     pGraph->addOutputDataflow(
00201         pAdaptedStream->getStreamId());
00202 
00203     pGraphEmbryo->prepareGraph(shared_from_this(), "");
00204 
00205     return pAdaptedStream;
00206 }

SharedExecStream ExecStreamUnitTestBase::prepareConfluenceTransformGraph ( ExecStreamEmbryo sourceStreamEmbryo1,
ExecStreamEmbryo sourceStreamEmbryo2,
ExecStreamEmbryo confluenceStreamEmbryo,
ExecStreamEmbryo transformStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of two source streams, one confluence stream, and one transform stream.

Parameters:
sourceStreamEmbryo1 embryonic source stream which produces tuples
sourceStreamEmbryo2 embryonic source stream which produces tuples
confluenceStreamEmbryo embryonic confluence stream which processes tuples produced by the sourceStreamEmbryos
transformStreamEmbryo embryonic transform streams which process tuples produced by a child stream
Returns:
output buffer stream

Definition at line 100 of file ExecStreamUnitTestBase.cpp.

References BUFPROV_PRODUCER, ExecStreamEmbryo::getStream(), ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

Referenced by LhxJoinExecStreamTest::testImpl(), and LbmMinusExecStreamTest::testRestartingMinus().

00105 {
00106     std::vector<ExecStreamEmbryo> sourceStreamEmbryos;
00107     sourceStreamEmbryos.push_back(sourceStreamEmbryo1);
00108     sourceStreamEmbryos.push_back(sourceStreamEmbryo2);
00109 
00110     std::vector<ExecStreamEmbryo>::iterator it;
00111 
00112     for (it = sourceStreamEmbryos.begin(); it != sourceStreamEmbryos.end();
00113         ++it)
00114     {
00115         pGraphEmbryo->saveStreamEmbryo(*it);
00116     }
00117     pGraphEmbryo->saveStreamEmbryo(confluenceStreamEmbryo);
00118 
00119     for (it = sourceStreamEmbryos.begin(); it != sourceStreamEmbryos.end();
00120         ++it)
00121     {
00122         pGraphEmbryo->addDataflow(
00123             (*it).getStream()->getName(),
00124             confluenceStreamEmbryo.getStream()->getName());
00125     }
00126 
00127     std::vector<ExecStreamEmbryo> transforms;
00128     transforms.push_back(transformStreamEmbryo);
00129     ExecStreamEmbryo& previousStream = confluenceStreamEmbryo;
00130 
00131     // save all transforms
00132     for (it = transforms.begin(); it != transforms.end(); ++it) {
00133         pGraphEmbryo->saveStreamEmbryo(*it);
00134     }
00135 
00136     for (it = transforms.begin(); it != transforms.end(); ++it) {
00137         pGraphEmbryo->addDataflow(
00138             previousStream.getStream()->getName(),
00139             (*it).getStream()->getName());
00140         previousStream = *it;
00141     }
00142 
00143 
00144     SharedExecStream pAdaptedStream =
00145         pGraphEmbryo->addAdapterFor(
00146             previousStream.getStream()->getName(),
00147             0,
00148             BUFPROV_PRODUCER);
00149     pGraph->addOutputDataflow(pAdaptedStream->getStreamId());
00150 
00151     pGraphEmbryo->prepareGraph(shared_from_this(), "");
00152     return pAdaptedStream;
00153 }

SharedExecStream ExecStreamUnitTestBase::prepareDAG ( ExecStreamEmbryo srcStreamEmbryo,
ExecStreamEmbryo splitterStreamEmbryo,
std::vector< ExecStreamEmbryo > &  interStreamEmbryos,
ExecStreamEmbryo destStreamEmbryo,
bool  createSink = true,
bool  saveSrc = true 
) [protected, inherited]

Defines and prepares a graph consisting of a source, a splitter, and one or more parallel transform streams which flow together into a confluence stream.

Parameters:
srcStreamEmbryo embryonic source stream which produces tuples
splitterStreamEmbryo embryonic SplitterExecStream which produces tuples for multiple consumers
interStreamEmbryos embryonic intermediate streams which transform tuples; each stream consists of a single embryo
destStreamEmbryo embryonic confluence stream which processes tuples produced by the interStreamEmbryos
createSink if true (the default), creates a final output sink in the stream graph
saveSrc if true (the default), save the source in the stream graph; if false, the save has already been done
Returns:
output buffer stream or null stream if createSink is false

Definition at line 208 of file ExecStreamUnitTestBase.cpp.

Referenced by LcsMultiClusterAppendTest::loadClusters(), loadTableAndIndex(), LbmLoadBitmapTest::testLoad(), ExecStreamTestSuite::testMergeImplicitPullInputs(), ExecStreamTestSuite::testSegBufferReaderWriterExecStream(), and ExecStreamTestSuite::testSplitterPlusBarrier().

00215 {
00216     std::vector<std::vector<ExecStreamEmbryo> > listOfList;
00217 
00218     // Convert interStreamEmbryos to a vector of vectors.  E.g., if
00219     // interStreamEmbryos contains (1, 2, 3), it will get converted to:
00220     // ((1)) ((2)) ((3))
00221     for (uint i = 0; i < interStreamEmbryos.size(); i++) {
00222         std::vector<ExecStreamEmbryo> interStreamEmbryoList;
00223 
00224         interStreamEmbryoList.push_back(interStreamEmbryos[i]);
00225         listOfList.push_back(interStreamEmbryoList);
00226     }
00227     return prepareDAG(
00228         srcStreamEmbryo, splitterStreamEmbryo, listOfList, destStreamEmbryo,
00229         createSink, saveSrc);
00230 }

SharedExecStream ExecStreamUnitTestBase::prepareDAG ( ExecStreamEmbryo srcStreamEmbryo,
ExecStreamEmbryo splitterStreamEmbryo,
std::vector< std::vector< ExecStreamEmbryo > > &  interStreamEmbryosList,
ExecStreamEmbryo destStreamEmbryo,
bool  createSink = true,
bool  saveSrc = true 
) [protected, inherited]

Defines and prepares a graph consisting of a source, a splitter, and one or more parallel transform streams which flow together into a confluence stream.

Parameters:
srcStreamEmbryo embryonic source stream which produces tuples
splitterStreamEmbryo embryonic SplitterExecStream which produces tuples for multiple consumers
interStreamEmbryosList one or more embryonic intermediate streams which transform tuples; each stream can have one more embryos
destStreamEmbryo embryonic confluence stream which processes tuples produced by the interStreamEmbryos
createSink if true (the default), creates a final output sink in the stream graph
saveSrc if true (the default), save the source in the stream graph; if false, the save has already been done
Returns:
output buffer stream or null stream if createSink is false

Definition at line 232 of file ExecStreamUnitTestBase.cpp.

References BUFPROV_PRODUCER, ExecStreamEmbryo::getStream(), ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

00239 {
00240     if (saveSrc) {
00241         pGraphEmbryo->saveStreamEmbryo(srcStreamEmbryo);
00242     }
00243     pGraphEmbryo->saveStreamEmbryo(splitterStreamEmbryo);
00244 
00245     // save all intermediate stream embryos
00246     for (int i = 0; i < interStreamEmbryos.size(); i++) {
00247         for (int j = 0; j < interStreamEmbryos[i].size(); j++) {
00248             pGraphEmbryo->saveStreamEmbryo(interStreamEmbryos[i][j]);
00249         }
00250 
00251         // connect streams in each interStreamEmbryos list in a cascade
00252         for (int j = 1; j < interStreamEmbryos[i].size(); j++) {
00253             pGraphEmbryo->addDataflow(
00254                 interStreamEmbryos[i][j - 1].getStream()->getName(),
00255                 interStreamEmbryos[i][j].getStream()->getName());
00256         }
00257     }
00258 
00259     pGraphEmbryo->saveStreamEmbryo(destStreamEmbryo);
00260 
00261     pGraphEmbryo->addDataflow(
00262         srcStreamEmbryo.getStream()->getName(),
00263         splitterStreamEmbryo.getStream()->getName());
00264 
00265     // connect all inter streams to src and dest
00266     for (int i = 0; i < interStreamEmbryos.size(); i++) {
00267         pGraphEmbryo->addDataflow(
00268             splitterStreamEmbryo.getStream()->getName(),
00269             interStreamEmbryos[i][0].getStream()->getName());
00270         pGraphEmbryo->addDataflow(
00271             interStreamEmbryos[i].back().getStream()->getName(),
00272             destStreamEmbryo.getStream()->getName());
00273     }
00274 
00275     SharedExecStream pAdaptedStream;
00276 
00277     if (createSink) {
00278         pAdaptedStream = pGraphEmbryo->addAdapterFor(
00279             destStreamEmbryo.getStream()->getName(), 0,
00280             BUFPROV_PRODUCER);
00281         pGraph->addOutputDataflow(pAdaptedStream->getStreamId());
00282 
00283         pGraphEmbryo->prepareGraph(shared_from_this(), "");
00284     }
00285 
00286     return pAdaptedStream;
00287 }

void ExecStreamUnitTestBase::verifyOutput ( ExecStream stream,
uint  nRowsExpected,
MockProducerExecStreamGenerator verifier,
bool  stopEarly = false 
) [protected, inherited]

Executes the prepared stream graph and verifies that its output matches that produced by a value generator.

Parameters:
stream output stream from which to read
nRowsExpected number of rows expected
verifier generator for expected values
stopEarly if true, stop once nRowsExpected have been fetched, even if more rows are available; this can be used for simulating the cleanup effect of an error in the middle of execution

Definition at line 325 of file ExecStreamUnitTestBase.cpp.

References TupleData::compute(), EXECBUF_EOS, MockProducerExecStreamGenerator::generateValue(), ExecStreamUnitTestBase::pGraph, ExecStreamTestBase::pResourceGovernor, and ExecStreamTestBase::pScheduler.

Referenced by LcsClusterReplaceExecStreamTest::loadCluster(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), loadTableAndIndex(), LcsClusterReplaceExecStreamTest::replaceCluster(), LcsMultiClusterAppendTest::scanCols(), LbmSplicerExecStreamTest::spliceInput(), ExecStreamTestSuite::testBTreeInsertExecStream(), CollectExecStreamTestSuite::testCollectCollectUncollectUncollect(), CollectExecStreamTestSuite::testCollectUncollect(), CorrelationJoinExecStreamTestSuite::testCorrelationJoin(), ExecStreamTestSuite::testCountAggExecStream(), LhxAggExecStreamTest::testCountImpl(), ExecStreamTestSuite::testDoubleBufferExecStream(), LcsRowScanExecStreamTest::testFilterCols(), ExecStreamTestSuite::testGroupAggExecStreamNrows(), LhxAggExecStreamTest::testGroupCountImpl(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), ExecStreamTestSuite::testMergeImplicitPullInputs(), ExecStreamTestSuite::testNestedLoopJoinExecStream(), LbmNormalizerExecStreamTest::testNormalizer(), ExecStreamTestSuite::testReshapeExecStream(), LbmMinusExecStreamTest::testRestartingMinus(), LcsRowScanExecStreamTest::testSampleScanCols(), LcsRowScanExecStreamTest::testScanCols(), LcsClusterAppendExecStreamTest::testScanMultiCol(), LcsClusterAppendExecStreamTest::testScanSingleCol(), ExecStreamTestSuite::testScratchBufferExecStream(), ExecStreamTestSuite::testSingleValueAggExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), LbmSortedAggExecStreamTest::testSortedAgg(), ExecStreamTestSuite::testSplitterPlusBarrier(), ExecStreamTestSuite::testSumAggExecStream(), LhxAggExecStreamTest::testSumImpl(), and LcsClusterReplaceExecStreamTest::verifyCluster().

00330 {
00331     // TODO:  assertions about output tuple
00332 
00333     pResourceGovernor->requestResources(*pGraph);
00334     pGraph->open();
00335     pScheduler->start();
00336     uint nRows = 0;
00337     for (;;) {
00338         ExecStreamBufAccessor &bufAccessor =
00339             pScheduler->readStream(stream);
00340         if (bufAccessor.getState() == EXECBUF_EOS) {
00341             break;
00342         }
00343         BOOST_REQUIRE(bufAccessor.isConsumptionPossible());
00344         const uint nCol =
00345             bufAccessor.getConsumptionTupleAccessor().size();
00346         BOOST_REQUIRE(nCol == bufAccessor.getTupleDesc().size());
00347         BOOST_REQUIRE(nCol >= 1);
00348         TupleData inputTuple;
00349         inputTuple.compute(bufAccessor.getTupleDesc());
00350         for (;;) {
00351             if (!bufAccessor.demandData()) {
00352                 break;
00353             }
00354             BOOST_REQUIRE(nRows < nRowsExpected);
00355             bufAccessor.unmarshalTuple(inputTuple);
00356             for (int col = 0; col < nCol; ++col) {
00357                 int64_t actualValue =
00358                     *reinterpret_cast<int64_t const *>(inputTuple[col].pData);
00359                 int64_t expectedValue = generator.generateValue(nRows, col);
00360                 if (actualValue != expectedValue) {
00361                     std::cout << "(Row, Col) = (" << nRows << ", " << col <<")"
00362                               << std::endl;
00363                     BOOST_CHECK_EQUAL(expectedValue,actualValue);
00364                     return;
00365                 }
00366             }
00367             bufAccessor.consumeTuple();
00368             ++nRows;
00369             if (stopEarly && nRows == nRowsExpected) {
00370                 return;
00371             }
00372         }
00373     }
00374     BOOST_CHECK_EQUAL(nRowsExpected,nRows);
00375 }

void ExecStreamUnitTestBase::verifyConstantOutput ( ExecStream stream,
const TupleData expectedTuple,
uint  nRowsExpected 
) [protected, inherited]

Executes the prepared stream graph and verifies that all output tuples matche an expected and given one.

Parameters:
stream output stream from which to read
expectedTuple 
nRowsExpected 

Definition at line 377 of file ExecStreamUnitTestBase.cpp.

References TupleData::compute(), EXECBUF_EOS, ExecStreamUnitTestBase::pGraph, ExecStreamTestBase::pResourceGovernor, TuplePrinter::print(), and ExecStreamTestBase::pScheduler.

Referenced by ExecStreamTestSuite::testCartesianJoinExecStream(), CollectExecStreamTestSuite::testCollectInts(), CalcExecStreamTestSuite::testConstant(), ExecStreamTestSuite::testCopyExecStream(), ExecStreamGovernorTest::testGovernor(), ExecStreamTestSuite::testMergeExecStream(), ExecStreamTestSuite::testSegBufferExecStream(), and ExecStreamTestSuite::testSegBufferReaderWriterExecStream().

00381 {
00382     // TODO:  assertions about output tuple
00383 
00384     pResourceGovernor->requestResources(*pGraph);
00385     pGraph->open();
00386     pScheduler->start();
00387     uint nRows = 0;
00388     for (;;) {
00389         ExecStreamBufAccessor &bufAccessor =
00390             pScheduler->readStream(stream);
00391         if (bufAccessor.getState() == EXECBUF_EOS) {
00392             break;
00393         }
00394         BOOST_REQUIRE(bufAccessor.isConsumptionPossible());
00395 
00396         if (!bufAccessor.demandData()) {
00397             break;
00398         }
00399         BOOST_REQUIRE(nRows < nRowsExpected);
00400 
00401         TupleData actualTuple;
00402         actualTuple.compute(bufAccessor.getTupleDesc());
00403         bufAccessor.unmarshalTuple(actualTuple);
00404 
00405         int c = bufAccessor.getTupleDesc().compareTuples(
00406                                expectedTuple, actualTuple);
00407         bufAccessor.consumeTuple();
00408         ++nRows;
00409         if (c) {
00410 #if 1
00411             TupleDescriptor statusDesc = bufAccessor.getTupleDesc();
00412             TuplePrinter tuplePrinter;
00413             tuplePrinter.print(std::cout, statusDesc, actualTuple);
00414             tuplePrinter.print(std::cout, statusDesc, expectedTuple);
00415             std::cout << std::endl;
00416 #endif
00417             BOOST_CHECK_EQUAL(0,c);
00418             break;
00419         }
00420     }
00421     BOOST_CHECK_EQUAL(nRowsExpected, nRows);
00422 }

void ExecStreamUnitTestBase::verifyBufferedOutput ( ExecStream stream,
TupleDescriptor  outputTupleDesc,
uint  nRowsExpected,
PBuffer  expectedBuffer 
) [protected, inherited]

Executes the prepared stream graph and verifies the resultant tuples against a set of tuples supplied in an input buffer.

Parameters:
stream output stream from which to read
outputTupleDesc descriptor of expected output tuple
nRowsExpected number of rows expected
expectedBuffer buffer containing expected tuples

Definition at line 424 of file ExecStreamUnitTestBase.cpp.

References TupleDescriptor::compareTuples(), TupleData::compute(), TupleAccessor::compute(), EXECBUF_EOS, TupleAccessor::getCurrentByteCount(), ExecStreamUnitTestBase::pGraph, ExecStreamTestBase::pResourceGovernor, ExecStreamTestBase::pScheduler, TupleAccessor::setCurrentTupleBuf(), and TupleAccessor::unmarshal().

Referenced by LbmIntersectExecStreamTest::testIntersect(), LbmMinusExecStreamTest::testMinus(), testScanIdx(), and LbmUnionExecStreamTest::testUnion().

00429 {
00430     // TODO:  assertions about output tuple
00431 
00432     TupleAccessor expectedOutputAccessor;
00433     expectedOutputAccessor.compute(outputTupleDesc);
00434     TupleData expectedTuple(outputTupleDesc);
00435     uint bufOffset = 0;
00436     pResourceGovernor->requestResources(*pGraph);
00437     pGraph->open();
00438     pScheduler->start();
00439     uint nRows = 0;
00440     for (;;) {
00441         ExecStreamBufAccessor &bufAccessor =
00442             pScheduler->readStream(stream);
00443         if (bufAccessor.getState() == EXECBUF_EOS) {
00444             break;
00445         }
00446         BOOST_REQUIRE(bufAccessor.getTupleDesc() == outputTupleDesc);
00447         BOOST_REQUIRE(bufAccessor.isConsumptionPossible());
00448         const uint nCol =
00449             bufAccessor.getConsumptionTupleAccessor().size();
00450         BOOST_REQUIRE(nCol == bufAccessor.getTupleDesc().size());
00451         BOOST_REQUIRE(nCol >= 1);
00452         TupleData inputTuple;
00453         inputTuple.compute(bufAccessor.getTupleDesc());
00454         for (;;) {
00455             if (!bufAccessor.demandData()) {
00456                 break;
00457             }
00458             BOOST_REQUIRE(nRows < nRowsExpected);
00459             bufAccessor.unmarshalTuple(inputTuple);
00460             expectedOutputAccessor.setCurrentTupleBuf(
00461                 expectedBuffer + bufOffset);
00462             expectedOutputAccessor.unmarshal(expectedTuple);
00463             int c = outputTupleDesc.compareTuples(inputTuple, expectedTuple);
00464             if (c) {
00465                 std::cout << "(Row) = (" << nRows << ")"
00466                     << " -- Tuples don't match"<< std::endl;
00467                 BOOST_CHECK_EQUAL(0,c);
00468                 return;
00469             }
00470             bufAccessor.consumeTuple();
00471             bufOffset += expectedOutputAccessor.getCurrentByteCount();
00472             ++nRows;
00473         }
00474     }
00475     BOOST_CHECK_EQUAL(nRowsExpected,nRows);
00476 }

void ExecStreamUnitTestBase::resetExecStreamTest (  )  [protected, inherited]

Reset stream graph so multiple iterations of a method can be called within a single testcase.

Definition at line 305 of file ExecStreamUnitTestBase.cpp.

References ExecStreamTestBase::newScheduler(), ExecStreamTestBase::newStreamGraph(), ExecStreamTestBase::newStreamGraphEmbryo(), ExecStreamUnitTestBase::pGraph, ExecStreamUnitTestBase::pGraphEmbryo, ExecStreamTestBase::pResourceGovernor, ExecStreamTestBase::pScheduler, and ExecStreamUnitTestBase::tearDownExecStreamTest().

Referenced by LcsRowScanExecStreamTest::loadClusters(), LbmLoadBitmapTest::testAppend(), LcsRowScanExecStreamTest::testBernoulliSampling(), LcsClusterReplaceExecStreamTest::testClusterReplace(), LcsRowScanExecStreamTest::testCompressedFiltering(), LbmSplicerExecStreamTest::testLER5968(), LbmSplicerExecStreamTest::testLER6473(), LcsMultiClusterAppendTest::testLoad(), LcsClusterAppendExecStreamTest::testMultiColConstNewRoot(), LcsClusterAppendExecStreamTest::testMultiColConstOldRoot(), LcsClusterAppendExecStreamTest::testMultiColNoDupNewRoot(), LcsClusterAppendExecStreamTest::testMultiColNoDupOldRoot(), LcsClusterAppendExecStreamTest::testMultiColStairNewRoot(), LcsClusterAppendExecStreamTest::testMultiColStairOldRoot(), testMultipleRanges(), ExecStreamGovernorTest::testReturnResources(), testScanIdx(), LcsRowScanExecStreamTest::testScanPastEndOfCluster(), LcsRowScanExecStreamTest::testScans(), LcsClusterAppendExecStreamTest::testSingleColConstNewRoot(), LcsClusterAppendExecStreamTest::testSingleColConstOldRoot(), LcsClusterAppendExecStreamTest::testSingleColNoDupNewRoot(), LcsClusterAppendExecStreamTest::testSingleColNoDupOldRoot(), LcsClusterAppendExecStreamTest::testSingleColStairNewRoot(), LcsClusterAppendExecStreamTest::testSingleColStairOldRoot(), LbmSplicerExecStreamTest::testSpliceRids(), LbmSplicerExecStreamTest::testSpliceWithKeys(), and LcsRowScanExecStreamTest::testSystemSampling().

00306 {
00307     if (pScheduler) {
00308         pScheduler->stop();
00309     }
00310     tearDownExecStreamTest();
00311 
00312     pScheduler.reset(newScheduler());
00313     pGraph = newStreamGraph();
00314     pGraphEmbryo = newStreamGraphEmbryo(pGraph);
00315     pGraph->setResourceGovernor(pResourceGovernor);
00316 }

void ExecStreamUnitTestBase::tearDownExecStreamTest (  )  [protected, virtual, inherited]

ExecStream-specific handler called from testCaseTearDown.

Reimplemented from ExecStreamTestBase.

Definition at line 319 of file ExecStreamUnitTestBase.cpp.

References ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

Referenced by ExecStreamUnitTestBase::resetExecStreamTest().

00320 {
00321     pGraph.reset();
00322     pGraphEmbryo.reset();
00323 }

SharedExecStreamGraph ExecStreamTestBase::newStreamGraph (  )  [protected, virtual, inherited]

Creates a stream graph.

Definition at line 37 of file ExecStreamTestBase.cpp.

References ExecStreamGraph::newExecStreamGraph().

Referenced by ExecStreamUnitTestBase::resetExecStreamTest(), and ExecStreamUnitTestBase::testCaseSetUp().

00038 {
00039     SharedExecStreamGraph pGraph = ExecStreamGraph::newExecStreamGraph();
00040     pGraph->enableDummyTxnId(true);
00041     return pGraph;
00042 }

SharedExecStreamGraphEmbryo ExecStreamTestBase::newStreamGraphEmbryo ( SharedExecStreamGraph   )  [protected, virtual, inherited]

Creates an embryo for a stream graph.

Definition at line 45 of file ExecStreamTestBase.cpp.

References CacheTestBase::pCache, ExecStreamTestBase::pScheduler, and SegStorageTestBase::pSegmentFactory.

Referenced by ExecStreamUnitTestBase::resetExecStreamTest(), and ExecStreamUnitTestBase::testCaseSetUp().

00046 {
00047     return SharedExecStreamGraphEmbryo(
00048         new ExecStreamGraphEmbryo(
00049             g, pScheduler, pCache, pSegmentFactory));
00050 }

ExecStreamScheduler * ExecStreamTestBase::newScheduler (  )  [protected, virtual, inherited]

Creates a scheduler.

Reimplemented in ParallelExecStreamSchedulerTest.

Definition at line 52 of file ExecStreamTestBase.cpp.

Referenced by ExecStreamUnitTestBase::resetExecStreamTest(), and ExecStreamTestBase::testCaseSetUp().

00053 {
00054     return new DfsTreeExecStreamScheduler(
00055         shared_from_this(),
00056         "DfsTreeExecStreamScheduler");
00057 }

ExecStreamGovernor * ExecStreamTestBase::newResourceGovernor ( ExecStreamResourceKnobs const &  knobSettings,
ExecStreamResourceQuantity const &  resourcesAvailable 
) [protected, virtual, inherited]

Creates the resource governor.

Definition at line 59 of file ExecStreamTestBase.cpp.

Referenced by ExecStreamTestBase::testCaseSetUp().

00062 {
00063     return new SimpleExecStreamGovernor(
00064         knobSettings, resourcesAvailable, shared_from_this(),
00065         "SimpleExecStreamGovernor");
00066 }

void SegStorageTestBase::openStorage ( DeviceMode  openMode  )  [virtual, inherited]

Reimplemented from CacheTestBase.

Reimplemented in SegmentTestBase.

Definition at line 31 of file SegStorageTestBase.cpp.

References SegStorageTestBase::openSegmentStorage(), and CacheTestBase::openStorage().

Referenced by SegStorageTestBase::openRandomSegment(), SegmentTestBase::openStorage(), LhxHashTableTest::testCaseSetUp(), ExecStreamTestBase::testCaseSetUp(), BTreeTest::testCaseSetUp(), BTreeReadersTest::testCaseSetUp(), LbmEntryTest::testCaseSetUp(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), SegStreamTest::testMarkReset(), SegStreamTest::testReadSeg(), LogicalTxnTest::testTxn(), SegStreamTest::testWriteSeg(), and SegStreamTest::testWriteSpillAndRead().

00032 {
00033     CacheTestBase::openStorage(openMode);
00034     openSegmentStorage(openMode);
00035 }

void SegStorageTestBase::openSegmentStorage ( DeviceMode  openMode  )  [virtual, inherited]

Reimplemented in LinearViewSegmentTest, SnapshotSegmentTestBase, and VersionedSegmentTest.

Definition at line 37 of file SegStorageTestBase.cpp.

References CacheTestBase::cbPageFull, DeviceMode::create, SegStorageTestBase::createLinearDeviceSegment(), CacheTestBase::dataDeviceId, SegStorageTestBase::pLinearSegment, and CacheTestBase::pRandomAccessDevice.

Referenced by VersionedSegmentTest::openSegmentStorage(), and SegStorageTestBase::openStorage().

00038 {
00039     pLinearSegment = createLinearDeviceSegment(
00040         dataDeviceId,
00041         openMode.create ? 0
00042         : pRandomAccessDevice->getSizeInBytes() / cbPageFull);
00043 }

void SegStorageTestBase::openRandomSegment (  )  [virtual, inherited]

Reimplemented in LcsClusterReplaceExecStreamTest.

Definition at line 45 of file SegStorageTestBase.cpp.

References SegStorageTestBase::closeStorage(), DeviceMode::load, SegStorageTestBase::openStorage(), SegStorageTestBase::pLinearSegment, SegStorageTestBase::pRandomSegment, and SegStorageTestBase::pSegmentFactory.

Referenced by RandomAllocationSegmentTest::testAllocateAndDeallocate(), LhxHashTableTest::testCaseSetUp(), ExecStreamUnitTestBase::testCaseSetUp(), BTreeTest::testCaseSetUp(), and BTreeReadersTest::testCaseSetUp().

00046 {
00047     // reopen will interpret pages as already allocated, which
00048     // is what RandomAllocationSegment expects
00049     closeStorage();
00050     openStorage(DeviceMode::load);
00051     pRandomSegment = pSegmentFactory->newRandomAllocationSegment(
00052         pLinearSegment, true);
00053     pLinearSegment.reset();
00054 }

SharedSegment SegStorageTestBase::createLinearDeviceSegment ( DeviceId  deviceId,
uint  nPages 
) [inherited]

Definition at line 56 of file SegStorageTestBase.cpp.

References LinearDeviceSegmentParams::firstBlockId, LinearDeviceSegmentParams::nPagesAllocated, LinearDeviceSegmentParams::nPagesMin, CacheTestBase::pCache, SegStorageTestBase::pSegmentFactory, CompoundId::setBlockNum(), and CompoundId::setDeviceId().

Referenced by VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), SegStorageTestBase::openSegmentStorage(), and LinearViewSegmentTest::openSegmentStorage().

00058 {
00059     BlockId blockId(0);
00060     CompoundId::setDeviceId(blockId,deviceId);
00061     CompoundId::setBlockNum(blockId,0);
00062     LinearDeviceSegmentParams deviceParams;
00063     deviceParams.firstBlockId = blockId;
00064     deviceParams.nPagesMin = nPages;
00065     deviceParams.nPagesAllocated = nPages;
00066     return pSegmentFactory->newLinearDeviceSegment(
00067         pCache,deviceParams);
00068 }

void SegStorageTestBase::closeLinearSegment (  )  [inherited]

Definition at line 70 of file SegStorageTestBase.cpp.

References SegStorageTestBase::pLinearSegment.

Referenced by VersionedSegmentTest::closeStorage(), SnapshotSegmentTestBase::closeStorage(), SegStorageTestBase::closeStorage(), and SnapshotSegmentTest::testUncommittedReads().

00071 {
00072     if (pLinearSegment) {
00073         assert(pLinearSegment.unique());
00074         pLinearSegment.reset();
00075     }
00076 }

void SegStorageTestBase::closeRandomSegment (  )  [inherited]

Definition at line 78 of file SegStorageTestBase.cpp.

References SegStorageTestBase::pRandomSegment.

Referenced by VersionedSegmentTest::closeStorage(), and SegStorageTestBase::closeStorage().

00079 {
00080     if (pRandomSegment) {
00081         assert(pRandomSegment.unique());
00082         pRandomSegment.reset();
00083     }
00084 }

void SegStorageTestBase::closeVersionedRandomSegment (  )  [inherited]

Definition at line 86 of file SegStorageTestBase.cpp.

References SegStorageTestBase::pVersionedRandomSegment.

Referenced by SnapshotSegmentTestBase::closeStorage(), and SegStorageTestBase::closeStorage().

00087 {
00088     if (pVersionedRandomSegment) {
00089         assert(pVersionedRandomSegment.unique());
00090         pVersionedRandomSegment.reset();
00091     }
00092 }

void SegStorageTestBase::closeSnapshotRandomSegment (  )  [inherited]

Definition at line 94 of file SegStorageTestBase.cpp.

References SegStorageTestBase::pSnapshotRandomSegment.

Referenced by SnapshotSegmentTestBase::closeStorage().

00095 {
00096     if (pSnapshotRandomSegment) {
00097         assert(pSnapshotRandomSegment.unique());
00098         pSnapshotRandomSegment.reset();
00099     }
00100 }

void SegStorageTestBase::closeStorage (  )  [virtual, inherited]

Reimplemented from CacheTestBase.

Reimplemented in SnapshotSegmentTestBase, and VersionedSegmentTest.

Definition at line 102 of file SegStorageTestBase.cpp.

References SegStorageTestBase::closeLinearSegment(), SegStorageTestBase::closeRandomSegment(), CacheTestBase::closeStorage(), and SegStorageTestBase::closeVersionedRandomSegment().

Referenced by VersionedSegmentTest::closeStorage(), SnapshotSegmentTestBase::closeStorage(), SegStorageTestBase::openRandomSegment(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), SegStreamTest::testMarkReset(), SegStreamTest::testReadSeg(), SegmentTestBase::testSingleThread(), SegStreamTest::testWriteSeg(), and SegStreamTest::testWriteSpillAndRead().

00103 {
00104     closeLinearSegment();
00105     closeRandomSegment();
00106     closeVersionedRandomSegment();
00107     // TODO:  assert pSegmentFactory.unique(), but not here
00108     CacheTestBase::closeStorage();
00109 }

Cache & CacheTestBase::getCache (  )  [inherited]

Definition at line 42 of file CacheTestBase.cpp.

References CacheTestBase::pCache.

Referenced by CacheTest::lockPage(), CacheTest::prefetchBatch(), SegmentTestBase::prefetchPage(), CacheTest::prefetchPage(), PagingTestBase::testCacheResize(), PagingTestBase::testCheckpoint(), PagingTestBase::testOp(), PagingTestBase::testScratch(), SegmentTestBase::unlockPage(), and CacheTest::unlockPage().

00043 {
00044     return *pCache;
00045 }

SharedCache CacheTestBase::newCache (  )  [virtual, inherited]

Definition at line 66 of file CacheTestBase.cpp.

References CacheTestBase::cacheParams, Cache::newCache(), CacheTestBase::victimLRU, CacheTestBase::victimPolicy, CacheTestBase::victimRandom, and CacheTestBase::victimTwoQ.

Referenced by CacheTestBase::openStorage().

00067 {
00068     switch (victimPolicy) {
00069     case victimRandom:
00070         return SharedCache(
00071             new RandomCache(cacheParams),
00072             ClosableObjectDestructor());
00073     case victimLRU:
00074         return SharedCache(
00075             new LRUCache(cacheParams),
00076             ClosableObjectDestructor());
00077     case victimTwoQ:
00078         return Cache::newCache(cacheParams);
00079     default:
00080         permAssert(false);
00081     }
00082 }

SharedRandomAccessDevice CacheTestBase::openDevice ( std::string  devName,
DeviceMode  openMode,
uint  nDevicePages,
DeviceId  deviceId 
) [inherited]

Definition at line 84 of file CacheTestBase.cpp.

References CacheTestBase::cbPageFull, DeviceMode::create, CacheTestBase::pCache, and FileSystem::remove().

Referenced by VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), and CacheTestBase::openStorage().

00087 {
00088     if (openMode.create) {
00089         FileSystem::remove(devName.c_str());
00090     }
00091     SharedRandomAccessDevice pDevice(
00092         new RandomAccessFileDevice(devName,openMode));
00093     if (openMode.create) {
00094         pDevice->setSizeInBytes(nDevicePages*cbPageFull);
00095     }
00096     pCache->registerDevice(deviceId,pDevice);
00097     return pDevice;
00098 }

void CacheTestBase::closeDevice ( DeviceId  deviceId,
SharedRandomAccessDevice pDevice 
) [inherited]

Definition at line 130 of file CacheTestBase.cpp.

References CHECKPOINT_FLUSH_AND_UNMAP, and CacheTestBase::pCache.

Referenced by VersionedSegmentTest::closeStorage(), SnapshotSegmentTestBase::closeStorage(), and CacheTestBase::closeStorage().

00132 {
00133     if (!pDevice) {
00134         return;
00135     }
00136     DeviceIdPagePredicate pagePredicate(deviceId);
00137     pCache->checkpointPages(pagePredicate,CHECKPOINT_FLUSH_AND_UNMAP);
00138     pCache->unregisterDevice(deviceId);
00139     assert(pDevice.unique());
00140     pDevice.reset();
00141 }

void TestBase::snooze ( uint  nSeconds  )  [protected, inherited]

Definition at line 263 of file TestBase.cpp.

Referenced by DatabaseTest::executeForceTxn(), ThreadedTestBase::runThreadedTestCase(), PagingTestBase::testCacheResize(), BTreeTxnTest::testCheckpoint(), PagingTestBase::testCheckpointGuarded(), PagingTestBase::testPrefetch(), and PagingTestBase::testPrefetchBatch().

00264 {
00265 #ifdef __MSVC__
00266     ::_sleep(nSeconds*1000);
00267 #else
00268     ::sleep(nSeconds);
00269 #endif
00270 }

void TestBase::readParams ( int  argc,
char **  argv 
) [static, inherited]

Parses the command line.

format: [-v] [-t TEST | -all] {param=val}* [CONFIGFILE | -] Normally, the test program runs the default test cases. With the option "-all", runs the extra test cases as well. With the option "-t TEST", runs only the single test case named TEST. CONFIGFILE is read to load configuration parameters. Configuration parameters can also be set ad hoc, from the command line, as pairs name=val. These take precedence.

Definition at line 108 of file TestBase.cpp.

References TestBase::configMap, ConfigMap::dumpParams(), ConfigMap::isParamSet(), ConfigMap::mergeFrom(), TestBase::paramDictionaryFileName, ConfigMap::readParams(), TestBase::runAll, TestBase::runSingle, ConfigMap::setStringParam(), and verbose.

00109 {
00110     bool verbose = false;
00111     ConfigMap adhocMap;
00112 
00113     for (int i = 1; i < argc; ++i) {
00114         std::string arg = argv[i];
00115         if (argv[i][0] == '-') {
00116             if (arg == "-v") {
00117                 verbose = true;
00118             } else if (arg == "-") {
00119                 configMap.readParams(std::cin);
00120             } else if (arg == "-all") {
00121                 runAll = true;
00122             } else if (arg == "-t") {   // -t TEST
00123                 permAssert(i + 1 < argc);
00124                 runSingle = argv[++i];
00125             } else if (arg[1] == 't') { // allow -tTEST
00126                 runSingle = arg.substr(2);
00127             }
00128         } else {
00129             int i = arg.find("=");
00130             if ((0 < i) && (i < arg.size())) {
00131                 // an ad hoc parameter
00132                 std::string key = arg.substr(0,i);
00133                 std::string val = arg.substr(i + 1);
00134                 adhocMap.setStringParam(key,val);
00135             } else {
00136                 // a config file name
00137                 std::ifstream configFile(arg.c_str());
00138                 assert(configFile.good());
00139                 configMap.readParams(configFile);
00140             }
00141         }
00142     }
00143     configMap.mergeFrom(adhocMap);
00144 
00145     // set a default dictionary file location for use by tests that need a
00146     // small non-random sorted data set
00147     if (!configMap.isParamSet(paramDictionaryFileName)) {
00148         std::string dictFileName = "dictWords";
00149         configMap.setStringParam(paramDictionaryFileName,dictFileName);
00150     }
00151 
00152     if (verbose) {
00153         configMap.dumpParams(std::cout);
00154     }
00155 }

TestSuite * TestBase::releaseTestSuite (  )  [inherited]

Definition at line 157 of file TestBase.cpp.

References TestBase::TestCaseGroup::addAllToTestSuite(), TestBase::defaultTests, TestBase::extraTests, TestBase::TestCaseGroup::findTest(), TestBase::pTestObj, TestBase::pTestSuite, TestBase::runAll, TestBase::runSingle, and TestBase::testName.

00158 {
00159     assert(pTestObj);
00160     assert(pTestObj.use_count() > 1);
00161 
00162     // release self-reference now that all test cases have been registered
00163     pTestObj.reset();
00164 
00165     TestSuite* pTestSuite = BOOST_TEST_SUITE(testName.c_str());
00166 
00167     if (runSingle.size()) {
00168         test_unit *p =  defaultTests.findTest(runSingle);
00169         if (!p) {
00170             p = extraTests.findTest(runSingle);
00171         }
00172         if (!p) {
00173             std::cerr << "test " << runSingle << " not found\n";
00174             exit(2);
00175         }
00176         pTestSuite->add(p);
00177     } else {
00178         defaultTests.addAllToTestSuite(pTestSuite);
00179         if (runAll) {
00180             extraTests.addAllToTestSuite(pTestSuite);
00181         }
00182     }
00183     return pTestSuite;
00184 }

void TestBase::beforeTestCase ( std::string  testCaseName  )  [inherited]

Definition at line 214 of file TestBase.cpp.

References TestBase::configMap, TraceSource::initTraceSource(), AutoBacktrace::install(), TestBase::notifyTrace(), AutoBacktrace::setOutputStream(), AutoBacktrace::setTraceTarget(), TestBase::testName, and TRACE_INFO.

00215 {
00216     notifyTrace(testName,TRACE_INFO,"ENTER:  " + testCaseName);
00217 
00218     // Install the AutoBacktrace signal handler now, after
00219     // boost::execution_monitor::catch_signals() has installed its own, so that
00220     // on SIGABRT AutoBacktrace goes first, prints the backtrace, then chains
00221     // to boost, which handles the error.
00222     AutoBacktrace::setOutputStream();
00223     AutoBacktrace::setTraceTarget(shared_from_this());
00224     AutoBacktrace::install();
00225     configMap.initTraceSource(shared_from_this(), "testConfig");
00226 }

void TestBase::afterTestCase ( std::string  testCaseName  )  [inherited]

Definition at line 228 of file TestBase.cpp.

References TestBase::configMap, TraceSource::disableTracing(), TestBase::notifyTrace(), AutoBacktrace::setTraceTarget(), TestBase::testName, and TRACE_INFO.

00229 {
00230     AutoBacktrace::setTraceTarget();
00231     configMap.disableTracing();
00232     notifyTrace(testName,TRACE_INFO,"LEAVE:  " + testCaseName);
00233 }

void TestBase::notifyTrace ( std::string  source,
TraceLevel  level,
std::string  message 
) [virtual, inherited]

Receives notification when a trace event occurs.

Parameters:
source the facility from which the message originated
level the trace event severity level
message the text of the message

Implements TraceTarget.

Definition at line 243 of file TestBase.cpp.

References TestBase::traceFile, TestBase::traceMutex, TestBase::traceStdout, and TestBase::traceStream.

Referenced by TestBase::afterTestCase(), and TestBase::beforeTestCase().

00244 {
00245     if (traceFile || traceStdout) {
00246         StrictMutexGuard traceMutexGuard(traceMutex);
00247         if (traceFile) {
00248             traceStream << "[" << source << "] " << message << std::endl;
00249             traceStream.flush();
00250         }
00251         if (traceStdout) {
00252             std::cout << "[" << source << "] " << message << std::endl;
00253             std::cout.flush();
00254         }
00255     }
00256 }

TraceLevel TestBase::getSourceTraceLevel ( std::string  source  )  [virtual, inherited]

Gets the level at which a particular source should be traced.

Parameters:
source name of source to be traced
Returns:
minimum severity level which should be traced

Implements TraceTarget.

Definition at line 258 of file TestBase.cpp.

References TestBase::traceLevel.

Referenced by LbmExecStreamTestBase::generateBitmaps().

00259 {
00260     return traceLevel;
00261 }


Member Data Documentation

TupleAttributeDescriptor LbmSearchTest::attrDesc_char1 [protected]

Definition at line 58 of file LbmSearchTest.cpp.

Referenced by initEqualSearch(), testCaseSetUp(), testMultipleRanges(), and testScanIdx().

TupleAttributeDescriptor LbmSearchTest::attrDesc_nullableInt64 [protected]

Definition at line 59 of file LbmSearchTest.cpp.

Referenced by initEqualSearch(), testCaseSetUp(), testMultipleRanges(), and testScanIdx().

vector<boost::shared_ptr<BTreeDescriptor> > LbmSearchTest::bTreeClusters [protected]

BTrees corresponding to the clusters.

Definition at line 64 of file LbmSearchTest.cpp.

Referenced by initClusterScanDef(), loadTableAndIndex(), and testCaseTearDown().

vector<PageId> LbmSearchTest::savedBTreeClusterRootIds [protected]

Saved root pageids of btrees corresponding to clusters; used to append to existing table and to read from them.

Definition at line 70 of file LbmSearchTest.cpp.

Referenced by loadTableAndIndex(), and testCaseTearDown().

vector<boost::shared_ptr<BTreeDescriptor> > LbmSearchTest::bTreeBitmaps [protected]

BTrees corresponding to the bitmaps.

Definition at line 75 of file LbmSearchTest.cpp.

Referenced by loadTableAndIndex(), testCaseTearDown(), and testScanIdx().

vector<PageId> LbmSearchTest::savedBTreeBitmapRootIds [protected]

Saved root pageids of btrees corresponding to bitmaps; used to append to existing table and to read from them.

Definition at line 81 of file LbmSearchTest.cpp.

Referenced by loadTableAndIndex(), testCaseTearDown(), and testScanIdx().

StandardTypeDescriptorFactory LbmExecStreamTestBase::stdTypeFactory [protected, inherited]

Definition at line 273 of file LbmExecStreamTestBase.h.

Referenced by testCaseSetUp(), and LbmExecStreamTestBase::testCaseSetUp().

TupleAttributeDescriptor LbmExecStreamTestBase::attrDesc_int64 [protected, inherited]

Definition at line 274 of file LbmExecStreamTestBase.h.

Referenced by initBTreeTupleDesc(), LbmExecStreamTestBase::initKeyBitmap(), loadTableAndIndex(), LbmExecStreamTestBase::testCaseSetUp(), testScanIdx(), and LbmSortedAggExecStreamTest::testSortedAgg().

TupleAttributeDescriptor LbmExecStreamTestBase::attrDesc_bitmap [protected, inherited]

Definition at line 275 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::testCaseSetUp().

uint LbmExecStreamTestBase::bitmapColSize [protected, inherited]

Size of bitmap columns.

Definition at line 280 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::generateBitmaps(), and LbmExecStreamTestBase::testCaseSetUp().

TupleDescriptor LbmExecStreamTestBase::bitmapTupleDesc [protected, inherited]

Tuple descriptor, tupledata, and accessor for a bitmap segment: (rid, segment descriptor, bitmap segments).

Definition at line 286 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::generateBitmaps(), initBTreeTupleDesc(), LbmExecStreamTestBase::initKeyBitmap(), LbmExecStreamTestBase::initValuesExecStream(), LbmExecStreamTestBase::testCaseSetUp(), LbmIntersectExecStreamTest::testIntersect(), LbmMinusExecStreamTest::testMinus(), testScanIdx(), LbmReaderTest::testSingleTupleReader(), and LbmUnionExecStreamTest::testUnion().

TupleData LbmExecStreamTestBase::bitmapTupleData [protected, inherited]

Definition at line 287 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::generateBitmaps(), LbmExecStreamTestBase::produceEntry(), LbmExecStreamTestBase::testCaseSetUp(), and LbmReaderTest::testSingleTupleReader().

TupleAccessor LbmExecStreamTestBase::bitmapTupleAccessor [protected, inherited]

Definition at line 288 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::generateBitmaps(), LbmExecStreamTestBase::produceEntry(), LbmExecStreamTestBase::testCaseSetUp(), testScanIdx(), and LbmUnionExecStreamTest::testUnion().

TupleDescriptor LbmExecStreamTestBase::keyBitmapTupleDesc [protected, inherited]

Tuple descriptor, data, and accessor for key-containting bitmaps (keys, srid, segment descriptor, bitmap segments).

Definition at line 294 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::initKeyBitmap(), LbmExecStreamTestBase::initNormalizerExecStream(), LbmNormalizerExecStreamTest::testNormalizer(), LbmMinusExecStreamTest::testRestartingMinus(), and LbmSortedAggExecStreamTest::testSortedAgg().

TupleData LbmExecStreamTestBase::keyBitmapTupleData [protected, inherited]

Definition at line 295 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::initKeyBitmap(), and LbmExecStreamTestBase::produceEntry().

TupleAccessor LbmExecStreamTestBase::keyBitmapTupleAccessor [protected, inherited]

Definition at line 296 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::initKeyBitmap(), and LbmExecStreamTestBase::produceEntry().

boost::shared_array<FixedBuffer> LbmExecStreamTestBase::keyBitmapBuf [protected, inherited]

Definition at line 297 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::initKeyBitmap(), LbmNormalizerExecStreamTest::testNormalizer(), LbmMinusExecStreamTest::testRestartingMinus(), and LbmSortedAggExecStreamTest::testSortedAgg().

uint LbmExecStreamTestBase::keyBitmapBufSize [protected, inherited]

Definition at line 298 of file LbmExecStreamTestBase.h.

Referenced by LbmExecStreamTestBase::initKeyBitmap(), LbmNormalizerExecStreamTest::testNormalizer(), LbmMinusExecStreamTest::testRestartingMinus(), and LbmSortedAggExecStreamTest::testSortedAgg().

SharedExecStreamGraph ExecStreamUnitTestBase::pGraph [protected, inherited]

Definition at line 46 of file ExecStreamUnitTestBase.h.

Referenced by ExecStreamUnitTestBase::prepareConfluenceGraph(), ExecStreamUnitTestBase::prepareConfluenceTransformGraph(), ExecStreamUnitTestBase::prepareDAG(), ExecStreamUnitTestBase::prepareTransformGraph(), ExecStreamUnitTestBase::resetExecStreamTest(), LbmSplicerExecStreamTest::spliceInput(), ExecStreamUnitTestBase::tearDownExecStreamTest(), ExecStreamTestSuite::testBTreeInsertExecStream(), ExecStreamUnitTestBase::testCaseSetUp(), CorrelationJoinExecStreamTestSuite::testCorrelationJoin(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), LbmLoadBitmapTest::testLoad(), ExecStreamTestSuite::testReshapeExecStream(), testScanIdx(), ExecStreamUnitTestBase::verifyBufferedOutput(), ExecStreamUnitTestBase::verifyConstantOutput(), FlatFileExecStreamTest::verifyOutput(), and ExecStreamUnitTestBase::verifyOutput().

SharedExecStreamGraphEmbryo ExecStreamUnitTestBase::pGraphEmbryo [protected, inherited]

Definition at line 47 of file ExecStreamUnitTestBase.h.

Referenced by ExecStreamUnitTestBase::prepareConfluenceGraph(), ExecStreamUnitTestBase::prepareConfluenceTransformGraph(), ExecStreamUnitTestBase::prepareDAG(), ExecStreamUnitTestBase::prepareTransformGraph(), ExecStreamUnitTestBase::resetExecStreamTest(), ExecStreamUnitTestBase::tearDownExecStreamTest(), and ExecStreamUnitTestBase::testCaseSetUp().

const uint ExecStreamTestBase::DefaultCacheReservePercent = 5 [static, protected, inherited]

Definition at line 45 of file ExecStreamTestBase.h.

Referenced by ExecStreamTestBase::testCaseSetUp().

const uint ExecStreamTestBase::DefaultConcurrentStatements = 4 [static, protected, inherited]

Definition at line 47 of file ExecStreamTestBase.h.

Referenced by ExecStreamTestBase::testCaseSetUp().

SharedExecStreamScheduler ExecStreamTestBase::pScheduler [protected, inherited]

Definition at line 49 of file ExecStreamTestBase.h.

Referenced by ExecStreamTestBase::newStreamGraphEmbryo(), ExecStreamUnitTestBase::resetExecStreamTest(), ExecStreamTestBase::testCaseSetUp(), ExecStreamTestBase::testCaseTearDown(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), ExecStreamUnitTestBase::verifyBufferedOutput(), ExecStreamUnitTestBase::verifyConstantOutput(), FlatFileExecStreamTest::verifyOutput(), and ExecStreamUnitTestBase::verifyOutput().

SharedExecStreamGovernor ExecStreamTestBase::pResourceGovernor [protected, inherited]

Definition at line 51 of file ExecStreamTestBase.h.

Referenced by ExecStreamUnitTestBase::resetExecStreamTest(), ExternalSortExecStreamTest::testCaseSetUp(), ExecStreamUnitTestBase::testCaseSetUp(), ExecStreamTestBase::testCaseSetUp(), ExecStreamGovernorTest::testCaseSetUp(), ExecStreamTestBase::testCaseTearDown(), ExecStreamGovernorTest::testMinGreaterAllocation(), ExecStreamUnitTestBase::verifyBufferedOutput(), ExecStreamUnitTestBase::verifyConstantOutput(), FlatFileExecStreamTest::verifyOutput(), and ExecStreamUnitTestBase::verifyOutput().

SharedCacheAccessor ExecStreamTestBase::pCacheAccessor [protected, inherited]

Definition at line 53 of file ExecStreamTestBase.h.

Referenced by ExecStreamTestSuite::testBTreeInsertExecStream(), ExecStreamUnitTestBase::testCaseSetUp(), ExecStreamTestBase::testCaseTearDown(), ExecStreamTestSuite::testMergeImplicitPullInputs(), ExecStreamTestSuite::testSegBufferExecStream(), and ExecStreamTestSuite::testSegBufferReaderWriterExecStream().

SharedSegmentFactory SegStorageTestBase::pSegmentFactory [protected, inherited]

Definition at line 40 of file SegStorageTestBase.h.

Referenced by BackupRestoreTest::backup(), SegStorageTestBase::createLinearDeviceSegment(), LogicalTxnTest::createRecoveryLog(), initBTreeExecStreamParam(), LbmLoadBitmapTest::initBTreeExecStreamParam(), LcsClusterReplaceExecStreamTest::initClusterAppendParams(), LbmExecStreamTestBase::initSorterExecStream(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), loadTableAndIndex(), LbmMinusExecStreamTest::newMinusStream(), ExecStreamTestBase::newStreamGraphEmbryo(), SegStorageTestBase::openRandomSegment(), VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), BackupRestoreTest::restore(), SegStorageTestBase::SegStorageTestBase(), LbmSplicerExecStreamTest::spliceInput(), ExecStreamTestSuite::testBTreeInsertExecStream(), LhxHashTableTest::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testClusterReplace(), LhxAggExecStreamTest::testCountImpl(), ExecStreamTestSuite::testDoubleBufferExecStream(), ExecStreamGovernorTest::testGovernor(), LhxAggExecStreamTest::testGroupCountImpl(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), BTreeTest::testInserts(), LbmIntersectExecStreamTest::testIntersect(), LbmEntryTest::testldb35(), LbmEntryTest::testler5920(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), LbmEntryTest::testMergeEntry(), BTreeTest::testMultiKeySearches(), BTreeTest::testScan(), ExecStreamTestSuite::testScratchBufferExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), FlatFileExecStreamTest::testStream(), LhxAggExecStreamTest::testSumImpl(), LogicalTxnTest::testTxn(), SnapshotSegmentTest::testUncommittedReads(), LbmUnionExecStreamTest::testUnion(), SegStreamTest::testWriteSpillAndRead(), and LbmEntryTest::testZeroBytes().

SharedSegment SegStorageTestBase::pLinearSegment [protected, inherited]

Segment supporting linear page allocation.

Definition at line 45 of file SegStorageTestBase.h.

Referenced by SegStorageTestBase::closeLinearSegment(), LogicalTxnTest::createRecoveryLog(), SegmentTestBase::lockPage(), SegStorageTestBase::openRandomSegment(), VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), SegStorageTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), SegmentTestBase::openStorage(), SegmentTestBase::prefetchPage(), SnapshotSegmentTestBase::testAllocateAll(), LinearViewSegmentTest::testAllocateAll(), VersionedSegmentTest::testCheckpoint(), SegmentTestBase::testCheckpoint(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), SegStreamTest::testMarkReset(), SegStreamTest::testReadSeg(), VersionedSegmentTest::testRecovery(), LogicalTxnTest::testTxn(), SnapshotSegmentTest::testUncommittedReads(), SegStreamTest::testWriteSeg(), and VersionedSegmentTest::verifyPage().

SharedSegment SegStorageTestBase::pRandomSegment [protected, inherited]

(Optional) segment supporting random page allocation.

Definition at line 50 of file SegStorageTestBase.h.

Referenced by SegStorageTestBase::closeRandomSegment(), SnapshotSegmentTestBase::closeStorage(), LbmSplicerExecStreamTest::createBTree(), LbmSplicerExecStreamTest::initBTreeParam(), initBTreeParam(), LbmLoadBitmapTest::initBTreeParam(), LbmLoadBitmapTest::initBTreeTupleDesc(), LcsClusterReplaceExecStreamTest::initClusterAppendParams(), LbmExecStreamTestBase::initSorterExecStream(), LcsClusterReplaceExecStreamTest::loadCluster(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), loadTableAndIndex(), SegStorageTestBase::openRandomSegment(), SnapshotSegmentTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), SegmentTestBase::openStorage(), SegmentTestBase::testAllocate(), RandomAllocationSegmentTest::testAllocateAndDeallocate(), ExecStreamTestSuite::testBTreeInsertExecStream(), BTreeTest::testBulkLoad(), LhxHashTableTest::testCaseSetUp(), BTreeTest::testCaseSetUp(), BTreeReadersTest::testCaseSetUp(), LcsRowScanExecStreamTest::testCaseSetUp(), LcsMultiClusterAppendTest::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testCaseSetUp(), LcsClusterAppendExecStreamTest::testCaseSetUp(), LbmExecStreamTestBase::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testClusterReplace(), LhxAggExecStreamTest::testCountImpl(), SegmentTestBase::testDeallocate(), LhxAggExecStreamTest::testGroupCountImpl(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), BTreeTest::testInserts(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), ExecStreamTestSuite::testMergeImplicitPullInputs(), BTreeTest::testMultiKeySearches(), BTreeReadersTest::testReaders(), LcsRowScanExecStreamTest::testScanOnEmptyCluster(), ExecStreamTestSuite::testSegBufferExecStream(), ExecStreamTestSuite::testSegBufferReaderWriterExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), LhxAggExecStreamTest::testSumImpl(), and LbmUnionExecStreamTest::testUnion().

SharedSegment SegStorageTestBase::pVersionedRandomSegment [protected, inherited]

(Optional) segment supporting versioned random page allocation.

Definition at line 55 of file SegStorageTestBase.h.

Referenced by BackupRestoreTest::backup(), SnapshotSegmentTestBase::closeStorage(), SegStorageTestBase::closeVersionedRandomSegment(), SnapshotSegmentTest::deallocateOldPages(), SnapshotSegmentTestBase::openSegmentStorage(), BackupRestoreTest::restore(), LcsClusterReplaceExecStreamTest::testClusterReplace(), SnapshotSegmentTest::testRollback(), and SnapshotSegmentTest::testUncommittedReads().

SharedSegment SegStorageTestBase::pSnapshotRandomSegment [protected, inherited]

(Optional) segment supporting snapshot random page allocation.

Definition at line 60 of file SegStorageTestBase.h.

Referenced by SegStorageTestBase::closeSnapshotRandomSegment(), SnapshotSegmentTestBase::commitChanges(), SnapshotSegmentTestBase::openSegmentStorage(), LcsClusterReplaceExecStreamTest::testClusterReplace(), and SnapshotSegmentTest::testDeallocateOld().

VictimPolicy CacheTestBase::victimPolicy [protected, inherited]

VictimPolicy to instantiate.

Definition at line 53 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), and CacheTestBase::newCache().

CacheParams CacheTestBase::cacheParams [protected, inherited]

Parameters for cache initialization.

Definition at line 58 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), CacheTestBase::newCache(), BackupRestoreTest::testBackupCleanup(), BackupRestoreTest::testHeaderBackupRestore(), and SegPageEntryIterTest::testIter().

SharedCache CacheTestBase::pCache [protected, inherited]

Cache instance being tested.

Definition at line 63 of file CacheTestBase.h.

Referenced by BackupRestoreTest::backup(), CacheTestBase::closeDevice(), CacheTestBase::closeStorage(), LbmSplicerExecStreamTest::createBTree(), SegStorageTestBase::createLinearDeviceSegment(), LogicalTxnTest::createRecoveryLog(), BackupRestoreTest::createSnapshotData(), BackupRestoreTest::executeSnapshotTxn(), CacheTestBase::getCache(), initBTreeExecStreamParam(), LbmLoadBitmapTest::initBTreeExecStreamParam(), initBTreeParam(), LbmLoadBitmapTest::initBTreeParam(), LcsClusterReplaceExecStreamTest::initClusterAppendParams(), LbmExecStreamTestBase::initSorterExecStream(), LcsClusterReplaceExecStreamTest::loadCluster(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), loadTableAndIndex(), SegmentTestBase::lockPage(), LbmMinusExecStreamTest::newMinusStream(), ExecStreamTestBase::newStreamGraphEmbryo(), CacheTestBase::openDevice(), CacheTestBase::openStorage(), LcsClusterReplaceExecStreamTest::replaceCluster(), BackupRestoreTest::restore(), LbmSplicerExecStreamTest::spliceInput(), SegmentTestBase::testAllocate(), RandomAllocationSegmentTest::testAllocateAndDeallocate(), BackupRestoreTest::testBackupCleanup(), ExecStreamTestSuite::testBTreeInsertExecStream(), BTreeTest::testBulkLoad(), LhxHashTableTest::testCaseSetUp(), ExecStreamUnitTestBase::testCaseSetUp(), BTreeTest::testCaseSetUp(), BTreeReadersTest::testCaseSetUp(), LhxAggExecStreamTest::testCountImpl(), SegmentTestBase::testDeallocate(), SnapshotSegmentTest::testDeallocateOld(), ExecStreamTestSuite::testDoubleBufferExecStream(), ExecStreamGovernorTest::testGovernor(), LhxAggExecStreamTest::testGroupCountImpl(), BackupRestoreTest::testHeaderBackupRestore(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), BTreeTest::testInserts(), LbmIntersectExecStreamTest::testIntersect(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), CacheTest::testLargeCacheInit(), CacheTest::testLargeCacheRequest(), LbmEntryTest::testldb35(), LbmEntryTest::testler5920(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), SegStreamTest::testMarkReset(), LbmEntryTest::testMergeEntry(), BTreeTest::testMultiKeySearches(), CacheTest::testQuotaCacheAccessor(), BTreeReadersTest::testReaders(), SegStreamTest::testReadSeg(), BTreeTest::testScan(), LcsRowScanExecStreamTest::testScanOnEmptyCluster(), ExecStreamTestSuite::testScratchBufferExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), FlatFileExecStreamTest::testStream(), LhxAggExecStreamTest::testSumImpl(), LogicalTxnTest::testTxn(), LogicalTxnTest::testTxnIdSequence(), LbmUnionExecStreamTest::testUnion(), SegStreamTest::testWriteSeg(), SegStreamTest::testWriteSpillAndRead(), LbmEntryTest::testZeroBytes(), and BackupRestoreTest::verifySnapshotData().

SharedRandomAccessDevice CacheTestBase::pRandomAccessDevice [protected, inherited]

The default cached device.

Definition at line 68 of file CacheTestBase.h.

Referenced by BackupRestoreTest::backup(), CacheTestBase::closeStorage(), SegStorageTestBase::openSegmentStorage(), CacheTestBase::openStorage(), and BackupRestoreTest::restore().

uint CacheTestBase::nMemPages [protected, inherited]

Size of cache in memory pages.

Definition at line 73 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), PagingTestBase::testCacheResize(), and ExecStreamTestBase::testCaseSetUp().

uint CacheTestBase::nDiskPages [protected, inherited]

Size of device in disk pages.

Definition at line 78 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), LinearViewSegmentTest::LinearViewSegmentTest(), CacheTest::makeBlockId(), VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), CacheTestBase::openStorage(), SegStreamTest::SegStreamTest(), SnapshotSegmentTestBase::SnapshotSegmentTestBase(), SnapshotSegmentTest::testDeallocateOld(), PagingTestBase::testPrefetch(), PagingTestBase::testPrefetchBatch(), PagingTestBase::testRandomOp(), SnapshotSegmentTest::testRollback(), PagingTestBase::testSequentialOp(), and PagingTestBase::testSkipOp().

uint CacheTestBase::cbPageFull [protected, inherited]

Disk page size.

Definition at line 83 of file CacheTestBase.h.

Referenced by CacheTest::CacheTest(), CacheTestBase::CacheTestBase(), CacheTestBase::openDevice(), and SegStorageTestBase::openSegmentStorage().

DeviceId CacheTestBase::dataDeviceId [protected, inherited]

Fixed ID to assign to data device.

Definition at line 88 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), CacheTestBase::closeStorage(), CacheTest::makeBlockId(), SnapshotSegmentTestBase::openSegmentStorage(), SegStorageTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), CacheTestBase::openStorage(), and PagingTestBase::testCheckpoint().

TestSuite* TestBase::pTestSuite [protected, inherited]

Boost test suite.

Definition at line 59 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

boost::shared_ptr<TestBase> TestBase::pTestObj [protected, inherited]

Definition at line 61 of file TestBase.h.

Referenced by TestBase::releaseTestSuite(), and TestBase::TestBase().

std::ofstream TestBase::traceStream [protected, inherited]

Output file stream for tracing.

Definition at line 66 of file TestBase.h.

Referenced by TestBase::notifyTrace(), TestBase::TestBase(), and TestBase::~TestBase().

StrictMutex TestBase::traceMutex [protected, inherited]

Protects traceStream.

Definition at line 71 of file TestBase.h.

Referenced by TestBase::notifyTrace().

std::string TestBase::testName [protected, inherited]

Name of test.

Definition at line 76 of file TestBase.h.

Referenced by TestBase::afterTestCase(), TestBase::beforeTestCase(), TestBase::releaseTestSuite(), TestBase::TestBase(), LhxHashTableTest::testInsert1Ka(), and LhxHashTableTest::testInsert1Kb().

TraceLevel TestBase::traceLevel [protected, inherited]

Level at which to trace test execution.

Definition at line 81 of file TestBase.h.

Referenced by TestBase::getSourceTraceLevel(), and TestBase::TestBase().

FileStatsTarget TestBase::statsTarget [protected, inherited]

Output for stats.

Definition at line 86 of file TestBase.h.

StatsTimer TestBase::statsTimer [protected, inherited]

Timer for stats collection.

Definition at line 91 of file TestBase.h.

Referenced by CacheTestBase::closeStorage(), CacheTestBase::openStorage(), BTreeTxnTest::testCaseSetUp(), BTreeTxnTest::testCaseTearDown(), and BTreeTxnTest::testTxns().

bool TestBase::traceStdout [protected, inherited]

Copy trace output to stdout.

Definition at line 99 of file TestBase.h.

Referenced by TestBase::notifyTrace(), and TestBase::TestBase().

bool TestBase::traceFile [protected, inherited]

Copy trace output to file.

Definition at line 104 of file TestBase.h.

Referenced by TestBase::notifyTrace(), and TestBase::TestBase().

bool TestBase::runAll [static, protected, inherited]

Run all test cases, including the extra tests.

(static, since set by readParams())

Definition at line 110 of file TestBase.h.

Referenced by TestBase::readParams(), and TestBase::releaseTestSuite().

std::string TestBase::runSingle [static, protected, inherited]

Run only the test case of this name.

(static, since set by readParams())

Definition at line 116 of file TestBase.h.

Referenced by TestBase::readParams(), and TestBase::releaseTestSuite().

TestCaseGroup TestBase::defaultTests [protected, inherited]

Definition at line 139 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

TestCaseGroup TestBase::extraTests [protected, inherited]

Definition at line 140 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

ParamName TestBase::paramTestSuiteName [static, inherited]

Definition at line 143 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramTraceFileName [static, inherited]

Definition at line 144 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramDictionaryFileName [static, inherited]

Definition at line 145 of file TestBase.h.

Referenced by TestBase::readParams(), SegStreamTest::testRead(), and SegStreamTest::testWrite().

ParamName TestBase::paramTraceLevel [static, inherited]

Definition at line 146 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramStatsFileName [static, inherited]

Definition at line 147 of file TestBase.h.

ParamName TestBase::paramTraceStdout [static, inherited]

Definition at line 148 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramDegreeOfParallelism [static, inherited]

Definition at line 149 of file TestBase.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

ConfigMap TestBase::configMap [static, inherited]

Configuration parameters.

The reason this is static is so that no constructor parameters (which burden virtual bases) are needed.

Definition at line 155 of file TestBase.h.

Referenced by TestBase::afterTestCase(), TestBase::beforeTestCase(), BTreeTxnTest::BTreeTxnTest(), CacheTestBase::CacheTestBase(), BackupRestoreTest::createSnapshotData(), DatabaseTest::DatabaseTest(), TestOptionsTest::extra(), DatabaseTest::loadDatabase(), SparseBitmapTest::openStorage(), PagingTestBase::PagingTestBase(), ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest(), RandomAccessFileDeviceTest::RandomAccessFileDeviceTest(), TestBase::readParams(), SegStorageTestBase::SegStorageTestBase(), TestOptionsTest::test1(), TestOptionsTest::test2(), BackupRestoreTest::testBackupCleanup(), TestBase::TestBase(), BTreeTxnTest::testCaseSetUp(), BTreeTxnTest::testCheckpoint(), DatabaseTest::testCreateEmpty(), DatabaseTest::testForceTxns(), BackupRestoreTest::testHeaderBackupRestore(), SegPageEntryIterTest::testIter(), SegStreamTest::testRead(), BTreeTxnTest::testTxns(), SegStreamTest::testWrite(), ThreadedTestBase::ThreadedTestBase(), and TestBase::~TestBase().


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