Skip to content

Redis 7.2.0 RC1: Prep for upgrades#2454

Merged
NickCraver merged 4 commits intomainfrom
craver/redis-7.2
Jun 14, 2023
Merged

Redis 7.2.0 RC1: Prep for upgrades#2454
NickCraver merged 4 commits intomainfrom
craver/redis-7.2

Conversation

@NickCraver
Copy link
Collaborator

@NickCraver NickCraver commented May 2, 2023

I'm seeing a few issues here that we need to resolve for the upcoming Redis 7.2 release:

Note: no release notes because these are all test tweaks.

I'm seeing a few issues here:

1. The internal encoding has changed 1 spot to listpack, which is correct from redis/redis#11303, but is missing in the docs at https://redis.io/commands/object-encoding/ (fixed in tests themselves)
1. The `HackyGetPerf` reliably returns 0 now, regardless of how long has passed (e.g. upping iterations tremendously)...this may legit be bugged.
1. `StreamAutoClaim_IncludesDeletedMessageId` expectations are broken, not sure what to make of this yet but it's an odd change to hit between 7.0 and 7.2 versions.
@NickCraver
Copy link
Collaborator Author

cc @slorello89 for heads up on these, may affect others!

var result = (long)db.ScriptEvaluate(@"
redis.call('psetex', KEYS[1], 60000, 'timing')
for i = 1,5000 do
for i = 1,500000 do
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NickCraver What is the reason for changing the number of iterations for the loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was only testing "did it complete so fast we couldn't measure?" but it's always zero...so can ignore this change just demonstrating that even with ~80ms elapsed locally, it reports zero.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NickCraver - it looks like the TTL clock isn't running in the RC version of Redis. @itamarhaber - have you seen/heard anything about this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be clear - only during lua script execution (catches up when the script exits)

@slorello89
Copy link
Collaborator

Hey Nick - the error your seeing here is caused by slightly different behavior between the Release Candidate and the actual release of Redis 7:

While iterating the PEL, if XAUTOCLAIM stumbles upon a message which doesn't exist in the stream anymore (either trimmed or deleted by [XDEL](https://redis.io/commands/xdel)) it does not claim it, and deletes it from the PEL in which it was found. This feature was introduced in Redis 7.0. These message IDs are returned to the caller as a part of XAUTOCLAIMs reply.

Might seem innocuous but when you take it in context with:

The optional <count> argument, which defaults to 100, is the upper limit of the number of entries that the command attempts to claim.

Tells you what's going on, the test is sending the XAUTOCLAIM with a COUNT of 1 - it attempts to claim the deleted message. THAT COUNTS as its one message it will attempt to claim, and it breaks off. It returns the next message as the place to start the next autoclaim, returns a null entry as the actual messages claimed, and returns the deleted message in the third spot.

The fix is simple enough if you want me to push it (just change the counts to 2 :) )

@NickCraver
Copy link
Collaborator Author

@slorello89 If the test is wrong and server is right, absolutely - would be much appreciated. I'd love for tests to be wrong here :)

@slorello89
Copy link
Collaborator

@NickCraver

Insofar as XAUTOCLAIM the server is behaving correctly, so the update is correct

WRT the other issue with the perf test - this is a BC coming to Redis 7.2:

redis/redis#10182
redis/redis#10300

See the Breaking section of the release notes - basically what's happening is that Redis 7.2 is freezing the clock during script execution. Consequently, that test is no longer correct and will always fail. Obviously there's a couple ways to remediate, but I'm not entirely sure what that test is really testing?

Anyway - hopefully this is helpful

@NickCraver
Copy link
Collaborator Author

@slorello89 very helpful - thank you!!

@mgravell any thoughts about the perf test/intent? For quick context, this is the entire content of the test:

    [Fact]
    public void HackyGetPerf()
    {
        using var conn = GetScriptConn();

        var key = Me();
        var db = conn.GetDatabase();
        db.StringSet(key + "foo", "bar", flags: CommandFlags.FireAndForget);
        var result = (long)db.ScriptEvaluate(@"
redis.call('psetex', KEYS[1], 60000, 'timing')
for i = 1,5000 do
    redis.call('set', 'ignore','abc')
end
local timeTaken = 60000 - redis.call('pttl', KEYS[1])
redis.call('del', KEYS[1])
return timeTaken
", new RedisKey[] { key }, null);
        Log(result.ToString());
        Assert.True(result > 0);
    }

The test originally comes from a Booksleeve migration 9 years ago...I'm leaning towards "delete it": c002a00

@NickCraver NickCraver changed the title [WIP] Redis 7.2.0 RC1 Test Demo - prep for upgrades Redis 7.2.0 RC1: Prep for upgrades Jun 14, 2023
Copy link
Collaborator

@mgravell mgravell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm; fine with deleting the hack perf thing

@NickCraver NickCraver merged commit f6171a1 into main Jun 14, 2023
@NickCraver NickCraver deleted the craver/redis-7.2 branch June 14, 2023 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants