You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Batch issue with Sorted Sets in version 2.6.45 #2176
The latest 2.6.45 version seems to have an issue with batches that previous versions did not.
In the test below a sorted set is created. A batch is then created where another sorted set is created, then an intersect is done between the two sorted sets, then the data should be returned in with SortedSetRangeByRankAsync command. In prior versions, this worked well but in this version no data is returned in the SortedSetRangeByRankAsync command.
It does seem like the first two commands are being executed in the correct order as the intersect key does exist after the test below completes with the correct value. I'm wondering if the SortedSetRangeByRankAsync isn't being executed last though.
In the newest version, I also tried the SortedSetCombineAsync instead of the separate intersect and return data commands and it didn't return any data either.
using var conn = Create();
var db = conn.GetDatabase();
var key = "TestKeyForRedis1";
var key2 = "TestKeyForRedis2";
var keyIntersect = "TestKeyForRedisIntersect";
db.KeyDelete(key);
db.KeyDelete(key2);
db.KeyDelete(keyIntersect);
db.SortedSetAdd(key, "a", 1345);
var tasks = new List<Task>();
var batch = db.CreateBatch();
tasks.Add(batch.SortedSetAddAsync(key2, "a", 4567));
tasks.Add(batch.SortedSetCombineAndStoreAsync(SetOperation.Intersect,
keyIntersect, new RedisKey[] { key, key2 }));
var rangeByRankTask = batch.SortedSetRangeByRankAsync(keyIntersect);
tasks.Add(rangeByRankTask);
batch.Execute();
Task.WhenAll(tasks.ToArray());
var rangeByRankSortedSetValues = rangeByRankTask.Result;
int size = rangeByRankSortedSetValues.Length;
Assert.Equal(1, size);
string firstRedisValue = rangeByRankSortedSetValues.FirstOrDefault().ToString();
Assert.Equal("a", firstRedisValue);
Right; the issue seems to be a missing override in RedisBatch.cs; I distinctly recall seeing something about this in the last few days, but I can't find it now! If I can't find it to give credit, I'll tweak it myself. Specifically, we need:
Activity
mgravell commentedon Jun 26, 2022
Definitely sounds weird. Will look.
mgravell commentedon Jun 28, 2022
oof; confirmed - the batch is somehow out of order; I see:
The last three should be
ZADD,ZINTERSTORE,ZRANGE- notZRANGE,ZADD,ZINTERSTOREMarking nuget package as hidden while I investigate this.
mgravell commentedon Jun 28, 2022
Right; the issue seems to be a missing
overrideinRedisBatch.cs; I distinctly recall seeing something about this in the last few days, but I can't find it now! If I can't find it to give credit, I'll tweak it myself. Specifically, we need:mgravell commentedon Jun 28, 2022
crossref #2167 - same problem and solution
Batch/Transaction need to override new ExecuteAsync API; fix #2167 fix …
mikechoinoski commentedon Jun 28, 2022
Thanks for getting this fixed so quickly!
URGENT Fix error in batch/transaction handling (seredis#2177)