Commit 9164672
fix(unique): prevent nil pointer panic in verifyUniqueWithinMutation (#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 #9670
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>1 parent 4120211 commit 9164672
2 files changed
Lines changed: 99 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1804 | 1804 | | |
1805 | 1805 | | |
1806 | 1806 | | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
1807 | 1810 | | |
1808 | 1811 | | |
1809 | 1812 | | |
| |||
2218 | 2221 | | |
2219 | 2222 | | |
2220 | 2223 | | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
2221 | 2227 | | |
2222 | 2228 | | |
2223 | 2229 | | |
| |||
2229 | 2235 | | |
2230 | 2236 | | |
2231 | 2237 | | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
2232 | 2241 | | |
2233 | 2242 | | |
2234 | 2243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
288 | 378 | | |
0 commit comments