Skip to content

Commit

Permalink
fixed lookup bug for double free (vesoft-inc#1855)
Browse files Browse the repository at this point in the history
* fixed lookup bug for double free

* improved scan logic, return error directly when any part error occur.

Co-authored-by: dangleptr <37216992+dangleptr@users.noreply.github.com>
  • Loading branch information
dangleptr authored Mar 5, 2020
1 parent 72af573 commit 0f2ce83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/storage/index/LookUpEdgeIndexProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void LookUpEdgeIndexProcessor::process(const cpp2::LookUpIndexRequest& req) {
/**
* step 3 : execute index scan.
*/
std::for_each(req.get_parts().begin(), req.get_parts().end(), [&](auto& partId) {
for (auto partId : req.get_parts()) {
auto code = executeExecutionPlan(partId);
if (code != kvstore::ResultCode::SUCCEEDED) {
VLOG(1) << "Error! ret = " << static_cast<int32_t>(code)
Expand All @@ -45,7 +45,7 @@ void LookUpEdgeIndexProcessor::process(const cpp2::LookUpIndexRequest& req) {
this->onFinished();
return;
}
});
}

/**
* step 4 : collect result.
Expand Down
4 changes: 2 additions & 2 deletions src/storage/index/LookUpVertexIndexProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void LookUpVertexIndexProcessor::process(const cpp2::LookUpIndexRequest& req) {
/**
* step 3 : execute index scan.
*/
std::for_each(req.get_parts().begin(), req.get_parts().end(), [&](auto& partId) {
for (auto partId : req.get_parts()) {
auto code = executeExecutionPlan(partId);
if (code != kvstore::ResultCode::SUCCEEDED) {
VLOG(1) << "Error! ret = " << static_cast<int32_t>(code)
Expand All @@ -45,7 +45,7 @@ void LookUpVertexIndexProcessor::process(const cpp2::LookUpIndexRequest& req) {
this->onFinished();
return;
}
});
}

/**
* step 4 : collect result.
Expand Down

0 comments on commit 0f2ce83

Please sign in to comment.