当前位置: 首页>>代码示例>>C++>>正文


C++ DBRM类代码示例

本文整理汇总了C++中DBRM的典型用法代码示例。如果您正苦于以下问题:C++ DBRM类的具体用法?C++ DBRM怎么用?C++ DBRM使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DBRM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: grabLock

void grabLock()
{
	DBRM dbrm;
	uint64_t id;
	vector<uint> pmlist;

	string name = "init";
	uint32_t pid = 1;
	int32_t sid = 5678;

	pmlist.push_back(1);

	try {
		id = dbrm.getTableLock(pmlist, 1234, &name, &pid, &sid, &sid, LOADING);
	}
	catch (exception &e) {
		cout << "caught an exception: " << e.what() << endl;
		exit(1);
	}

	cout << "lock ID = " << id << endl;
	if (id == 0)
		cout << " existing owner name = " << name << " pid = " << pid << " session = " << sid << endl;

}
开发者ID:demonlife,项目名称:infinidb,代码行数:25,代码来源:tablelocktest.cpp

示例2:

void *DBRM_deadlock(void *arg) 
{
	DBRM dbrm;
	int terr;
	VER_t txn = 2;
	vector<LBIDRange> ranges;
	LBIDRange range;
	vector<VBRange> freeList;

	range.start = 2000;
	range.size = 1000;
	ranges.push_back(range);
  	terr = dbrm.beginVBCopy(txn, ranges, freeList);

	range.start = 1000;
	range.size = 1000;
	ranges.clear();
	freeList.clear();
	ranges.push_back(range);
	terr = dbrm.beginVBCopy(txn, ranges, freeList);

	// block waiting on the main thread, main thread deadlocks, rolls back, 
	// thread wakes

	CPPUNIT_ASSERT(terr == 0);
	terr = dbrm.endVBCopy(txn, ranges);

 	CPPUNIT_ASSERT(terr == 0);
	terr = dbrm.vbCommit(txn);

  	CPPUNIT_ASSERT(terr == 0);

	return NULL;
}
开发者ID:hans511002,项目名称:erydb,代码行数:34,代码来源:tdriver-dbrm.cpp

示例3: deliveryStep_1

//------------------------------------------------------------------------------
// 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);
}
开发者ID:Kangmo,项目名称:infinidb,代码行数:34,代码来源:tdriver-deliver.cpp

示例4: filterWithDictionary

bool filterWithDictionary(execplan::erydbSystemCatalog::OID dictOid, uint64_t n)
{
	// if n == 0, no dictionary scan, alway filter with dictionary.
	if (n == 0)
		return true;

	// if n == ulong_max, always use dictionary scan
	if (n == ULONG_MAX)
		return false;

	vector<struct EMEntry> entries;
	DBRM dbrm;
	if (dbrm.getExtents(dictOid, entries) != 0)
		return false;  // Just do pdictionaryscan and let job step handle this.

	vector<struct EMEntry>::iterator it = entries.begin();
	bool ret = false;
	n--;  // HWM starts at 0
	while (it != entries.end())
	{
		if (it->HWM > n)
		{
			ret = true;
			break;
		}

		it++;
	}

	return ret;
}
开发者ID:hans511002,项目名称:erydb,代码行数:31,代码来源:jlf_common.cpp

示例5: sessionmanager_1

void sessionmanager_1()
{
	DBRM dbrm;
	int tmp = -1;

	tmp = dbrm.verID();
	// there's no "correct" value b/c it's monotonically increasing.
}
开发者ID:hans511002,项目名称:erydb,代码行数:8,代码来源:tdriver-dbrm.cpp

示例6: deliverTest

//------------------------------------------------------------------------------
// 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);

}
开发者ID:Kangmo,项目名称:infinidb,代码行数:59,代码来源:tdriver-deliver.cpp

示例7: flushPartition

