本文整理汇总了C++中ExtentMap::getBulkInsertVars方法的典型用法代码示例。如果您正苦于以下问题:C++ ExtentMap::getBulkInsertVars方法的具体用法?C++ ExtentMap::getBulkInsertVars怎么用?C++ ExtentMap::getBulkInsertVars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtentMap
的用法示例。
在下文中一共展示了ExtentMap::getBulkInsertVars方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
void extentMap_good_1()
{
ExtentMap em;
int i, err, oid, iterations = 1300; // (EM_INITIAL_SIZE + 3*EM_INCREMENT)
int caughtException = 0, allocdSize;
uint32_t fbo, hwm;
BRM::HWM_t hwm2;
BRM::VER_t txnID;
vector<LBID_t> lbids;
const uint32_t extentSize = em.getExtentSize();
em.load(string("EMImage"));
em.checkConsistency();
for (i = 0; i < iterations; i++)
{
err = em.lookup(static_cast<LBID_t>(i * extentSize), oid, fbo);
CPPUNIT_ASSERT(err == 0);
CPPUNIT_ASSERT(oid == i);
CPPUNIT_ASSERT(fbo == 0);
if (i != 0)
{
err = em.lookup(static_cast<LBID_t>(i * extentSize - 1), oid, fbo);
CPPUNIT_ASSERT(err == 0);
CPPUNIT_ASSERT(oid == i - 1);
CPPUNIT_ASSERT(fbo == extentSize - 1);
}
if (i != iterations - 1)
{
err = em.lookup(static_cast<LBID_t>(i * extentSize + 1), oid, fbo);
CPPUNIT_ASSERT(err == 0);
CPPUNIT_ASSERT(oid == i);
CPPUNIT_ASSERT(fbo == 1);
}
}
em.checkConsistency();
err = em.lookup(static_cast<LBID_t>(i * extentSize), oid, fbo);
CPPUNIT_ASSERT(err == -1);
for (i = 0; i < iterations; i++)
{
err = em.getBulkInsertVars(static_cast<LBID_t>(i * extentSize),
hwm2, txnID);
CPPUNIT_ASSERT(err == 0);
CPPUNIT_ASSERT(hwm2 == 0);
CPPUNIT_ASSERT(txnID == 0);
err = em.setBulkInsertVars(static_cast<LBID_t>(i * extentSize),
i, i + 1);
em.confirmChanges();
CPPUNIT_ASSERT(err == 0);
err = em.getBulkInsertVars(static_cast<LBID_t>(i * extentSize),
hwm2, txnID);
CPPUNIT_ASSERT(err == 0);
CPPUNIT_ASSERT(hwm2 == static_cast<LBID_t>(i));
CPPUNIT_ASSERT(txnID == static_cast<VER_t>(i + 1));
hwm = em.getHWM(i);
CPPUNIT_ASSERT(hwm == 0);
em.setHWM(i, (i > (extentSize - 1) ? extentSize - 1 : i));
em.confirmChanges();
hwm = em.getHWM(i);
CPPUNIT_ASSERT(hwm == static_cast<uint32_t>(i > extentSize - 1 ? extentSize - 1 : i));
}
em.checkConsistency();
#ifdef BRM_DEBUG
caughtException = 0;
try
{
em.setHWM(i, hwm);
}
catch (std::invalid_argument e)
{
caughtException = 1;
}
em.undoChanges();
CPPUNIT_ASSERT(caughtException == 1);
#endif
for (i = 0; i < iterations; i++)
{
em.deleteOID(i);
em.confirmChanges();
}
#ifdef BRM_DEBUG
caughtException = 0;
try
{
em.deleteOID(i);
}
catch (std::invalid_argument& e)
//.........这里部分代码省略.........
示例2: EMRunner
//.........这里部分代码省略.........
CPPUNIT_ASSERT(hwm == tmp->HWM);
em->checkConsistency();
break;
}
case 6: //setHWM
{
if (listSize == 0)
break;
int entryRand = rand_r(&randstate) % listSize;
int i, hwm, oid;
struct EMEntries *tmp;
for (i = 0, tmp = head; i < entryRand; i++)
tmp = tmp->next;
oid = tmp->OID;
hwm = rand_r(&randstate) % (tmp->FBO + em->getExtentSize());
em->setHWM(oid, hwm);
em->confirmChanges();
for (tmp = head; tmp != NULL; tmp = tmp->next)
if (tmp->OID == oid)
tmp->HWM = hwm;
#ifdef BRM_VERBOSE
cerr << "setHWM of OID " << oid << " to " << hwm << endl;
#endif
em->checkConsistency();
break;
}
case 7: // renew this EM object
{
delete em;
em = new ExtentMap();
#ifdef BRM_VERBOSE
cerr << "got a new EM instance" << endl;
#endif
em->checkConsistency();
break;
}
case 8: //getBulkInsertVars
{
if (listSize == 0)
break;
HWM_t hwm;
VER_t txnID;
int entryRand = rand_r(&randstate) % listSize;
int i, err, offset;
EMEntries *tmp;
LBID_t lbid;
for (i = 0, tmp = head; i < entryRand; i++)
tmp = tmp->next;
offset = rand_r(&randstate) % tmp->size;
lbid = tmp->LBIDstart + offset;
err = em->getBulkInsertVars(lbid, hwm, txnID);
CPPUNIT_ASSERT(err == 0);
CPPUNIT_ASSERT(hwm == tmp->secondHWM);
CPPUNIT_ASSERT(txnID == tmp->txnID);
break;
}
case 9: //setBulkInsertVars
{
if (listSize == 0)
break;
int entryRand = rand_r(&randstate) % listSize;
int i, err, offset;
EMEntries *tmp;
for (i = 0, tmp = head; i < entryRand; i++)
tmp = tmp->next;
offset = rand_r(&randstate) % tmp->size;
tmp->secondHWM = rand_r(&randstate) % MAXINT;
tmp->txnID = rand_r(&randstate) % MAXINT;
err = em->setBulkInsertVars(tmp->LBIDstart + offset,
tmp->secondHWM, tmp->txnID);
em->confirmChanges();
CPPUNIT_ASSERT(err == 0);
break;
}
default:
break;
}
}
delete em;
while (head != NULL) {
tmp = head->next;
delete head;
head = tmp;
}
#ifdef BRM_VERBOSE
cerr << "thread " << threadNum << " exiting" << endl;
#endif
return NULL;
}