-
Notifications
You must be signed in to change notification settings - Fork 17
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
perf: improve performance of bulk child entity updates and avoid hitting the AQL limit of 500 nesting limit doing it #302
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"authRoles": ["allusers"] | ||
"authRoles": ["allusers"], | ||
"childEntityUpdatesViaDictStrategyThreshold": 2 | ||
} |
4 changes: 4 additions & 0 deletions
4
spec/regression/logistics/tests/update-child-entities-dict.context.json
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,4 @@ | ||
{ | ||
"childEntityUpdatesViaDictStrategyThreshold": 1, | ||
"authRoles": ["allusers"] | ||
} |
120 changes: 120 additions & 0 deletions
120
spec/regression/logistics/tests/update-child-entities-dict.graphql
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,120 @@ | ||
# in the .context.json, childEntityUpdatesViaDictStrategyThreshold is set to 1 | ||
# so we will always use the dict strategy to update child entities | ||
|
||
mutation updateOne { | ||
updateDelivery( | ||
input: { | ||
id: "@{ids/Delivery/1}" | ||
updateItems: [{ id: "id_init_0000", itemNumber: "updated1" }] | ||
} | ||
) { | ||
items { | ||
id | ||
itemNumber | ||
} | ||
} | ||
} | ||
|
||
# to verify it is updated in the db | ||
query afterUpdateOne { | ||
Delivery(id: "@{ids/Delivery/1}") { | ||
items { | ||
id | ||
itemNumber | ||
} | ||
} | ||
} | ||
|
||
mutation addSome { | ||
updateDelivery( | ||
input: { | ||
id: "@{ids/Delivery/1}" | ||
addItems: [ | ||
{ itemNumber: "added00" } | ||
{ itemNumber: "added01" } | ||
{ itemNumber: "added02" } | ||
{ itemNumber: "added03" } | ||
{ itemNumber: "added04" } | ||
{ itemNumber: "added05" } | ||
{ itemNumber: "added06" } | ||
{ itemNumber: "added07" } | ||
{ itemNumber: "added08" } | ||
{ itemNumber: "added09" } | ||
{ itemNumber: "added10" } | ||
] | ||
} | ||
) { | ||
items { | ||
id | ||
itemNumber | ||
} | ||
} | ||
} | ||
|
||
mutation updateMultiple { | ||
updateDelivery( | ||
input: { | ||
id: "@{ids/Delivery/1}" | ||
updateItems: [ | ||
{ id: "id_test_0003", itemNumber: "updated03" } | ||
{ id: "id_test_0005", itemNumber: "updated05" } | ||
{ id: "id_test_0007", itemNumber: "updated07" } | ||
{ id: "id_test_0008", itemNumber: "updated08" } | ||
{ id: "id_test_0009", itemNumber: "updated09" } | ||
] | ||
} | ||
) { | ||
items { | ||
id | ||
itemNumber | ||
} | ||
} | ||
} | ||
|
||
# to verify it is updated in the db | ||
query afterUpdateMultiple { | ||
Delivery(id: "@{ids/Delivery/1}") { | ||
items { | ||
id | ||
itemNumber | ||
} | ||
} | ||
} | ||
|
||
mutation addUpdateAndDelete { | ||
updateDelivery( | ||
input: { | ||
id: "@{ids/Delivery/1}" | ||
addItems: [ | ||
{ itemNumber: "finalNew1" } | ||
{ itemNumber: "finalNew2" } | ||
{ itemNumber: "finalNew3" } | ||
] | ||
updateItems: [ | ||
{ id: "id_test_0004", itemNumber: "finalUpdated04" } | ||
# this is finalNew2 | ||
{ id: "id_test_0012", itemNumber: "finalUpdated02" } | ||
] | ||
removeItems: [ | ||
"id_test_0007" | ||
# this is finalNew3 | ||
"id_test_0013" | ||
] | ||
} | ||
) { | ||
items { | ||
id | ||
itemNumber | ||
} | ||
} | ||
} | ||
|
||
# to verify it is updated in the db | ||
query end { | ||
Delivery(id: "@{ids/Delivery/1}") { | ||
items { | ||
id | ||
itemNumber | ||
} | ||
} | ||
} |
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.
to me this reads as "the threshold that needs to be reached to activate dict-strategy is 2. So it is active for 2" which is not the case.
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.
nevermind, it is the case. I just got confused because the default is supposed to be 3 and this is a file called "default context"
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.
yeah I initially had the (real) default at 5 and wanted to reduce it for the tests so we have more chances to trigger it, but I then dialed down the real default to 3. No idea what a good value could be yet.