fix(unique): prevent nil pointer panic in verifyUniqueWithinMutation#9677
Merged
matthewmcneely merged 1 commit intodgraph-io:mainfrom Apr 7, 2026
Merged
fix(unique): prevent nil pointer panic in verifyUniqueWithinMutation#9677matthewmcneely merged 1 commit intodgraph-io:mainfrom
matthewmcneely merged 1 commit intodgraph-io:mainfrom
Conversation
…graph-io#9670) When a mutation batch contains a UID edge (ObjectValue is nil) on a predicate marked @unique, verifyUniqueWithinMutation and addQueryIfUnique call dql.TypeValFrom(pred.ObjectValue) without a nil check, causing a nil pointer dereference that crashes the alpha. This affects all replicas since the same mutation is replicated via Raft, causing simultaneous crashes across the entire cluster. The fix adds nil checks for ObjectValue in three locations: - addQueryIfUnique: skip building unique-check query for UID edges - verifyUniqueWithinMutation: skip pred1 and pred2 comparisons when ObjectValue is nil Fixes dgraph-io#9670 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
8b59a64 to
9164672
Compare
matthewmcneely
approved these changes
Apr 7, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
verifyUniqueWithinMutationandaddQueryIfUniquewhen a mutation batch contains a UID edge (ObjectValueis nil) on a@uniquepredicateObjectValuein 3 locations before callingdql.TypeValFrom()Test plan
TestVerifyUniqueWithinMutationBoundsChecks/nil_ObjectValue_should_not_panicTestVerifyUniqueWithinMutationBoundsChecks/nil_ObjectValue_mixed_with_value_NQuad_should_not_panicFixes #9670
🤖 Generated with Claude Code