Skip to content

Commit d80bcbf

Browse files
authored
fix incorrect debug assertion in HGETEX; no impact to release build (#2999)
* fix incorrect debug assertion in HGETEX; no impact to release build * add release note
1 parent feb122c commit d80bcbf

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

docs/ReleaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Current package versions:
66
| ------------ | ----------------- | ----- |
77
| [![StackExchange.Redis](https://img.shields.io/nuget/v/StackExchange.Redis.svg)](https://www.nuget.org/packages/StackExchange.Redis/) | [![StackExchange.Redis](https://img.shields.io/nuget/vpre/StackExchange.Redis.svg)](https://www.nuget.org/packages/StackExchange.Redis/) | [![StackExchange.Redis MyGet](https://img.shields.io/myget/stackoverflow/vpre/StackExchange.Redis.svg)](https://www.myget.org/feed/stackoverflow/package/nuget/StackExchange.Redis) |
88

9+
## unreleased
10+
11+
- Fix incorrect debug assertion in `HGETEX` (no impact to release library) ([#2999 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2999))
12+
913
## 2.10.1
1014

1115
- Support Redis 8.4 CAS/CAD operations (`DIGEST`, and the `IFEQ`, `IFNE`, `IFDEQ`, `IFDNE` modifiers on `SET` / `DEL`)

src/StackExchange.Redis/RedisDatabase.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,9 @@ private Message HashFieldGetAndSetExpiryMessage(in RedisKey key, RedisValue[] ha
507507
return HashFieldGetAndSetExpiryMessage(key, in hashFields[0], expiry, flags);
508508
}
509509

510-
// precision, time, FIELDS, hashFields.Length
510+
// precision, time, FIELDS, hashFields.Length, {N x fields}
511511
int extraTokens = expiry.TokenCount + 2;
512-
513-
RedisValue[] values = new RedisValue[expiry.TokenCount + 2 + hashFields.Length];
512+
RedisValue[] values = new RedisValue[extraTokens + hashFields.Length];
514513

515514
int index = 0;
516515
// add PERSIST or expiry values
@@ -528,7 +527,7 @@ private Message HashFieldGetAndSetExpiryMessage(in RedisKey key, RedisValue[] ha
528527
values[index++] = RedisLiterals.FIELDS;
529528
values[index++] = hashFields.Length;
530529
// check we've added everything we expected to
531-
Debug.Assert(index == extraTokens + hashFields.Length);
530+
Debug.Assert(index == extraTokens, $"token mismatch: {index} vs {extraTokens}");
532531

533532
// Add hash fields to the array
534533
hashFields.AsSpan().CopyTo(values.AsSpan(index));

0 commit comments

Comments
 (0)