Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[urgent] Support delete vertices #1317

Merged
merged 18 commits into from
Mar 3, 2020
Merged

[urgent] Support delete vertices #1317

merged 18 commits into from
Mar 3, 2020

Conversation

darionyaphet
Copy link
Contributor

DELETE VERTEX vid_list

@zhangguoqing
Copy link
Contributor

I suggest using a flag to indicate if deleting a vertex is allowed to delete all its associated edges or only delete one vertex without any associated edges.

@darionyaphet
Copy link
Contributor Author

I suggest using a flag to indicate if deleting a vertex is allowed to delete all its associated edges or only delete one vertex without any associated edges.

If the vertex does not exist, is the edge meaningful?

@@ -70,7 +86,7 @@ void DeleteVertexExecutor::execute() {
std::move(future).via(runner).thenValue(cb).thenError(error);
}

void DeleteVertexExecutor::deleteEdges(std::vector<storage::cpp2::EdgeKey>* edges) {
void DeleteVerticesExecutor::deleteEdges(std::vector<storage::cpp2::EdgeKey>* edges) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why define the parameter is a pointer?

@darionyaphet darionyaphet added the ready-for-testing PR: ready for the CI test label Nov 28, 2019
@nebula-community-bot
Copy link
Member

Unit testing failed.

@nebula-community-bot
Copy link
Member

Unit testing passed.

std::vector<nebula::OptVariantType> eval() const {
std::vector<nebula::OptVariantType> vertices;
for (auto& vertex : vidList_) {
auto vid = vertex->eval();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when vid is function expression, please do vertex->prepare() before vid->eval()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Catch 👍

@nebula-community-bot
Copy link
Member

Unit testing passed.

Conflicts:
	src/graph/CMakeLists.txt
	src/graph/Executor.cpp
	src/storage/QueryEdgeKeysProcessor.cpp
@nebula-community-bot
Copy link
Member

Unit testing passed.

@zhangguoqing
Copy link
Contributor

I suggest using a flag to indicate if deleting a vertex is allowed to delete all its associated edges or only delete one vertex without any associated edges.

If the vertex does not exist, is the edge meaningful?

FYI. 我的意思是添加一个bool类型的配置项,由用户决定删除一个顶点的方式:如果为true时,则可以删除此顶点以及与它关联的所有边;如果为false时,则只允许删除没有任何边的顶点,否则就应该向用户发出警告。

Conflicts:
	src/graph/DeleteVertexExecutor.cpp
	src/storage/CMakeLists.txt
	src/storage/StorageServiceHandler.cpp
	src/storage/mutate/DeleteVertexProcessor.cpp
	src/storage/mutate/DeleteVertexProcessor.h
	src/storage/test/DeleteVerticesTest.cpp
@darionyaphet
Copy link
Contributor Author

I suggest using a flag to indicate if deleting a vertex is allowed to delete all its associated edges or only delete one vertex without any associated edges.

If the vertex does not exist, is the edge meaningful?

FYI. 我的意思是添加一个bool类型的配置项,由用户决定删除一个顶点的方式:如果为true时,则可以删除此顶点以及与它关联的所有边;如果为false时,则只允许删除没有任何边的顶点,否则就应该向用户发出警告。

Sounds reasonable. Maybe we should implement it in another one. thanks

@nebula-community-bot
Copy link
Member

Unit testing passed.

@amber-moe amber-moe self-assigned this Feb 12, 2020
Conflicts:
	src/storage/test/CMakeLists.txt
laura-ding
laura-ding previously approved these changes Feb 12, 2020
src/storage/mutate/DeleteVerticesProcessor.cpp Outdated Show resolved Hide resolved
CPWstatic
CPWstatic previously approved these changes Feb 12, 2020

if (indexes_.empty()) {
std::for_each(partVertices.begin(), partVertices.end(), [&](auto& pv) {
callingNum_ += pv.second.size();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callingNum_ is on part Level, it means one part one call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we process for each Partition and vertex. So this is the vertex's number.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callingNum_ means how many calls to kvstore.

return;
}

status = setupEdgeKeys();
auto space = ectx()->rctx()->session()->space();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose about the changes in DeleteEdgesExecutor.cpp . I can't see any difference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't check it in prepare step, for example; Use space; delete ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? Is there any difference? You could move checkIfGraphSpaceChosen into prepare.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example:

(user@127.0.0.1:13699) [t]> INSERT VERTEX player(name, age) VALUES 100:("Tim Duncan", 42)
Execution succeeded (Time spent: 2.233/3.439 ms)

Fri Feb 14 19:45:25 2020

(user@127.0.0.1:13699) [t]> FETCH PROP ON player 100;
=======================================
| VertexID | player.name | player.age |
=======================================
| 100      | Tim Duncan  | 42         |
---------------------------------------
Got 1 rows (Time spent: 5.353/6.825 ms)

Fri Feb 14 19:45:27 2020

(user@127.0.0.1:13699) [t]> use test
Execution succeeded (Time spent: 1.81/3.018 ms)

Fri Feb 14 19:45:32 2020

(user@127.0.0.1:13699) [test]> use t ; DELETE VERTEX 100;
Execution succeeded (Time spent: 3.388/4.067 ms)

Fri Feb 14 19:45:37 2020

(user@127.0.0.1:13699) [t]> FETCH PROP ON player 100;
=======================================
| VertexID | player.name | player.age |
=======================================
| 100      | Tim Duncan  | 42         |
---------------------------------------
Got 1 rows (Time spent: 3.496/4.686 ms)

Fri Feb 14 19:45:40 2020

return;
}

status = setupEdgeKeys();
auto space = ectx()->rctx()->session()->space();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? Is there any difference? You could move checkIfGraphSpaceChosen into prepare.

src/graph/DeleteVerticesExecutor.cpp Show resolved Hide resolved
src/graph/test/DeleteVerticesTest.cpp Show resolved Hide resolved

if (indexes_.empty()) {
std::for_each(partVertices.begin(), partVertices.end(), [&](auto& pv) {
callingNum_ += pv.second.size();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callingNum_ means how many calls to kvstore.

@@ -218,16 +213,19 @@ struct AddEdgesRequest {
3: bool overwritable,
}

struct EdgeKeyRequest {
struct EdgeKeysRequest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use get neighbors directly. Actually, "getEdgeKeys" will be deleted in the future. It is meaningless to change it again.

@dutor
Copy link
Contributor

dutor commented Feb 19, 2020

Please resolve the conflicts.

@dangleptr
Copy link
Contributor

Please rebase the master

Conflicts:
	src/storage/test/CMakeLists.txt
@dutor dutor merged commit f048b76 into vesoft-inc:master Mar 3, 2020
@darionyaphet darionyaphet deleted the delete_vertices branch March 3, 2020 02:35
jude-zhu pushed a commit to jude-zhu/nebula that referenced this pull request Mar 4, 2020
* delete vertices

* address laura-ding's comment

Co-authored-by: dutor <440396+dutor@users.noreply.github.com>
tong-hao pushed a commit to tong-hao/nebula that referenced this pull request Jun 1, 2021
* delete vertices

* address laura-ding's comment

Co-authored-by: dutor <440396+dutor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants