本文整理汇总了C++中PersistentTable::allocateNextBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ PersistentTable::allocateNextBlock方法的具体用法?C++ PersistentTable::allocateNextBlock怎么用?C++ PersistentTable::allocateNextBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PersistentTable
的用法示例。
在下文中一共展示了PersistentTable::allocateNextBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPersistentTable
Table* TableFactory::getPersistentTable(
voltdb::CatalogId databaseId,
const std::string &name,
TupleSchema* schema,
const std::vector<std::string> &columnNames,
char *signature,
bool tableIsMaterialized,
int partitionColumn,
bool exportEnabled,
bool exportOnly,
int tableAllocationTargetSize,
int tupleLimit,
int32_t compactionThreshold,
bool drEnabled)
{
Table *table = NULL;
StreamedTable *streamedTable = NULL;
PersistentTable *persistentTable = NULL;
if (exportOnly) {
table = streamedTable = new StreamedTable(partitionColumn);
}
else {
table = persistentTable = new PersistentTable(partitionColumn,
signature,
tableIsMaterialized,
tableAllocationTargetSize,
tupleLimit,
drEnabled);
}
initCommon(databaseId,
table,
name,
schema,
columnNames,
true, // table will take ownership of TupleSchema object
compactionThreshold);
TableStats *stats;
if (exportOnly) {
stats = streamedTable->getTableStats();
}
else {
stats = persistentTable->getTableStats();
// Allocate and assign the tuple storage block to the persistent table ahead of time instead
// of doing so at time of first tuple insertion. The intent of block allocation ahead of time
// is to avoid allocation cost at time of tuple insertion
TBPtr block = persistentTable->allocateNextBlock();
assert(block->hasFreeTuples());
persistentTable->m_blocksWithSpace.insert(block);
}
// initialize stats for the table
configureStats(name, stats);
return table;
}
示例2: getPersistentTable
Table* TableFactory::getPersistentTable(
voltdb::CatalogId databaseId,
const std::string &name,
TupleSchema* schema,
const std::vector<std::string> &columnNames,
char *signature,
bool tableIsMaterialized,
int partitionColumn,
bool exportEnabled,
bool exportOnly,
int tableAllocationTargetSize,
int tupleLimit,
int32_t compactionThreshold,
bool drEnabled)
{
Table *table = NULL;
if (exportOnly) {
table = new StreamedTable(exportEnabled);
}
else {
table = new PersistentTable(partitionColumn, signature, tableIsMaterialized, tableAllocationTargetSize, tupleLimit, drEnabled);
}
initCommon(databaseId,
table,
name,
schema,
columnNames,
true, // table will take ownership of TupleSchema object
compactionThreshold);
// initialize stats for the table
configureStats(databaseId, name, table);
if(!exportOnly) {
// allocate tuple storage block for the persistent table ahead of time
// instead of waiting till first tuple insertion. Intend of allocating tuple
// block storage ahead is to improve performance on first tuple insertion.
PersistentTable *persistentTable = static_cast<PersistentTable*>(table);
TBPtr block = persistentTable->allocateNextBlock();
assert(block->hasFreeTuples());
persistentTable->m_blocksWithSpace.insert(block);
}
return table;
}