コード例 #1
0
ファイル: tdriver-deliver.cpp プロジェクト: Kangmo/infinidb
//------------------------------------------------------------------------------
// Test delivery of a single numeric column
//------------------------------------------------------------------------------
void deliveryStep_1()  //number column
{
		DistributedEngineComm* dec;
		CalpontSystemCatalog *cat;

		ResourceManager rm;
		dec = DistributedEngineComm::instance(rm);
		cat = CalpontSystemCatalog::makeCalpontSystemCatalog(1);

		DBRM dbrm;	
		uint32_t uniqueID = dbrm.getUnique32();
		dec->addQueue(uniqueID);

		JobStepAssociation inJs;

		AnyDataListSPtr spdl1(new AnyDataList());
		FIFO<UintRowGroup>* dl1 = new FIFO<UintRowGroup>(1,100);
		addElements(dl1);

		spdl1->fifoDL(dl1);

		inJs.outAdd(spdl1);

		DeliveryStep dstep(inJs, JobStepAssociation(),
			make_table(schema, table),
			cat, 1, 1, 1, flushInterval);

		runStep(dstep, string("deliveryStep_1"));

		dec->removeQueue(uniqueID);
}
コード例 #2
0
ファイル: tdriver-deliver.cpp プロジェクト: Kangmo/infinidb
//------------------------------------------------------------------------------
// Test delivery of multiple (numCols) numeric columns
//------------------------------------------------------------------------------
void deliverTest(int numCols)   
{
		DistributedEngineComm* dec;
		CalpontSystemCatalog *cat;
		ResourceManager rm;
		dec = DistributedEngineComm::instance(rm);
		cat = CalpontSystemCatalog::makeCalpontSystemCatalog(1);

		// Get the oid for the first column in the table - usually lineitem.l_orderkey.
		CalpontSystemCatalog::TableName tableName = make_table(schema, colstable);
		CalpontSystemCatalog::ROPair p = cat->tableRID(tableName);
		startingOid = p.objnum + 1;
		
		int startingOid = 3416;  // Oid for lineitem.l_orderkey on your database.

		DBRM dbrm;	
		uint32_t uniqueID = dbrm.getUnique32();
		dec->addQueue(uniqueID);

		JobStepAssociation inJs;

		stringstream ss;
		pthread_t threads[ numCols ];

		for (int i = 0; i < numCols; ++i)
		{
			AnyDataListSPtr spdl1(new AnyDataList());

			// Make FIFO big enough to contain the elements for a flush interval
			FIFO<UintRowGroup>* dl1 = new FIFO<UintRowGroup>(1, fifoSize);
//			BandedDL<ElementType>* dl1 = new BandedDL<ElementType>(1);

			dl1->OID(i+startingOid);	// lineitem first col object id	
			spdl1->fifoDL(dl1);
//			spdl1->bandedDL(dl1);
			inJs.outAdd(spdl1);

			pthread_create(&threads[i], 0, addElementsThreadWrapper, dl1 );
		}
		DeliveryStep dstep(inJs, JobStepAssociation(), tableName,
			cat, 12345, 1, 1, flushInterval);

		ss << "DeliverStep test for " << numCols;

		string message = ss.str();

		runStep(dstep, ss.str());

		for (int i = 0; i < numCols; ++i)
		{
			pthread_join(threads[i], 0);
		}

		dec->removeQueue(uniqueID);

}