当前位置: 首页>>代码示例>>C++>>正文


C++ PlanExecutor::releaseStages方法代码示例

本文整理汇总了C++中PlanExecutor::releaseStages方法的典型用法代码示例。如果您正苦于以下问题:C++ PlanExecutor::releaseStages方法的具体用法?C++ PlanExecutor::releaseStages怎么用?C++ PlanExecutor::releaseStages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlanExecutor的用法示例。


在下文中一共展示了PlanExecutor::releaseStages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: work

    PlanStage::StageState SubplanStage::work(WorkingSetID* out) {
        ++_commonStats.works;

        // Adds the amount of time taken by work() to executionTimeMillis.
        ScopedTimer timer(&_commonStats.executionTimeMillis);

        if (_killed) {
            return PlanStage::DEAD;
        }

        if (isEOF()) { return PlanStage::IS_EOF; }

        if (SubplanStage::PLANNING == _state) {
            // Try to run as sub-plans.
            if (runSubplans()) {
                // If runSubplans returns true we expect something here.
                invariant(_child.get());
            }
            else if (!_killed) {
                // Couldn't run as subplans so we'll just call normal getExecutor.
                PlanExecutor* exec;
                Status status = getExecutorAlwaysPlan(_collection, _query, _plannerParams, &exec);

                if (!status.isOK()) {
                    // We utterly failed.
                    _killed = true;

                    // Propagate the error to the user wrapped in a BSONObj
                    WorkingSetID id = _ws->allocate();
                    WorkingSetMember* member = _ws->get(id);
                    member->state = WorkingSetMember::OWNED_OBJ;
                    member->keyData.clear();
                    member->loc = DiskLoc();

                    BSONObjBuilder bob;
                    bob.append("ok", status.isOK() ? 1.0 : 0.0);
                    bob.append("code", status.code());
                    bob.append("errmsg", status.reason());
                    member->obj = bob.obj();

                    *out = id;
                    return PlanStage::FAILURE;
                }
                else {
                    scoped_ptr<PlanExecutor> cleanupExec(exec);
                    _child.reset(exec->releaseStages());
                }
            }

            // We can change state when we're either killed or we have an underlying runner.
            invariant(_killed || NULL != _child.get());
            _state = SubplanStage::RUNNING;
        }

        if (_killed) {
            return PlanStage::DEAD;
        }

        if (isEOF()) {
            return PlanStage::IS_EOF;
        }

        // If we're here we should have planned already.
        invariant(SubplanStage::RUNNING == _state);
        invariant(_child.get());
        return _child->work(out);
    }
开发者ID:DesignByOnyx,项目名称:mongo,代码行数:67,代码来源:subplan.cpp


注:本文中的PlanExecutor::releaseStages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。