本文整理汇总了C++中WiredTigerSession类的典型用法代码示例。如果您正苦于以下问题:C++ WiredTigerSession类的具体用法?C++ WiredTigerSession怎么用?C++ WiredTigerSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WiredTigerSession类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TEST
TEST(WiredTigerUtilTest, GetStatisticsValueAsUInt8) {
WiredTigerUtilHarnessHelper harnessHelper("statistics=(all)");
WiredTigerRecoveryUnit recoveryUnit(harnessHelper.getSessionCache());
WiredTigerSession* session = recoveryUnit.getSession(NULL);
WT_SESSION* wtSession = session->getSession();
ASSERT_OK(wtRCToStatus(wtSession->create(wtSession, "table:mytable", NULL)));
// Use data source statistics that has a value > 256 on an empty table.
StatusWith<uint64_t> resultUInt64 = WiredTigerUtil::getStatisticsValue(
session->getSession(),
"statistics:table:mytable", "statistics=(fast)", WT_STAT_DSRC_ALLOCATION_SIZE);
ASSERT_OK(resultUInt64.getStatus());
ASSERT_GREATER_THAN(resultUInt64.getValue(),
static_cast<uint64_t>(std::numeric_limits<uint8_t>::max()));
// Ensure that statistics value retrieved as an 8-bit unsigned value
// is capped at maximum value for that type.
StatusWith<uint8_t> resultUInt8 = WiredTigerUtil::getStatisticsValueAs<uint8_t>(
session->getSession(),
"statistics:table:mytable", "statistics=(fast)", WT_STAT_DSRC_ALLOCATION_SIZE);
ASSERT_OK(resultUInt8.getStatus());
ASSERT_EQUALS(std::numeric_limits<uint8_t>::max(), resultUInt8.getValue());
// Read statistics value as signed 16-bit value with alternative maximum value to
// std::numeric_limits.
StatusWith<int16_t> resultInt16 = WiredTigerUtil::getStatisticsValueAs<int16_t>(
session->getSession(),
"statistics:table:mytable", "statistics=(fast)", WT_STAT_DSRC_ALLOCATION_SIZE,
static_cast<int16_t>(100));
ASSERT_OK(resultInt16.getStatus());
ASSERT_EQUALS(static_cast<uint8_t>(100), resultInt16.getValue());
}
开发者ID:ForNowForever,项目名称:mongo,代码行数:32,代码来源:wiredtiger_util_test.cpp
示例2: lk
BSONObj WiredTigerServerStatusSection::generateSection(OperationContext* opCtx,
const BSONElement& configElement) const {
Lock::GlobalLock lk(opCtx, LockMode::MODE_IS);
// The session does not open a transaction here as one is not needed and opening one would
// mean that execution could become blocked when a new transaction cannot be allocated
// immediately.
WiredTigerSession* session = WiredTigerRecoveryUnit::get(opCtx)->getSessionNoTxn();
invariant(session);
WT_SESSION* s = session->getSession();
invariant(s);
const string uri = "statistics:";
BSONObjBuilder bob;
Status status = WiredTigerUtil::exportTableToBSON(s, uri, "statistics=(fast)", &bob);
if (!status.isOK()) {
bob.append("error", "unable to retrieve statistics");
bob.append("code", static_cast<int>(status.code()));
bob.append("reason", status.reason());
}
WiredTigerKVEngine::appendGlobalStats(bob);
WiredTigerUtil::appendSnapshotWindowSettings(_engine, session, &bob);
return bob.obj();
}
开发者ID:EvgeniyPatlan,项目名称:percona-server-mongodb,代码行数:28,代码来源:wiredtiger_server_status.cpp
示例3: _ensureSession
WiredTigerSession* WiredTigerRecoveryUnit::getSessionNoTxn() {
_ensureSession();
WiredTigerSession* session = _session.get();
// Handling queued drops can be slow, which is not desired for internal operations like FTDC
// sampling. Disable handling of queued drops for such sessions.
session->dropQueuedIdentsAtSessionEndAllowed(false);
return session;
}
开发者ID:ajdavis,项目名称:mongo,代码行数:9,代码来源:wiredtiger_recovery_unit.cpp
示例4: repairIdent
Status WiredTigerKVEngine::repairIdent(OperationContext* opCtx, StringData ident) {
WiredTigerSession* session = WiredTigerRecoveryUnit::get(opCtx)->getSession(opCtx);
session->closeAllCursors();
if (isEphemeral()) {
return Status::OK();
}
string uri = _uri(ident);
return _salvageIfNeeded(uri.c_str());
}
开发者ID:carlyrobison,项目名称:mongo,代码行数:9,代码来源:wiredtiger_kv_engine.cpp
示例5: compact
Status WiredTigerRecordStore::compact(OperationContext* txn,
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats) {
WiredTigerSessionCache* cache = WiredTigerRecoveryUnit::get(txn)->getSessionCache();
WiredTigerSession* session = cache->getSession();
WT_SESSION* s = session->getSession();
int ret = s->compact(s, getURI().c_str(), "timeout=0");
invariantWTOK(ret);
cache->releaseSession(session);
return Status::OK();
}
开发者ID:MrChen2015,项目名称:mongo,代码行数:12,代码来源:wiredtiger_record_store.cpp
示例6: appendCustomStats
void WiredTigerRecordStore::appendCustomStats(OperationContext* txn,
BSONObjBuilder* result,
double scale) const {
result->appendBool("capped", _isCapped);
if (_isCapped) {
result->appendIntOrLL("max", _cappedMaxDocs);
result->appendIntOrLL("maxSize", static_cast<long long>(_cappedMaxSize / scale));
result->appendIntOrLL("sleepCount", _cappedSleep.load());
result->appendIntOrLL("sleepMS", _cappedSleepMS.load());
}
WiredTigerSession* session = WiredTigerRecoveryUnit::get(txn)->getSession(txn);
WT_SESSION* s = session->getSession();
BSONObjBuilder bob(result->subobjStart(kWiredTigerEngineName));
{
BSONObjBuilder metadata(bob.subobjStart("metadata"));
Status status = WiredTigerUtil::getApplicationMetadata(txn, getURI(), &metadata);
if (!status.isOK()) {
metadata.append("error", "unable to retrieve metadata");
metadata.append("code", static_cast<int>(status.code()));
metadata.append("reason", status.reason());
}
}
std::string type, sourceURI;
WiredTigerUtil::fetchTypeAndSourceURI(txn, _uri, &type, &sourceURI);
StatusWith<std::string> metadataResult = WiredTigerUtil::getMetadata(txn, sourceURI);
StringData creationStringName("creationString");
if (!metadataResult.isOK()) {
BSONObjBuilder creationString(bob.subobjStart(creationStringName));
creationString.append("error", "unable to retrieve creation config");
creationString.append("code", static_cast<int>(metadataResult.getStatus().code()));
creationString.append("reason", metadataResult.getStatus().reason());
} else {
bob.append("creationString", metadataResult.getValue());
// Type can be "lsm" or "file"
bob.append("type", type);
}
Status status =
WiredTigerUtil::exportTableToBSON(s, "statistics:" + getURI(), "statistics=(fast)", &bob);
if (!status.isOK()) {
bob.append("error", "unable to retrieve statistics");
bob.append("code", static_cast<int>(status.code()));
bob.append("reason", status.reason());
}
}
开发者ID:MrChen2015,项目名称:mongo,代码行数:46,代码来源:wiredtiger_record_store.cpp
示例7: storageSize
int64_t WiredTigerRecordStore::storageSize(OperationContext* txn,
BSONObjBuilder* extraInfo,
int infoLevel) const {
WiredTigerSession* session = WiredTigerRecoveryUnit::get(txn)->getSession(txn);
StatusWith<int64_t> result =
WiredTigerUtil::getStatisticsValueAs<int64_t>(session->getSession(),
"statistics:" + getURI(),
"statistics=(size)",
WT_STAT_DSRC_BLOCK_SIZE);
uassertStatusOK(result.getStatus());
int64_t size = result.getValue();
if (size == 0 && _isCapped) {
// Many things assume an empty capped collection still takes up space.
return 1;
}
return size;
}
开发者ID:MrChen2015,项目名称:mongo,代码行数:19,代码来源:wiredtiger_record_store.cpp
示例8: generateSection
BSONObj WiredTigerServerStatusSection::generateSection(OperationContext* txn,
const BSONElement& configElement) const {
WiredTigerSession* session =
checked_cast<WiredTigerRecoveryUnit*>(txn->recoveryUnit())->getSession(txn);
invariant(session);
WT_SESSION* s = session->getSession();
invariant(s);
const string uri = "statistics:";
BSONObjBuilder bob;
Status status = WiredTigerUtil::exportTableToBSON(s, uri, "statistics=(fast)", &bob);
if (!status.isOK()) {
bob.append("error", "unable to retrieve statistics");
bob.append("code", static_cast<int>(status.code()));
bob.append("reason", status.reason());
}
WiredTigerRecoveryUnit::appendGlobalStats(bob);
return bob.obj();
}
开发者ID:Andiry,项目名称:mongo,代码行数:22,代码来源:wiredtiger_server_status.cpp
示例9: getIdentSize
int64_t WiredTigerKVEngine::getIdentSize(OperationContext* opCtx, StringData ident) {
WiredTigerSession* session = WiredTigerRecoveryUnit::get(opCtx)->getSession(opCtx);
return WiredTigerUtil::getIdentSize(session->getSession(), _uri(ident));
}
开发者ID:carlyrobison,项目名称:mongo,代码行数:4,代码来源:wiredtiger_kv_engine.cpp
注:本文中的WiredTigerSession类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论