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

[Compatibility] Added BRPOPLPUSH, ZREVRANGEBYLEX deprecated commands by mapping to existing commands #769

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Vijay-Nirmal
Copy link
Contributor

@Vijay-Nirmal Vijay-Nirmal commented Nov 2, 2024

Adding the BRPOPLPUSH and ZREVRANGEBYLEX commands to garnet and added doc to SLAVEOF command

  • Add BRPOPLPUSH and ZREVRANGEBYLEX command
  • Add Integration Test cases, ACL Test and Slot Verification Test
  • Add documentation
  • Add doc to SLAVEOF command

This PR closes #684

Note: ZRANGE with REV command has a lot of issues. Also, all the causes are failing. I will have a separate PR to fix it. This is the reason I couldn't write test causes for ZREVRANGEBYLEX command with any of the valid cases.

@Vijay-Nirmal Vijay-Nirmal changed the title [Compatibility] Added BRPOPLPUSH, ZREVRANGEBYLEX deprecated commands by mapping to existing commends [Compatibility] Added BRPOPLPUSH, ZREVRANGEBYLEX deprecated commands by mapping to existing commands Nov 2, 2024
Copy link
Contributor

@TalZaccai TalZaccai left a comment

Choose a reason for hiding this comment

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

Thanks for this addition! Please see my comments :)

var rightOption = ArgSlice.FromPinnedSpan(CmdStrings.RIGHT);
var leftOption = ArgSlice.FromPinnedSpan(CmdStrings.LEFT);
var timeout = parseState.GetArgSliceByRef(2);
parseState.InitializeWithArguments(srcKey, dstKey, rightOption, leftOption, timeout);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why create a new parse state with the direction arguments and then call ListBlockingMove to reparse them once again? Just create the cmdArgs array and call the itemBroker directly. Alternatively, you can create a common method that takes the 5 arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I will do it, I did it in this way because there are deprecated commands and the only purpose of adding these is additioning compatibility still there commands are removed as discussed in this GitHub command #684 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

I realize these are deprecated commands. Still, it's better to have good practices throughout so that other contributors can use them as reference :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// ZREVRANGEBYLEX key start stop
if (parseState.Count == 3)
{
parseState.InitializeWithArguments(sbKey, start, stop, byLenOption, revOption);
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, no need to initialize a new parse state, actually no need for this method at all, just create a new SortedSetOperation - ZREVRANGEBYLEX and call SortedSetRange directy, then handle that specific op in SortedSetObjectImpl.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -231,5 +231,25 @@ public void BlockingClientEventsTests(string blockingCmd)
ClassicAssert.IsTrue(blockingTask.IsCompletedSuccessfully);
ClassicAssert.IsTrue(releasingTask.IsCompletedSuccessfully);
}

[Test]
public void BasicBlockingListPopPushTest()
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't really test the blocking functionality, you can piggyback on the BasicBlockingListMoveTest and just add a test case for BRPOPLPUSH.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

test/Garnet.test/RespListTests.cs Outdated Show resolved Hide resolved
@badrishc
Copy link
Contributor

This is a great contribution to bridge the deprecated APIs, thanks!

@Vijay-Nirmal
Copy link
Contributor Author

Fixed the review comments

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.

Map deprecated Redis comments to its alternative if its already exist in Garnet
3 participants