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
Periodic delete #446
Merged
Merged
Periodic delete #446
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cfccc19
Add periodic delete
Josipmrden f8269a3
Modified periodic delete to display more information
Josipmrden f1486b8
Add tests for periodic delete
Josipmrden 8e08bc8
Fix parameter names in test
Josipmrden d549781
Fix condition
Josipmrden 642ac21
Fix tests
Josipmrden 98b427f
Empty lines
Josipmrden 76598c9
Merge branch 'main' into periodic-delete
Josipmrden e0b65bc
Address MG client params comments
Josipmrden 95714c8
Address PR comments
Josipmrden 43099f5
Add test for deleting specific label
Josipmrden 53d2a0b
Add fixes to PR
Josipmrden 392f3bf
Merge branch 'main' into periodic-delete
Josipmrden File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
e2e/periodic_delete_test/test_periodic_delete_batch_argument_not_int/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOREACH (i in range(1, 10) | CREATE ()); |
5 changes: 5 additions & 0 deletions
5
e2e/periodic_delete_test/test_periodic_delete_batch_argument_not_int/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query: > | ||
CALL periodic.delete({batch_size: "a"}) YIELD * RETURN *; | ||
|
||
exception: > | ||
Batch size needs to be an integer! |
1 change: 1 addition & 0 deletions
1
e2e/periodic_delete_test/test_periodic_delete_batch_size_negative/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOREACH (i in range(1, 10) | CREATE ()); |
5 changes: 5 additions & 0 deletions
5
e2e/periodic_delete_test/test_periodic_delete_batch_size_negative/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query: > | ||
CALL periodic.delete({batch_size: -1}) YIELD * RETURN *; | ||
|
||
exception: > | ||
Batch size can't be a non-negative integer! |
1 change: 1 addition & 0 deletions
1
e2e/periodic_delete_test/test_periodic_delete_everything/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOREACH (i in range(1, 10) | CREATE ()-[:TYPE]->()); |
8 changes: 8 additions & 0 deletions
8
e2e/periodic_delete_test/test_periodic_delete_everything/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
query: > | ||
CALL periodic.delete({batch_size: 10}) YIELD * RETURN *; | ||
|
||
output: | ||
- number_of_deleted_nodes: 20 | ||
number_of_deleted_relationships: 10 | ||
number_of_executed_batches: 5 | ||
success: true |
1 change: 1 addition & 0 deletions
1
e2e/periodic_delete_test/test_periodic_delete_invalid_edge_type_config/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOREACH (i in range(1, 10) | CREATE ()); |
5 changes: 5 additions & 0 deletions
5
e2e/periodic_delete_test/test_periodic_delete_invalid_edge_type_config/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query: > | ||
CALL periodic.delete({batch_size: 10, edge_types: [1]}) YIELD * RETURN *; | ||
|
||
exception: > | ||
Invalid config for config parameter edge_types! |
1 change: 1 addition & 0 deletions
1
e2e/periodic_delete_test/test_periodic_delete_invalid_labels_config/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOREACH (i in range(1, 10) | CREATE ()); |
5 changes: 5 additions & 0 deletions
5
e2e/periodic_delete_test/test_periodic_delete_invalid_labels_config/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query: > | ||
CALL periodic.delete({batch_size: 10, labels: [1]}) YIELD * RETURN *; | ||
|
||
exception: > | ||
Invalid config for config parameter labels! |
1 change: 1 addition & 0 deletions
1
e2e/periodic_delete_test/test_periodic_delete_no_batch_argument/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOREACH (i in range(1, 10) | CREATE ()); |
5 changes: 5 additions & 0 deletions
5
e2e/periodic_delete_test/test_periodic_delete_no_batch_argument/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query: > | ||
CALL periodic.delete({}) YIELD * RETURN *; | ||
|
||
exception: > | ||
Periodic.delete() did not specify config parameter batch_size! |
1 change: 1 addition & 0 deletions
1
e2e/periodic_delete_test/test_periodic_delete_on_just_edges/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOREACH (i in range(1, 10) | CREATE ()-[:TYPE]->()); |
8 changes: 8 additions & 0 deletions
8
e2e/periodic_delete_test/test_periodic_delete_on_just_edges/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
query: > | ||
CALL periodic.delete({batch_size: 10, edge_types:["TYPE"]}) YIELD * RETURN *; | ||
|
||
output: | ||
- number_of_deleted_nodes: 0 | ||
number_of_deleted_relationships: 10 | ||
number_of_executed_batches: 2 | ||
success: true |
1 change: 1 addition & 0 deletions
1
e2e/periodic_delete_test/test_periodic_delete_on_just_nodes/input.cyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOREACH (i in range(1, 10) | CREATE ()); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make batch size-related behavior consistent btwn
ValidateBatchSize
andValidateDeletionConfig
, and try to extract that into its own functionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I recommend using positional arguments to avoid repeating, e.g. use
fmt::format("MATCH ({0}) WHERE ID({0}) = __{0}_id", node_name)
instead of
fmt::format("MATCH ({}) WHERE ID({}) = __{}_id", node_name, node_name, node_name)
(and ditto elsewhere).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean on the first comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the first comment:
ValidateBatchSize
andValidateDeletionConfig
have different checks & error messages for thebatch_size
parameter. I advise to make them consistent, and then to extract that into its own function to avoid repeated code.