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

Remove not readonly commands #2832 #2871

Merged
merged 29 commits into from
Jun 22, 2024

Conversation

thachlp
Copy link
Contributor

@thachlp thachlp commented Jun 4, 2024

Issue: #2832

Make sure that:

  • You have read the contribution guidelines.
  • You have created a feature request first to discuss your contribution intent. Please reference the feature request ticket number in the pull request.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.

Copy link
Collaborator

@tishun tishun left a comment

Choose a reason for hiding this comment

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

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
Copy link
Collaborator

tishun commented Jun 6, 2024

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.

@tishun tishun added this to the 7.0.0.RELEASE milestone Jun 6, 2024
@tishun tishun added the type: bug A general bug label Jun 6, 2024
@tishun tishun modified the milestones: 7.0.0.RELEASE, 7.x Jun 6, 2024
Add test
@thachlp
Copy link
Contributor Author

thachlp commented Jun 8, 2024

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?

@thachlp thachlp requested a review from tishun June 8, 2024 05:43
@tishun
Copy link
Collaborator

tishun commented Jun 8, 2024

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

Copy link
Collaborator

@tishun tishun left a comment

Choose a reason for hiding this comment

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

Looks perfect, the two notes are good-to-have

}

@Test
void testReadOnlyCommands() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome! This is exactly what I wanted to see and it would help us keep this list up-to-date.

Two notes:

  • you can move this test to the ServerCommandIntegrationTest - no need to create a whole new class for it
  • you can use the CommandDetailParser to parse the result, instead of parsing it yourself (would also mean that if something changes in the result API you would not have to modify the test and we will keep the change locally to the parser)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @tishun, thanks for the notes.
I updated the test, please help check 🙇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

btw, If anything need to pass the CI check, please suggest.
On local, I got this message:

[ERROR] Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.16.0:validate (default) on project lettuce-core: File '/...lettuce/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java' has not been previously formatted.  Please format file and commit before running validation! -> [Help 1]

@tishun
Copy link
Collaborator

tishun commented Jun 10, 2024

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

@thachlp
Copy link
Contributor Author

thachlp commented Jun 11, 2024

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

Thanks @tishun 🙇

@thachlp
Copy link
Contributor Author

thachlp commented Jun 11, 2024

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
Copy link
Collaborator

tishun commented Jun 12, 2024

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() 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
Copy link
Contributor Author

thachlp commented Jun 12, 2024

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() 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
Copy link
Collaborator

tishun commented Jun 21, 2024

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

atakavci and others added 10 commits June 22, 2024 11:51
workaround for apt update issue related to Clearsigned file
* GitHub issue template polishing and stale issues action

* Addressing feedback on message test and a better label for the stale issues
* HEXPIRE implemented with integration tests

* Polishing to integration test, added unit test

* Move new commands to RedisHashCommands, added HEXPIREAT, HEXPIRETIME and HPERSIST

* Make sure we reset the configuration setting after the new hash commands were tested

* Broke one test because of wrong configuration setting; the other is unstable, trying to fix it

* Polishing imports

* Polishin : Copyright change not needed
* implementation of SPUBLISH

* sort methods by name

* test cluster spublish with no redirects

* use injected cluster client in RedisClusterPubSubConnectionIntegrationTests
* Let's try this again

* Add tests and templates

* Merge formatting issues + formatter using wrong configuration
* Add support CLIENT KILL [MAXAGE]

* polish

* address review changes

* format code
* Add support for `SUNSUBSCRIBE` redis#2759

* replace junit.Assert with assertj
tishun and others added 15 commits June 22, 2024 11:52
)

* Fixes to the hash field expiration functions

* Implemented HPEXPIRE, HPEXPIREAT, HPEXPIRETIME, HTTL, HPTTL

* Format the files

* FIELDS keyword was introduced as per the PRD

* Extend tests to include HTTL

* Repair unit tests, add new ones for the new commands

* Disable failing test, becasue it is very unstable

* Modify return value to list of long values, fix cluster logic

* Polishing

* Polishing - addressed Ali's comments

* Polishing: Modified by mistake

* Polishing : Addressed Marks' comments
* Add last() utility method to the XArgs.StreamOffset

* Submitted one more file by mistake
…edis#2868)

* Add a evalReadOnly overload that accepts the script as a String

* Fix @SInCE annotation for 7.0
* Release-drafter, dependabot, OCD polishing

* Commitish not needed and pointing to the wrong branch anyway, also wrong version chosen

* Pipeline is also very confusing as there are many pipelines, this is the INTEGRATION pipeline

* Adding commitish, as it is required for filter-by-commitish

* Autolabeling hits issues when using pull_request, using pull_request_target instead

* pull_request_target does nothing, trying the other suggestion from release-drafter/release-drafter#1125
redis#2873)

Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.6.3 to 3.7.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](apache/maven-javadoc-plugin@maven-javadoc-plugin-3.6.3...maven-javadoc-plugin-3.7.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…s#2874)

Bumps [org.codehaus.mojo:flatten-maven-plugin](https://github.com/mojohaus/flatten-maven-plugin) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/mojohaus/flatten-maven-plugin/releases)
- [Commits](mojohaus/flatten-maven-plugin@1.5.0...1.6.0)

---
updated-dependencies:
- dependency-name: org.codehaus.mojo:flatten-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…edis#2875)

Bumps [org.apache.maven.plugins:maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.3.0 to 3.4.1.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](apache/maven-jar-plugin@maven-jar-plugin-3.3.0...maven-jar-plugin-3.4.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-jar-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…s#2876)

Bumps [org.openjdk.jmh:jmh-generator-annprocess](https://github.com/openjdk/jmh) from 1.21 to 1.37.
- [Commits](openjdk/jmh@1.21...1.37)

---
updated-dependencies:
- dependency-name: org.openjdk.jmh:jmh-generator-annprocess
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps org.apache.commons:commons-pool2 from 2.11.1 to 2.12.0.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-pool2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Bump version of lettuce-core to 6.4.0

* Change all @SInCE notations to match the next release 6.4.x and also fixed two typos in the API JavaDoc

* Fixed formatting issues
COMMAND INFO READWRITE
1) 1) "readwrite"
   2) "1"
   3) 1) "loading"
      2) "stale"
      3) "fast"
@thachlp thachlp force-pushed the remove-not-read-only-command branch from 1cdc708 to fe2f247 Compare June 22, 2024 04:53
@thachlp
Copy link
Contributor Author

thachlp commented Jun 22, 2024

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 tishun merged commit d507743 into redis:main Jun 22, 2024
5 checks passed
@tishun
Copy link
Collaborator

tishun commented Jun 22, 2024

Thanks for the contribution!

@thachlp thachlp deleted the remove-not-read-only-command branch June 22, 2024 13:32
@tishun tishun modified the milestones: 7.x, 6.5.0.RELEASE, 6.4.0.RELEASE Aug 16, 2024
ggivo added a commit to ggivo/lettuce that referenced this pull request Oct 30, 2024
…lica" on READS... only if master & replica configured redis#1813

Divert pure read intentions of georadius and georadiusbymember commands (variants that do not use STORE/STOREDIST) to GEORADIUS_RO/GEORADIUSBYMEMBER_RO
This will unify the behaviour between Cluster and Redis Standalone/Replica arrangements

Relates to  issues redis#1481 redis#2568 redis#2871

Closes redis#1813
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

Successfully merging this pull request may close these issues.

6 participants