-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(core): add additional checks in verifyUniqueWithinMutation for pruned mutations #9450
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
base: main
Are you sure you want to change the base?
fix(core): add additional checks in verifyUniqueWithinMutation for pruned mutations #9450
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.
Pull Request Overview
This PR enhances mutation verification by skipping pruned entries, enriches error context in binary copying, and adds a regression test to prevent panics when unique predicates are conditionally pruned.
- Skip out-of-bounds or nil entries in
verifyUniqueWithinMutation
to handle pruned mutations. - Include source and destination paths in the
copyBinary
error message. - Add
TestWithConditionallyPrunedMutations
to verify no panic and correct UID assignments.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
edgraph/server.go | Added bounds checks and updated duplicate-value logic in verifyUniqueWithinMutation . |
dgraphtest/image.go | Augmented copyBinary error wrap to include toPath and fromPath . |
dgraph/cmd/alpha/run_test.go | Introduced a test to cover conditionally pruned mutations and ensure stability. |
Comments suppressed due to low confidence (1)
edgraph/server.go:2173
- [nitpick] Consider using
%q
or%s
verbs instead of%v
when formatting strings to ensure proper quoting and improve readability, e.g.,"could not insert duplicate value %q for predicate %q"
.
pred1Value, pred1.Predicate)
… mutations are validated unique
Suggestion from github cp
ecff40b
to
908de7a
Compare
c699011
to
672bca4
Compare
672bca4
to
1003aa2
Compare
Description
This PR adds additional checks in edgraph/server.go::verifyUniqueWithinMutation for mutations that may have been conditionally pruned in
updateMutations
(called just before).Also a basic test verifies not only the prevention of the panic but also assures unpruned mutations were applied. Note this is an improvement upon #9449 in that additional range and inner loop predicate checks were required (@gooohgb).
Assigning to @shivaji-kharse as the original author of this function.
Checklist
CHANGELOG.md
file describing and linking tothis PR