Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Jul 7, 2023
1 parent b415ad9 commit 2ef2e5b
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/graph/executor/algo/AllPathsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ folly::Future<Status> AllPathsExecutor::buildResult() {
return future.via(runner())
.ensure([this, buildPathTime]() { addState("build_path_time", buildPathTime); })
.thenValue([this](auto&& resp) {
memory::MemoryCheckGuard guard;
UNUSED(resp);
if (!withProp_ || emptyPropVids_.empty()) {
finish(ResultBuilder().value(Value(std::move(result_))).build());
Expand Down Expand Up @@ -259,7 +260,6 @@ folly::Future<std::vector<AllPathsExecutor::NPath*>> AllPathsExecutor::doBuildPa
size_t end,
std::shared_ptr<std::vector<NPath*>> pathsPtr,
bool reverse) {
memory::MemoryCheckGuard guard;
auto maxStep = reverse ? rightSteps_ : leftSteps_;
if (step > maxStep) {
return folly::makeFuture<std::vector<NPath*>>(std::vector<NPath*>());
Expand Down Expand Up @@ -334,6 +334,7 @@ folly::Future<std::vector<AllPathsExecutor::NPath*>> AllPathsExecutor::doBuildPa
}
return folly::collect(futures).via(runner()).thenValue(
[currentStepResult = newPathsPtr](std::vector<std::vector<NPath*>>&& paths) {
memory::MemoryCheckGuard guard;
std::vector<NPath*> result = std::move(*currentStepResult);
for (auto& path : paths) {
if (path.empty()) {
Expand Down Expand Up @@ -458,7 +459,7 @@ std::vector<Row> AllPathsExecutor::buildOneWayPathFromHashTable(bool reverse) {

folly::Future<Status> AllPathsExecutor::conjunctPath(std::vector<NPath*>& leftPaths,
std::vector<NPath*>& rightPaths) {
memory::MemoryCheckGuard guard;
// memory::MemoryCheckGuard guard;
if (leftPaths.empty() || rightPaths.empty()) {
return folly::makeFuture<Status>(Status::OK());
}
Expand All @@ -476,18 +477,23 @@ folly::Future<Status> AllPathsExecutor::conjunctPath(std::vector<NPath*>& leftPa
size_t probeSize = probePaths_.size();
std::vector<folly::Future<std::vector<Row>>> futures;
if (probeSize < FLAGS_path_batch_size) {
futures.emplace_back(folly::via(
runner(), [this, probeSize, reverse]() { return probe(0, probeSize, reverse); }));
futures.emplace_back(folly::via(runner(), [this, probeSize, reverse]() {
memory::MemoryCheckGuard guard;
return probe(0, probeSize, reverse);
}));
} else {
for (size_t start = 0; start < probeSize; start += FLAGS_path_batch_size) {
auto tmp = start + FLAGS_path_batch_size;
auto end = tmp > probeSize ? probeSize : tmp;
futures.emplace_back(folly::via(
runner(), [this, start, end, reverse]() { return probe(start, end, reverse); }));
futures.emplace_back(folly::via(runner(), [this, start, end, reverse]() {
memory::MemoryCheckGuard guard;
return probe(start, end, reverse);
}));
}
}
return folly::collect(futures).via(runner()).thenValue(
[this, path = std::move(oneWayPath)](std::vector<std::vector<Row>>&& resps) {
memory::MemoryCheckGuard guard;
result_.rows = std::move(path);
for (auto& rows : resps) {
if (rows.empty()) {
Expand Down Expand Up @@ -528,7 +534,6 @@ void AllPathsExecutor::buildHashTable(std::vector<NPath*>& paths, bool reverse)
}

std::vector<Row> AllPathsExecutor::probe(size_t start, size_t end, bool reverse) {
memory::MemoryCheckGuard guard;
auto buildPath = [](std::vector<Value>& leftPath,
const Value& intersectVertex,
std::vector<Value>& rightPath) {
Expand Down

0 comments on commit 2ef2e5b

Please sign in to comment.