-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add support for multiple mutations #4210
Conversation
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.
✅ A review job has been created and sent to the PullRequest network.
@mangalaman93 you can click here to see the review status or cancel the code review job.
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.
4ce9e1e
to
cf43b07
Compare
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.
⚠️ Warning
PullRequest detected a force-push on this branch. This may have caused some information to be lost, and additional time may be required to complete review of the code. Read More
cf43b07
to
8a08a1b
Compare
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.
The change looks good overall but does need some adjustments before getting it merged.
Reviewed with ❤️ by PullRequest
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.
✖️ This code review was cancelled. See Details
72b1ecd
to
eb3e3a5
Compare
e29d545
to
487ffff
Compare
c9a6ae1
to
24819a8
Compare
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.
Reviewable status: 0 of 13 files reviewed, 17 unresolved discussions (waiting on @danielmai, @mangalaman93, @manishrjain, @MichaelJCompton, @pawanrawal, and @pullrequest[bot])
dgraph/cmd/alpha/http.go, line 415 at r3 (raw file):
mp := map[string]interface{}{} if len(resp.Json) != 0 { if err := json.Unmarshal(resp.Json, &mp); err != nil {
Avoid this. Find another way.
Query should contain: {"data": ..., "extensions": ...}
Perhaps find the first bracket, and inject the json from below into it. That'd be much faster.
edgraph/server.go, line 524 at r3 (raw file):
req.Query = strings.TrimSpace(req.Query) isQuery := len(req.Query) != 0 if !isQuery && !isMutation {
Might not need to check it up here.
edgraph/server.go, line 532 at r3 (raw file):
req: req, condVars: make([]string, len(req.Mutations)), uidRes: make(map[string][]string),
Try to avoid these empty inits.
edgraph/server.go, line 535 at r3 (raw file):
valRes: make(map[string]map[uint64]types.Val), latency: l, span: span,
Don't really need this. ctx already has span.
edgraph/server.go, line 558 at r3 (raw file):
resp = &api.Response{} if isQuery {
switch case for isQuery, isMutation, default
edgraph/server.go, line 632 at r3 (raw file):
// @if condition defined in Conditional Upsert. func buildUpsertQuery(qc *queryContext) string { if len(qc.req.Query) == 0 {
check if len(qc.gmuList) == 0 or not here?
24819a8
to
fbdcaa1
Compare
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.
Reviewable status: 0 of 13 files reviewed, 17 unresolved discussions (waiting on @danielmai, @mangalaman93, @manishrjain, @MichaelJCompton, @pawanrawal, and @pullrequest[bot])
go.mod, line 3 at r2 (raw file):
Previously, pullrequest[bot] wrote…
Was the CI switched to using Go 1.13 already? If not, I recommend reverting the change to
go.mod
,go.sum
and redo it with Go 1.12.This is because Go 1.13 has a GOPROXY enabled by default. This can lead to errors if any of your dependencies have been re-tagged upstream then Go 1.12 will see the new tag whilst Go 1.13 remains seeing the old tag (the goproxy is immutable) leading to a mismatch of the dependency's hash.
Done.
dgraph/cmd/alpha/http.go, line 415 at r3 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
Avoid this. Find another way.
Query should contain:
{"data": ..., "extensions": ...}
Perhaps find the first bracket, and inject the json from below into it. That'd be much faster.
Done.
edgraph/server.go, line 524 at r3 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
Might not need to check it up here.
I have to check it here, otherwise parsing fails
edgraph/server.go, line 532 at r3 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
Try to avoid these empty inits.
Done.
edgraph/server.go, line 535 at r3 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
Don't really need this. ctx already has span.
ctx does have the key but the key for storing the context is not exported from the trace package. The exported function (FromContext) is only defined for type *SpanContext which is not the case here.
edgraph/server.go, line 558 at r3 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
switch case for isQuery, isMutation, default
We need to do both if it is an upsert. Not sure a switch statement will work.
edgraph/server.go, line 632 at r3 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
check if len(qc.gmuList) == 0 or not here?
Done.
6116fe6
to
b168008
Compare
b168008
to
96e1668
Compare
a0180e8
to
9a1e552
Compare
96e1668
to
257d6aa
Compare
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.
Reviewed 3 of 12 files at r3, 4 of 5 files at r5.
Reviewable status: all files reviewed, 17 unresolved discussions (waiting on @danielmai, @mangalaman93, @manishrjain, @MichaelJCompton, @pawanrawal, and @pullrequest[bot])
9a1e552
to
2bab8f2
Compare
257d6aa
to
633c252
Compare
68508ba
to
8acc6bd
Compare
633c252
to
f5a805f
Compare
f5a805f
to
8adf4d3
Compare
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.
Reviewed 2 of 12 files at r3, 1 of 5 files at r5, 3 of 4 files at r6.
Reviewable status: all files reviewed, 12 unresolved discussions (waiting on @danielmai, @mangalaman93, @manishrjain, @MichaelJCompton, @pawanrawal, and @pullrequest[bot])
8adf4d3
to
64560e6
Compare
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.
apart from a small thing that I was not very sure of. Perhaps a comment would help.
Reviewed 3 of 12 files at r3, 1 of 5 files at r5, 3 of 4 files at r6.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @danielmai, @mangalaman93, @manishrjain, @MichaelJCompton, and @pullrequest[bot])
dgraph/cmd/alpha/http.go, line 354 at r7 (raw file):
return mu, nil } if mu, err := extractMutation(ms); err != nil {
So ms can have set
, delete
and cond
as keys and can also have mutations
as keys? I would think that we only allow mutations
as the key. Is that to maintain backward compatibility?
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.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @danielmai, @mangalaman93, @manishrjain, @MichaelJCompton, @pawanrawal, and @pullrequest[bot])
dgraph/cmd/alpha/http.go, line 354 at r7 (raw file):
Previously, pawanrawal (Pawan Rawal) wrote…
So ms can have
set
,delete
andcond
as keys and can also havemutations
as keys? I would think that we only allowmutations
as the key. Is that to maintain backward compatibility?
yeah, pretty much. I'd add a comment in the code.
Now, the upsert can have multiple mutation block and
if..else
mutations are now possible.This change is