本文整理汇总了C++中SharedDatabase::recover方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedDatabase::recover方法的具体用法?C++ SharedDatabase::recover怎么用?C++ SharedDatabase::recover使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedDatabase
的用法示例。
在下文中一共展示了SharedDatabase::recover方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
void CmdInterpreter::visit(ProxyCmdOpenDatabase &cmd)
{
ConfigMap configMap;
SharedProxyDatabaseParam pParam = cmd.getParams();
for (; pParam; ++pParam) {
configMap.setStringParam(pParam->getName(), pParam->getValue());
}
CacheParams cacheParams;
cacheParams.readConfig(configMap);
SharedCache pCache = Cache::newCache(cacheParams);
JniUtilParams jniUtilParams;
jniUtilParams.readConfig(configMap);
JniUtil::configure(jniUtilParams);
DeviceMode openMode = cmd.isCreateDatabase()
? DeviceMode::createNew
: DeviceMode::load;
std::auto_ptr<DbHandle> pDbHandle(newDbHandle());
JniUtil::incrementHandleCount(DBHANDLE_TRACE_TYPE_STR, pDbHandle.get());
JavaTraceTarget *pJavaTraceTarget = newTraceTarget();
pDbHandle->pTraceTarget.reset(pJavaTraceTarget);
// on a fatal error, echo the backtrace to the log file:
AutoBacktrace::setTraceTarget(pDbHandle->pTraceTarget);
SharedDatabase pDb;
try {
pDb = Database::newDatabase(
pCache,
configMap,
openMode,
pDbHandle->pTraceTarget,
SharedPseudoUuidGenerator(new JniPseudoUuidGenerator()));
} catch (...) {
AutoBacktrace::setTraceTarget();
throw;
}
pDbHandle->pDb = pDb;
ExecStreamResourceKnobs knobSettings;
knobSettings.cacheReservePercentage =
configMap.getIntParam("cacheReservePercentage");
knobSettings.expectedConcurrentStatements =
configMap.getIntParam("expectedConcurrentStatements");
ExecStreamResourceQuantity resourcesAvailable;
resourcesAvailable.nCachePages = pCache->getMaxLockedPages();
pDbHandle->pResourceGovernor =
SharedExecStreamGovernor(
new SimpleExecStreamGovernor(
knobSettings, resourcesAvailable,
pDbHandle->pTraceTarget,
"xo.resourceGovernor"));
if (pDb->isRecoveryRequired()) {
SegmentAccessor scratchAccessor =
pDb->getSegmentFactory()->newScratchSegment(pDb->getCache());
FtrsTableWriterFactory recoveryFactory(
pDb,
pDb->getCache(),
pDb->getTypeFactory(),
scratchAccessor);
pDb->recover(recoveryFactory);
cmd.setResultRecoveryRequired(true);
} else {
cmd.setResultRecoveryRequired(false);
}
pDbHandle->statsTimer.setTarget(*pJavaTraceTarget);
pDbHandle->statsTimer.addSource(pDb);
pDbHandle->statsTimer.addSource(pDbHandle->pResourceGovernor);
pDbHandle->statsTimer.start();
// Cache initialization may have been unable to allocate the requested
// number of pages -- check for this case and report it in the log.
if (pCache->getMaxAllocatedPageCount() != cacheParams.nMemPagesMax
|| pCache->getAllocatedPageCount() != cacheParams.nMemPagesInit)
{
FENNEL_DELEGATE_TRACE(
TRACE_WARNING,
pDb,
"Unable to allocate "
<< cacheParams.nMemPagesInit
<< " (of "
<< cacheParams.nMemPagesMax
<< " max) cache pages; allocated "
<< pCache->getAllocatedPageCount()
<< " cache pages.");
}
setDbHandle(cmd.getResultHandle(), pDbHandle.release());
}