diff options
author | David Storch <david.storch@10gen.com> | 2018-01-09 17:57:41 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2018-01-11 18:43:25 -0500 |
commit | e377025071e4c9fff336fc57741e5cc8511607af (patch) | |
tree | d34bb3208881fecce2d41b1905fe34d849f1d92c /src/mongo/s | |
parent | c16959f19705772d01e1053899048869aafe4537 (diff) | |
download | mongo-e377025071e4c9fff336fc57741e5cc8511607af.tar.gz |
SERVER-32603 Modernize QueryPlanner methods to use unique_ptr.
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/chunk_manager.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp index 9445aa7b1da..1644a79782c 100644 --- a/src/mongo/s/chunk_manager.cpp +++ b/src/mongo/s/chunk_manager.cpp @@ -237,17 +237,15 @@ IndexBounds ChunkManager::getIndexBoundsForQuery(const BSONObj& key, NULL /* collator */); plannerParams.indices.push_back(indexEntry); - OwnedPointerVector<QuerySolution> solutions; - Status status = QueryPlanner::plan(canonicalQuery, plannerParams, &solutions.mutableVector()); - uassert(status.code(), status.reason(), status.isOK()); + auto statusWithSolutions = QueryPlanner::plan(canonicalQuery, plannerParams); + uassertStatusOK(statusWithSolutions.getStatus()); + auto solutions = std::move(statusWithSolutions.getValue()); IndexBounds bounds; - for (std::vector<QuerySolution*>::const_iterator it = solutions.begin(); - bounds.size() == 0 && it != solutions.end(); - it++) { + for (auto&& soln : solutions) { // Try next solution if we failed to generate index bounds, i.e. bounds.size() == 0 - bounds = collapseQuerySolution((*it)->root.get()); + bounds = collapseQuerySolution(soln->root.get()); } if (bounds.size() == 0) { |