redis / lettuce

Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.
https://lettuce.io
MIT License
5.3k stars 947 forks source link

Remove not readonly commands #2832 #2871

Closed thachlp closed 1 week ago

thachlp commented 3 weeks ago

Issue: #2832

Make sure that:

tishun commented 3 weeks ago

Just talked to @mp911de and he agreed that we should probably remove io.lettuce.core.masterreplica. ReadOnlyCommands. This could be done in another PR, but it would be awesome if we can do it here.

thachlp commented 3 weeks ago

Hey @thachlp , thanks for submitting this PR.

I think there are a few things we needs to address first:

  1. Seems like there are two ReadOnlyCommands classes - one in the io.lettuce.core.masterreplica package and one in the io.lettuce.core.protocol package. The one you modified (in the io.lettuce.core.masterreplica) appears to be unused. I believe the change needs to be done in the io.lettuce.core.protocol.ReadOnlyCommands class. Let's change both classes for now similar to how it was done in Add GEOSEARCH to read-only commands #2568Β #2569
  2. The GEOSEARCH command is read-only, let's not remove it from the list:
COMMAND INFO GEOSEARCH
1) 1) "geosearch"
   2) "-7"
   3) 1) "readonly"
   4) "1"
  1. In a perfect world I'd love to see an integration test that loops over these commands and verifies that they are readonly so we can quickly adapt to server change (optional, but would be very nice).

@tishun,
You are correct, I rechecked and updated the list, please help review πŸš€ Is there any way that I can run the integration test in local? I try to write the test that you recommend but I got the error java: package jdk.net does not exist. How can I fix it?

tishun commented 3 weeks ago

Hey @thachlp , thanks for submitting this PR. I think there are a few things we needs to address first:

  1. Seems like there are two ReadOnlyCommands classes - one in the io.lettuce.core.masterreplica package and one in the io.lettuce.core.protocol package. The one you modified (in the io.lettuce.core.masterreplica) appears to be unused. I believe the change needs to be done in the io.lettuce.core.protocol.ReadOnlyCommands class. Let's change both classes for now similar to how it was done in Add GEOSEARCH to read-only commands #2568Β #2569
  2. The GEOSEARCH command is read-only, let's not remove it from the list:
COMMAND INFO GEOSEARCH
1) 1) "geosearch"
   2) "-7"
   3) 1) "readonly"
   4) "1"
  1. In a perfect world I'd love to see an integration test that loops over these commands and verifies that they are readonly so we can quickly adapt to server change (optional, but would be very nice).

@tishun, You are correct, I rechecked and updated the list, please help review πŸš€ Is there any way that I can run the integration test in local? I try to write the test that you recommend but I got the error java: package jdk.net does not exist. How can I fix it?

You should be able to run test locally if you call make test

tishun commented 3 weeks ago

You'd need to format your new changes too, try using mvn formatter:format

thachlp commented 2 weeks ago

You'd need to format your new changes too, try using mvn formatter:format

Thanks @tishun πŸ™‡

thachlp commented 2 weeks ago

You'd need to format your new changes too, try using mvn formatter:format

Thanks @tishun πŸ™‡

Hi @tishun, the error from CI is weird, could you re-run the job? Do you have any recommend?

tishun commented 2 weeks ago

You'd need to format your new changes too, try using mvn formatter:format

Thanks @tishun πŸ™‡

Hi @tishun, the error from CI is weird, could you re-run the job? Do you have any recommend?

Hey @thachlp , [List.of()](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/List.html#of()) is a feature of Java 9, and we compile with Java 8 to achieve maximum backwards compatibility.

Could you change the use of this method with something else like Arrays.asList()

thachlp commented 2 weeks ago

You'd need to format your new changes too, try using mvn formatter:format

Thanks @tishun πŸ™‡

Hi @tishun, the error from CI is weird, could you re-run the job? Do you have any recommend?

Hey @thachlp , [List.of()](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/List.html#of()) is a feature of Java 9, and we compile with Java 8 to achieve maximum backwards compatibility.

Could you change the use of this method with something else like Arrays.asList()

Nice, thanks

tishun commented 1 week ago

I think you need to rebase your changes to include the latest fixes to the unit tests to pass the CI

thachlp commented 1 week ago

I think you need to rebase your changes to include the latest fixes to the unit tests to pass the CI

@tishun, it's done πŸ™‡

tishun commented 1 week ago

Thanks for the contribution!