void FileBufferMgr::flushPartition(const vector<OID_t> &oids, const set<BRM::LogicalPartition> &partitions)
{
	DBRM dbrm;
	uint32_t i;
	vector<EMEntry> extents;
	int err;
	uint32_t currentExtent;
	LBID_t currentLBID;
	typedef tr1::unordered_multimap<LBID_t, filebuffer_uset_t::iterator> byLBID_t;
	byLBID_t byLBID;
	pair<byLBID_t::iterator, byLBID_t::iterator> itList;
	filebuffer_uset_t::iterator it;
	uint32_t count = oids.size();

	mutex::scoped_lock lk(fWLock);

	if (fCacheSize == 0 || oids.size() == 0 || partitions.size() == 0)
		return;

	/* Index the cache by LBID */
	for (it = fbSet.begin(); it != fbSet.end(); it++)
		byLBID.insert(pair<LBID_t, filebuffer_uset_t::iterator>(it->lbid, it));

	for (i = 0; i < count; i++) {
		extents.clear();
		err = dbrm.getExtents(oids[i], extents, true, true,true); // @Bug 3838 Include outofservice extents
		if (err < 0) {
			lk.unlock();
			flushCache();   // better than returning an error code to the user
			return;
		}

		for (currentExtent = 0; currentExtent < extents.size(); currentExtent++) {
			EMEntry &range = extents[currentExtent];

			LogicalPartition logicalPartNum(range.dbRoot, range.partitionNum, range.segmentNum);
			if (partitions.find(logicalPartNum) == partitions.end())
				continue;

			LBID_t lastLBID = range.range.start + (range.range.size * 1024);
			for (currentLBID = range.range.start; currentLBID < lastLBID; currentLBID++) {
				itList = byLBID.equal_range(currentLBID);
				for (byLBID_t::iterator tmpIt = itList.first; tmpIt != itList.second;
						tmpIt++) {
					fbList.erase(fFBPool[tmpIt->second->poolIdx].listLoc());
					fEmptyPoolSlots.push_back(tmpIt->second->poolIdx);
					fbSet.erase(tmpIt->second);
					fCacheSize--;
				}
			}
		}
	}
}
开发者ID:DYFeng,项目名称:infinidb,代码行数:53,代码来源:filebuffermgr.cpp

示例8: flushOIDs

void FileBufferMgr::flushOIDs(const uint32_t *oids, uint32_t count)
{
	DBRM dbrm;
	uint32_t i;
	vector<EMEntry> extents;
	int err;
	uint32_t currentExtent;
	LBID_t currentLBID;
	typedef tr1::unordered_multimap<LBID_t, filebuffer_uset_t::iterator> byLBID_t;
	byLBID_t byLBID;
	pair<byLBID_t::iterator, byLBID_t::iterator> itList;
	filebuffer_uset_t::iterator it;

	// If there are more than this # of extents to drop, the whole cache will be cleared
	const uint32_t clearThreshold = 50000;

	mutex::scoped_lock lk(fWLock);
	
	if (fCacheSize == 0 || count == 0)
		return;

	/* Index the cache by LBID */
	for (it = fbSet.begin(); it != fbSet.end(); it++)
		byLBID.insert(pair<LBID_t, filebuffer_uset_t::iterator>(it->lbid, it));

	for (i = 0; i < count; i++) {
		extents.clear();
		err = dbrm.getExtents(oids[i], extents, true,true,true);  // @Bug 3838 Include outofservice extents
		if (err < 0 || (i == 0 && (extents.size() * count) > clearThreshold)) {
			// (The i == 0 should ensure it's not a dictionary column)
			lk.unlock();
			flushCache();
			return;
		}

		for (currentExtent = 0; currentExtent < extents.size(); currentExtent++) {
			EMEntry &range = extents[currentExtent];
			LBID_t lastLBID = range.range.start + (range.range.size * 1024);
			for (currentLBID = range.range.start; currentLBID < lastLBID;
			  currentLBID++) {
				itList = byLBID.equal_range(currentLBID);
				for (byLBID_t::iterator tmpIt = itList.first; tmpIt != itList.second;
						tmpIt++) {
					fbList.erase(fFBPool[tmpIt->second->poolIdx].listLoc());
					fEmptyPoolSlots.push_back(tmpIt->second->poolIdx);
					fbSet.erase(tmpIt->second);
					fCacheSize--;
				}
			}
		}
	}
}
开发者ID:DYFeng,项目名称:infinidb,代码行数:52,代码来源:filebuffermgr.cpp

示例9: printTxnIDs

void printTxnIDs() 
{
	DBRM brm;
	set<VER_t> txnList;
	set<VER_t>::iterator it;
	int err;

	err = brm.getCurrentTxnIDs(txnList);
	if (err != 0)
		return;
	for (it = txnList.begin(); it != txnList.end(); it++)
		cout << *it << endl;	
}
开发者ID:Gwan-Wang,项目名称:infinidb,代码行数:13,代码来源:rollback.cpp

示例10: releaseAllLocks

void releaseAllLocks()
{
	DBRM dbrm;

	try {
		dbrm.releaseAllTableLocks();
	}
	catch (exception &e) {
		cout << "caught an exception: " << e.what() << endl;
		exit(1);
	}
	cout << "OK\n";
}
开发者ID:demonlife,项目名称:infinidb,代码行数:13,代码来源:tablelocktest.cpp

示例11: rollbackTxn

void rollbackTxn(VER_t txnID)
{
	DBRM brm;
	vector<LBID_t> lbidList;
	int err;

	err = brm.getUncommittedLBIDs(txnID, lbidList);
	if (err != 0)
		return;
	err = brm.vbRollback(txnID, lbidList);
	if (err != 0)
		return;
	cout << "OK." << endl;
}
开发者ID:Gwan-Wang,项目名称:infinidb,代码行数:14,代码来源:rollback.cpp

示例12: sessionmanager_2

void sessionmanager_2()
{
	DBRM dbrm;
	SessionManagerServer::TxnID tmp;
	int ver1, ver2;

	ver1 = dbrm.verID();
	tmp = dbrm.newTxnID(1000, true);
	ver2 = dbrm.verID();
	
	CPPUNIT_ASSERT(ver2 == ver1 + 1);
	CPPUNIT_ASSERT(ver2 == tmp.id);
	CPPUNIT_ASSERT(tmp.valid == true);

	dbrm.committed(tmp);
	CPPUNIT_ASSERT(tmp.valid == false);
}
开发者ID:hans511002,项目名称:erydb,代码行数:17,代码来源:tdriver-dbrm.cpp

示例13: sessionmanager_3

void sessionmanager_3()
{
	DBRM dbrm;
	SessionManagerServer::TxnID txn, txn2;
	
	txn = dbrm.newTxnID(1000, true);
	txn2 = dbrm.getTxnID(1000);

	CPPUNIT_ASSERT(txn.id == txn2.id);
	CPPUNIT_ASSERT(txn.valid == txn2.valid == true);

	dbrm.rolledback(txn);
	CPPUNIT_ASSERT(txn.valid == false);

	txn2 = dbrm.getTxnID(1000);
	CPPUNIT_ASSERT(txn2.valid == false);
}
开发者ID:hans511002,项目名称:erydb,代码行数:17,代码来源:tdriver-dbrm.cpp

示例14: brm_dumb_1

	void brm_dumb_1()
	{
		DBRM brm;
		vector<LBID_t> lbids;
		int allocdSize, err;
		const uint32_t extentSize = brm.getExtentSize();

 		err = brm.createExtent(extentSize, 1, lbids, allocdSize);
		CPPUNIT_ASSERT(err == 0);
 		err = brm.markExtentInvalid(lbids[0]);
		CPPUNIT_ASSERT(err == 0);
		int64_t min;	
		int64_t max;	
		int32_t seq;
 		err = brm.getExtentMaxMin(lbids[0], max, min, seq);
#ifdef SAFE_CP
		CPPUNIT_ASSERT(err == 0);
#else
		CPPUNIT_ASSERT(err == 1);
#endif

 		err = brm.setExtentMaxMin(lbids[0], max, min, seq);
		CPPUNIT_ASSERT(err == 0);

		err = brm.deleteOID(1);
		CPPUNIT_ASSERT(err == 0);
	}	
开发者ID:hans511002,项目名称:erydb,代码行数:27,代码来源:tdriver-dbrm.cpp

示例15: sessionmanager_4

void sessionmanager_4()
{
	DBRM dbrm;
	SessionManagerServer::TxnID txn, txn2;
	const SessionManagerServer::SIDTIDEntry *stmap;
	int len;

	txn = dbrm.newTxnID(1000, true);
	txn2 = dbrm.newTxnID(1001, true);
	stmap = dbrm.SIDTIDMap(len);

	CPPUNIT_ASSERT(len == 2);

#ifdef BRM_VERBOSE
	int i;
	cerr << "len = " << len << endl;
	for (i = 0; i < len; i++) {
		cerr << "  " << i << ": txnid=" << stmap[i].txnid.id << " valid=" << 
			stmap[i].txnid.valid << " sessionid=" << stmap[i].sessionid << endl;
	}
#endif

	dbrm.committed(txn);
	dbrm.committed(txn2);
	delete [] stmap;
	stmap = dbrm.SIDTIDMap(len);

	CPPUNIT_ASSERT(len == 0);
	delete [] stmap;
}
开发者ID:hans511002,项目名称:erydb,代码行数:30,代码来源:tdriver-dbrm.cpp


注:本文中的DBRM类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。