-
Notifications
You must be signed in to change notification settings - Fork 68
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
Java: Add FLUSHDB
command.
#1593
Java: Add FLUSHDB
command.
#1593
Conversation
* Add `FLUSHDB` command. Signed-off-by: Yury-Fridlyand <[email protected]> * Address PR comments. Signed-off-by: Yury-Fridlyand <[email protected]> --------- Signed-off-by: Yury-Fridlyand <[email protected]>
…USHDB Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
* assert response.equals("OK"); | ||
* }</pre> | ||
*/ | ||
CompletableFuture<String> flushdb(SingleNodeRoute route); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why only single node here? especially since the default is a multinode route
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- update to multinode or update comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied that from flushall
- Route
includes ALL_NODES
which always fails, because replicas are RO. Even though it may fail now with RANDOM route too.
In a dark future it is nice to have better route distinuishment by their target - RO and non-RO alongside with single/multi node. In that case we can put here non-RO route to protect a user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the users want to send to all primaries? I guess the thinking is they should use the non-route function since it defaults to all primaries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have to be smart then. Thanks for asking Bar - I guess we can either let the user fail (giving them all options) or limit their options but maybe close some edge cases.
java/client/src/main/java/glide/api/commands/ServerManagementClusterCommands.java
Outdated
Show resolved
Hide resolved
@@ -668,6 +668,8 @@ private static Object[] serverManagementCommands(BaseTransaction<?> transaction) | |||
.lolwut(1) | |||
.flushall() | |||
.flushall(ASYNC) | |||
.flushdb() | |||
.flushdb(ASYNC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test will fail if we run against 6.1 or prior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting with Redis version 6.2.0: Added the SYNC flushing mode modifier.
No fix needed here, I use ASYNC
.
Thanks for catching that!
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
* Java: Add `FLUSHDB` command. (#366) Signed-off-by: Yury-Fridlyand <[email protected]>
* Java: Add `FLUSHDB` command. (#366) Signed-off-by: Yury-Fridlyand <[email protected]>
Issue #, if available:
N/A
Description of changes:
https://redis.io/docs/latest/commands/flushdb/
Almost copy-paste from #1368
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.