From de348ab393252f8eb0f1ab2129366ad51e26d0da Mon Sep 17 00:00:00 2001 From: Hao Wen <19355821+wenhaocs@users.noreply.github.com> Date: Sat, 20 Nov 2021 13:10:41 +0800 Subject: [PATCH 1/8] change name --- src/common/utils/MetaKeyUtils.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/utils/MetaKeyUtils.cpp b/src/common/utils/MetaKeyUtils.cpp index 3018051273d..a93c5174a08 100644 --- a/src/common/utils/MetaKeyUtils.cpp +++ b/src/common/utils/MetaKeyUtils.cpp @@ -877,15 +877,15 @@ std::string MetaKeyUtils::idKey() { return kIdKey; } std::string MetaKeyUtils::balanceTaskKey( JobID jobId, GraphSpaceID spaceId, PartitionID partId, HostAddr src, HostAddr dst) { - std::string str; - str.reserve(64); - str.append(reinterpret_cast(kBalanceTaskTable.data()), kBalanceTaskTable.size()) + std::string key; + key.reserve(64); + key.append(reinterpret_cast(kBalanceTaskTable.data()), kBalanceTaskTable.size()) .append(reinterpret_cast(&jobId), sizeof(JobID)) .append(reinterpret_cast(&spaceId), sizeof(GraphSpaceID)) .append(reinterpret_cast(&partId), sizeof(PartitionID)) .append(serializeHostAddr(src)) .append(serializeHostAddr(dst)); - return str; + return key; } std::string MetaKeyUtils::balanceTaskVal(BalanceTaskStatus status, From d245d99b9e7cc8a26088976d8ad21233dfaec10f Mon Sep 17 00:00:00 2001 From: Hao Wen <19355821+wenhaocs@users.noreply.github.com> Date: Tue, 23 Nov 2021 11:06:19 +0800 Subject: [PATCH 2/8] some name change --- src/storage/exec/RelNode.h | 7 ++++--- src/storage/exec/StoragePlan.h | 8 ++++---- src/storage/test/StorageDAGBenchmark.cpp | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/storage/exec/RelNode.h b/src/storage/exec/RelNode.h index 8bc0f2ff39f..888a29d344c 100644 --- a/src/storage/exec/RelNode.h +++ b/src/storage/exec/RelNode.h @@ -67,8 +67,9 @@ class RelNode { } void addDependency(RelNode* dep) { - dependencies_.emplace_back(dep); - dep->hasDependents_ = true; + dependencies_.emplace_back( + dep); // Need to rename. Edge depends on HashJoin. Why edge is the depency of hashjoin + dep->isRoot_ = false; } RelNode() = default; @@ -81,7 +82,7 @@ class RelNode { std::string name_ = "RelNode"; std::vector*> dependencies_; - bool hasDependents_ = false; + bool isRoot_ = true; time::Duration duration_{true}; }; diff --git a/src/storage/exec/StoragePlan.h b/src/storage/exec/StoragePlan.h index 0c48daa0dc8..77d26af1b1c 100644 --- a/src/storage/exec/StoragePlan.h +++ b/src/storage/exec/StoragePlan.h @@ -36,11 +36,11 @@ template class StoragePlan { public: nebula::cpp2::ErrorCode go(PartitionID partId, const T& input) { - // find all leaf nodes, and a dummy output node depends on all leaf node. + // find all root nodes, and a dummy output node depends on all root nodes. if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { - if (!node->hasDependents_) { + if (node->isRoot_) { // add dependency of output node output->addDependency(node.get()); } @@ -54,11 +54,11 @@ class StoragePlan { } nebula::cpp2::ErrorCode go(PartitionID partId) { - // find all leaf nodes, and a dummy output node depends on all leaf node. + // find all root nodes, and a dummy output node depends on all root nodes. if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { - if (!node->hasDependents_) { + if (node->isRoot_) { // add dependency of output node output->addDependency(node.get()); } diff --git a/src/storage/test/StorageDAGBenchmark.cpp b/src/storage/test/StorageDAGBenchmark.cpp index a515e1527ed..03aa170221e 100644 --- a/src/storage/test/StorageDAGBenchmark.cpp +++ b/src/storage/test/StorageDAGBenchmark.cpp @@ -27,7 +27,7 @@ class FutureNode { void addDependency(FutureNode* dep) { dependencies_.emplace_back(dep); - dep->hasDependents_ = true; + dep->isRoot_ = false; } FutureNode() = default; @@ -39,7 +39,7 @@ class FutureNode { std::string name_; folly::SharedPromise promise_; std::vector*> dependencies_; - bool hasDependents_ = false; + bool isRoot_ = true; }; template @@ -56,7 +56,7 @@ class FutureDAG { // add dependency of root node node->addDependency(input.get()); } - if (!node->hasDependents_) { + if (node->isRoot_) { // add dependency of output node output->addDependency(node.get()); } From e7f54d09a43829fc310a42157f655a157eb8174f Mon Sep 17 00:00:00 2001 From: Hao Wen <19355821+wenhaocs@users.noreply.github.com> Date: Tue, 23 Nov 2021 11:09:31 +0800 Subject: [PATCH 3/8] comment --- src/storage/exec/RelNode.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/storage/exec/RelNode.h b/src/storage/exec/RelNode.h index 888a29d344c..0ced30c536c 100644 --- a/src/storage/exec/RelNode.h +++ b/src/storage/exec/RelNode.h @@ -67,8 +67,7 @@ class RelNode { } void addDependency(RelNode* dep) { - dependencies_.emplace_back( - dep); // Need to rename. Edge depends on HashJoin. Why edge is the depency of hashjoin + dependencies_.emplace_back(dep); dep->isRoot_ = false; } From db4d05ef8d6db61b9c661f5c9ce0060bc6644e66 Mon Sep 17 00:00:00 2001 From: Hao Wen <19355821+wenhaocs@users.noreply.github.com> Date: Fri, 26 Nov 2021 19:16:23 +0800 Subject: [PATCH 4/8] update name --- src/storage/exec/RelNode.h | 4 ++-- src/storage/exec/StoragePlan.h | 4 ++-- src/storage/test/StorageDAGBenchmark.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/storage/exec/RelNode.h b/src/storage/exec/RelNode.h index 0ced30c536c..f2c1d891180 100644 --- a/src/storage/exec/RelNode.h +++ b/src/storage/exec/RelNode.h @@ -68,7 +68,7 @@ class RelNode { void addDependency(RelNode* dep) { dependencies_.emplace_back(dep); - dep->isRoot_ = false; + dep->isDependent_ = true; } RelNode() = default; @@ -81,7 +81,7 @@ class RelNode { std::string name_ = "RelNode"; std::vector*> dependencies_; - bool isRoot_ = true; + bool isDependent_ = false; time::Duration duration_{true}; }; diff --git a/src/storage/exec/StoragePlan.h b/src/storage/exec/StoragePlan.h index 77d26af1b1c..d8f25f115b7 100644 --- a/src/storage/exec/StoragePlan.h +++ b/src/storage/exec/StoragePlan.h @@ -40,7 +40,7 @@ class StoragePlan { if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { - if (node->isRoot_) { + if (!node->isDependent_) { // add dependency of output node output->addDependency(node.get()); } @@ -58,7 +58,7 @@ class StoragePlan { if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { - if (node->isRoot_) { + if (node->isDependent_) { // add dependency of output node output->addDependency(node.get()); } diff --git a/src/storage/test/StorageDAGBenchmark.cpp b/src/storage/test/StorageDAGBenchmark.cpp index 03aa170221e..c06f779f0b6 100644 --- a/src/storage/test/StorageDAGBenchmark.cpp +++ b/src/storage/test/StorageDAGBenchmark.cpp @@ -27,7 +27,7 @@ class FutureNode { void addDependency(FutureNode* dep) { dependencies_.emplace_back(dep); - dep->isRoot_ = false; + dep->isDependent_ = true; } FutureNode() = default; @@ -39,7 +39,7 @@ class FutureNode { std::string name_; folly::SharedPromise promise_; std::vector*> dependencies_; - bool isRoot_ = true; + bool isDependent_ = false; }; template @@ -56,7 +56,7 @@ class FutureDAG { // add dependency of root node node->addDependency(input.get()); } - if (node->isRoot_) { + if (!node->isDependent_) { // add dependency of output node output->addDependency(node.get()); } From 43ebc7c6a1dda5df570e97bfe04a2ee04b1a054a Mon Sep 17 00:00:00 2001 From: Hao Wen <19355821+wenhaocs@users.noreply.github.com> Date: Fri, 26 Nov 2021 19:22:27 +0800 Subject: [PATCH 5/8] update comment --- src/storage/exec/StoragePlan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage/exec/StoragePlan.h b/src/storage/exec/StoragePlan.h index d8f25f115b7..3def60f5164 100644 --- a/src/storage/exec/StoragePlan.h +++ b/src/storage/exec/StoragePlan.h @@ -36,7 +36,7 @@ template class StoragePlan { public: nebula::cpp2::ErrorCode go(PartitionID partId, const T& input) { - // find all root nodes, and a dummy output node depends on all root nodes. + // find all nodes without dependents, and a dummy output node depends on all these nodes. if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { @@ -54,7 +54,7 @@ class StoragePlan { } nebula::cpp2::ErrorCode go(PartitionID partId) { - // find all root nodes, and a dummy output node depends on all root nodes. + // find all nodes without dependents, and a dummy output node depends on all these nodes. if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { From fcf76e71ff70c429f80f54fba903c3024e109f9d Mon Sep 17 00:00:00 2001 From: Hao Wen <19355821+wenhaocs@users.noreply.github.com> Date: Fri, 26 Nov 2021 19:23:38 +0800 Subject: [PATCH 6/8] update comments --- src/storage/exec/StoragePlan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage/exec/StoragePlan.h b/src/storage/exec/StoragePlan.h index 3def60f5164..34e57913c08 100644 --- a/src/storage/exec/StoragePlan.h +++ b/src/storage/exec/StoragePlan.h @@ -36,7 +36,7 @@ template class StoragePlan { public: nebula::cpp2::ErrorCode go(PartitionID partId, const T& input) { - // find all nodes without dependents, and a dummy output node depends on all these nodes. + // find all nodes without dependents, and a dummy output node depends on all those nodes. if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { @@ -54,7 +54,7 @@ class StoragePlan { } nebula::cpp2::ErrorCode go(PartitionID partId) { - // find all nodes without dependents, and a dummy output node depends on all these nodes. + // find all nodes without dependents, and a dummy output node depends on all those nodes. if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { From 5c38727e602a75a4d7ba7c826114f9163b26894d Mon Sep 17 00:00:00 2001 From: Hao Wen <19355821+wenhaocs@users.noreply.github.com> Date: Tue, 30 Nov 2021 11:13:34 +0800 Subject: [PATCH 7/8] fix typo --- src/storage/exec/StoragePlan.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/exec/StoragePlan.h b/src/storage/exec/StoragePlan.h index 34e57913c08..6b57c80fef5 100644 --- a/src/storage/exec/StoragePlan.h +++ b/src/storage/exec/StoragePlan.h @@ -58,7 +58,7 @@ class StoragePlan { if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { - if (node->isDependent_) { + if (!node->isDependent_) { // add dependency of output node output->addDependency(node.get()); } From 9182963e4002ae9f86929ebcb927134b8efd87ea Mon Sep 17 00:00:00 2001 From: Hao Wen <19355821+wenhaocs@users.noreply.github.com> Date: Wed, 1 Dec 2021 13:13:24 +0800 Subject: [PATCH 8/8] update comment --- src/storage/exec/StoragePlan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage/exec/StoragePlan.h b/src/storage/exec/StoragePlan.h index 6b57c80fef5..5a659bcccda 100644 --- a/src/storage/exec/StoragePlan.h +++ b/src/storage/exec/StoragePlan.h @@ -36,7 +36,7 @@ template class StoragePlan { public: nebula::cpp2::ErrorCode go(PartitionID partId, const T& input) { - // find all nodes without dependents, and a dummy output node depends on all those nodes. + // find all end nodes (without dependents), and a dummy output node depends on all those nodes. if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) { @@ -54,7 +54,7 @@ class StoragePlan { } nebula::cpp2::ErrorCode go(PartitionID partId) { - // find all nodes without dependents, and a dummy output node depends on all those nodes. + // find all end nodes (without dependents), and a dummy output node depends on all those nodes. if (firstLoop_) { auto output = std::make_unique>(); for (const auto& node : nodes_) {