本文整理汇总了C++中OperationContextImpl::getCurOp方法的典型用法代码示例。如果您正苦于以下问题:C++ OperationContextImpl::getCurOp方法的具体用法?C++ OperationContextImpl::getCurOp怎么用?C++ OperationContextImpl::getCurOp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationContextImpl
的用法示例。
在下文中一共展示了OperationContextImpl::getCurOp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void IndexBuilder::run() {
Client::initThread(name().c_str());
LOG(2) << "IndexBuilder building index " << _index;
OperationContextImpl txn;
txn.lockState()->setIsBatchWriter(true);
txn.getClient()->getAuthorizationSession()->grantInternalAuthorization();
txn.getCurOp()->reset(HostAndPort(), dbInsert);
NamespaceString ns(_index["ns"].String());
ScopedTransaction transaction(&txn, MODE_IX);
Lock::DBLock dlk(txn.lockState(), ns.db(), MODE_X);
Client::Context ctx(&txn, ns.getSystemIndexesCollection());
Database* db = dbHolder().get(&txn, ns.db().toString());
Status status = _build(&txn, db, true, &dlk);
if ( !status.isOK() ) {
error() << "IndexBuilder could not build index: " << status.toString();
fassert(28555, ErrorCodes::isInterruption(status.code()));
}
txn.getClient()->shutdown();
}
示例2: run
void IndexBuilder::run() {
LOG(2) << "IndexBuilder building index " << _index;
OperationContextImpl txn;
Client::initThread(name().c_str());
Lock::ParallelBatchWriterMode::iAmABatchParticipant(txn.lockState());
cc().getAuthorizationSession()->grantInternalAuthorization();
txn.getCurOp()->reset(HostAndPort(), dbInsert);
NamespaceString ns(_index["ns"].String());
Client::WriteContext ctx(&txn, ns.getSystemIndexesCollection());
Database* db = dbHolder().get(&txn, ns.db().toString());
Status status = build(&txn, db, true);
if ( !status.isOK() ) {
log() << "IndexBuilder could not build index: " << status.toString();
}
ctx.commit();
txn.getClient()->shutdown();
}