Commit 0617c43
committed
fix(redis): address review feedback for keyTypeAtExpect
Address findings from claude review on 79a6989:
- [P0] Add hasHigherPriorityStringEncoding guard on the fast-path
hit in keyTypeAtExpect, consistent with the wide-column fast-path
callers (hashFieldFastLookup, zsetMemberFastScore,
setMemberFastExists, hashFieldFastExists). Without this guard the
rawKeyTypeAt "string wins" tiebreaker is bypassed when a
redisStrKey row exists alongside a collection encoding for the
same user key, returning the collection-specific answer instead
of the WRONGTYPE / nil that the slow path produces. Cost: one
extra ExistsAt seek per fast-path hit on non-string types; the
19->3/4 reduction is preserved.
- [P1] Replace context.Background() with the in-scope ctx in eight
keyTypeAtExpect call sites whose enclosing function (or
retryRedisWrite closure) carries a real context with timeout /
cancellation:
applyHashFieldPairs (closure ctx from L2040 WithTimeout)
hdelTxn (function param)
hincrbyTxn (function param)
zaddTxn (function param)
zincrbyTxn (function param)
zrem closure (closure ctx from L3540 WithTimeout)
zremrangebyrank closure (closure ctx from L3588 WithTimeout)
tryBZPopMin closure (closure ctx from L3625 WithTimeout)
Pre-existing bug on the keyTypeAt callers, now fixed at the same
lines this PR already touches.
Callers without ctx in scope (hmget, hlen, hgetall, zrangeRead,
xlen, rangeStream) are pre-existing and out of scope.1 parent 79a6989 commit 0617c43
2 files changed
Lines changed: 37 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2042 | 2042 | | |
2043 | 2043 | | |
2044 | 2044 | | |
2045 | | - | |
| 2045 | + | |
2046 | 2046 | | |
2047 | 2047 | | |
2048 | 2048 | | |
| |||
2669 | 2669 | | |
2670 | 2670 | | |
2671 | 2671 | | |
2672 | | - | |
| 2672 | + | |
2673 | 2673 | | |
2674 | 2674 | | |
2675 | 2675 | | |
| |||
2941 | 2941 | | |
2942 | 2942 | | |
2943 | 2943 | | |
2944 | | - | |
| 2944 | + | |
2945 | 2945 | | |
2946 | 2946 | | |
2947 | 2947 | | |
| |||
3262 | 3262 | | |
3263 | 3263 | | |
3264 | 3264 | | |
3265 | | - | |
| 3265 | + | |
3266 | 3266 | | |
3267 | 3267 | | |
3268 | 3268 | | |
| |||
3332 | 3332 | | |
3333 | 3333 | | |
3334 | 3334 | | |
3335 | | - | |
| 3335 | + | |
3336 | 3336 | | |
3337 | 3337 | | |
3338 | 3338 | | |
| |||
3542 | 3542 | | |
3543 | 3543 | | |
3544 | 3544 | | |
3545 | | - | |
| 3545 | + | |
3546 | 3546 | | |
3547 | 3547 | | |
3548 | 3548 | | |
| |||
3590 | 3590 | | |
3591 | 3591 | | |
3592 | 3592 | | |
3593 | | - | |
| 3593 | + | |
3594 | 3594 | | |
3595 | 3595 | | |
3596 | 3596 | | |
| |||
3627 | 3627 | | |
3628 | 3628 | | |
3629 | 3629 | | |
3630 | | - | |
| 3630 | + | |
3631 | 3631 | | |
3632 | 3632 | | |
3633 | 3633 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
323 | 333 | | |
324 | | - | |
325 | | - | |
| 334 | + | |
| 335 | + | |
326 | 336 | | |
327 | 337 | | |
328 | 338 | | |
329 | | - | |
330 | | - | |
331 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
332 | 343 | | |
333 | 344 | | |
334 | 345 | | |
| |||
337 | 348 | | |
338 | 349 | | |
339 | 350 | | |
340 | | - | |
341 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
342 | 362 | | |
343 | | - | |
| 363 | + | |
344 | 364 | | |
345 | 365 | | |
346 | 366 | | |
| |||
0 commit comments