Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XTrimArgs Should Allow Limit = 0 #2250

Closed
Leoncanva opened this issue Nov 14, 2022 · 1 comment
Closed

XTrimArgs Should Allow Limit = 0 #2250

Leoncanva opened this issue Nov 14, 2022 · 1 comment
Labels
type: bug A general bug
Milestone

Comments

@Leoncanva
Copy link

Bug Report

Current Behavior

XTrimArgs asserts the maximum numbers of entries to trim is > 0. Calling limit(0) results in exception thrown "Limit must be greater 0"

Stack trace
Limit must be greater 0
java.lang.IllegalArgumentException: 
	at io.lettuce.core.internal.LettuceAssert.isTrue(LettuceAssert.java:208)
	at io.lettuce.core.XTrimArgs.limit(XTrimArgs.java:114)

Input Code

Input Java Code
    var args = XTrimArgs.Builder.minId(minId).approximateTrimming().limit(0l);
    return commands.xtrim(streamKey, args);

Expected behavior/code

Specifying the value 0 as count disables the limiting mechanism entirely.

redis.io/commands/xtrim/

An explicit limit of 0 means unlimited (but note that it's not the default).

redis/redis#8169

Environment

  • Lettuce version(s): 6.1.8.RELEASE
  • Redis version: >6.2.0

Possible Solution

        LettuceAssert.isTrue(limit >= 0, "Limit must be greater or equal to 0");
@mp911de mp911de added the type: bug A general bug label Nov 14, 2022
@mp911de mp911de added this to the 6.2.2.RELEASE milestone Nov 14, 2022
@mp911de
Copy link
Collaborator

mp911de commented Nov 22, 2022

That's fixed now.

@mp911de mp911de closed this as completed Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants