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; }
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; }