本文整理汇总了C++中LogRecord::getEstimatedLength方法的典型用法代码示例。如果您正苦于以下问题:C++ LogRecord::getEstimatedLength方法的具体用法?C++ LogRecord::getEstimatedLength怎么用?C++ LogRecord::getEstimatedLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogRecord
的用法示例。
在下文中一共展示了LogRecord::getEstimatedLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: p_execute
//.........这里部分代码省略.........
int32_t numCols = -1;
// See if we can do better by using an index instead
TableIndex *index = table->primaryKeyIndex();
if (index != NULL) {
// First construct tuple for primary key
keydata = new char[index->getKeySchema()->tupleLength()];
keyTuple = new TableTuple(keydata, index->getKeySchema());
for (int i = 0; i < index->getKeySchema()->columnCount(); i++) {
keyTuple->setNValue(i, beforeImage->getNValue(index->getColumnIndices()[i]));
}
// no before image need be recorded, just the primary key
beforeImage = NULL;
}
// Set the modified column list
numCols = m_inputTargetMapSize;
modifiedCols.resize(m_inputTargetMapSize, -1);
for (int map_ctr = 0; map_ctr < m_inputTargetMapSize; map_ctr++) {
// can't use column-id directly, otherwise we would go over vector bounds
int pos = m_inputTargetMap[map_ctr].first - 1;
modifiedCols.at(pos)
= m_inputTargetMap[map_ctr].second;
}
// Next, let the input tuple be the diff after image
afterImage = &m_inputTuple;
LogRecord *logrecord = new LogRecord(computeTimeStamp(),
LogRecord::T_UPDATE,// this is an update record
LogRecord::T_FORWARD,// the system is running normally
-1,// XXX: prevLSN must be fetched from table!
m_engine->getExecutorContext()->currentTxnId() ,// txn id
m_engine->getSiteId(),// which execution site
m_targetTable->name(),// the table affected
keyTuple,// primary key
numCols,
(numCols > 0) ? &modifiedCols : NULL,
beforeImage,
afterImage
);
size_t logrecordLength = logrecord->getEstimatedLength();
char *logrecordBuffer = new char[logrecordLength];
FallbackSerializeOutput output;
output.initializeWithPosition(logrecordBuffer, logrecordLength, 0);
logrecord->serializeTo(output);
LogManager* m_logManager = this->m_engine->getLogManager();
Logger m_ariesLogger = m_logManager->getAriesLogger();
//VOLT_WARN("m_logManager : %p AriesLogger : %p",&m_logManager, &m_ariesLogger);
const Logger *logger = m_logManager->getThreadLogger(LOGGERID_MM_ARIES);
logger->log(LOGLEVEL_INFO, output.data(), output.position());
delete[] logrecordBuffer;
logrecordBuffer = NULL;
delete logrecord;
logrecord = NULL;
if (keydata != NULL) {
delete[] keydata;
keydata = NULL;
}
if (keyTuple != NULL) {
delete keyTuple;
keyTuple = NULL;
}
}
}
#endif
if (!m_targetTable->updateTuple(tempTuple, m_targetTuple,
m_updatesIndexes)) {
VOLT_INFO("Failed to update tuple from table '%s'",
m_targetTable->name().c_str());
return false;
}
}
VOLT_TRACE("TARGET TABLE - AFTER: %s\n", m_targetTable->debug().c_str());
// TODO lets output result table here, not in result executor. same thing in
// delete/insert
// add to the planfragments count of modified tuples
m_engine->m_tuplesModified += m_inputTable->activeTupleCount();
return true;
}
示例2: p_execute
bool DeleteExecutor::p_execute(const NValueArray ¶ms, ReadWriteTracker *tracker) {
assert(m_targetTable);
if (m_truncate) {
VOLT_TRACE("truncating table %s...", m_targetTable->name().c_str());
// count the truncated tuples as deleted
m_engine->m_tuplesModified += m_inputTable->activeTupleCount();
#ifdef ARIES
if(m_engine->isARIESEnabled()){
// no need of persistency check, m_targetTable is
// always persistent for deletes
LogRecord *logrecord = new LogRecord(computeTimeStamp(),
LogRecord::T_TRUNCATE,// this is a truncate record
LogRecord::T_FORWARD,// the system is running normally
-1,// XXX: prevLSN must be fetched from table!
m_engine->getExecutorContext()->currentTxnId() ,// txn id
m_engine->getSiteId(),// which execution site
m_targetTable->name(),// the table affected
NULL,// primary key irrelevant
-1,// irrelevant numCols
NULL,// list of modified cols irrelevant
NULL,// before image irrelevant
NULL// after image irrelevant
);
size_t logrecordLength = logrecord->getEstimatedLength();
char *logrecordBuffer = new char[logrecordLength];
FallbackSerializeOutput output;
output.initializeWithPosition(logrecordBuffer, logrecordLength, 0);
logrecord->serializeTo(output);
LogManager* m_logManager = this->m_engine->getLogManager();
Logger m_ariesLogger = m_logManager->getAriesLogger();
//VOLT_WARN("m_logManager : %p AriesLogger : %p",&m_logManager, &m_ariesLogger);
const Logger *logger = m_logManager->getThreadLogger(LOGGERID_MM_ARIES);
logger->log(LOGLEVEL_INFO, output.data(), output.position());
delete[] logrecordBuffer;
logrecordBuffer = NULL;
delete logrecord;
logrecord = NULL;
}
#endif
//m_engine->context().incrementTuples(m_targetTable->activeTupleCount());
// actually delete all the tuples
m_targetTable->deleteAllTuples(true);
return true;
}
// XXX : ARIES : Not sure if else is needed ?
assert(m_inputTable);
assert(m_inputTuple.sizeInValues() == m_inputTable->columnCount());
assert(m_targetTuple.sizeInValues() == m_targetTable->columnCount());
TableIterator inputIterator(m_inputTable);
while (inputIterator.next(m_inputTuple)) {
//
// OPTIMIZATION: Single-Sited Query Plans
// If our beloved DeletePlanNode is apart of a single-site query plan,
// then the first column in the input table will be the address of a
// tuple on the target table that we will want to blow away. This saves
// us the trouble of having to do an index lookup
//
void *targetAddress = m_inputTuple.getNValue(0).castAsAddress();
m_targetTuple.move(targetAddress);
// Read/Write Set Tracking
if (tracker != NULL) {
tracker->markTupleWritten(m_targetTable, &m_targetTuple);
}
#ifdef ARIES
if(m_engine->isARIESEnabled()){
// no need of persistency check, m_targetTable is
// always persistent for deletes
// before image -- target is tuple to be deleted.
TableTuple *beforeImage = &m_targetTuple;
TableTuple *keyTuple = NULL;
char *keydata = NULL;
// See if we use an index instead
TableIndex *index = m_targetTable->primaryKeyIndex();
if (index != NULL) {
// First construct tuple for primary key
keydata = new char[index->getKeySchema()->tupleLength()];
keyTuple = new TableTuple(keydata, index->getKeySchema());
for (int i = 0; i < index->getKeySchema()->columnCount(); i++) {
keyTuple->setNValue(i, beforeImage->getNValue(index->getColumnIndices()[i]));
//.........这里部分代码省略.........