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 SAVE
command.
#1309
base: main
Are you sure you want to change the base?
Java: Add SAVE
command.
#1309
Conversation
* Add `SAVE` commands. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> * Update IT. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> * PR comments. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> --------- Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
java/client/src/main/java/glide/api/models/BaseTransaction.java
Outdated
Show resolved
Hide resolved
@@ -283,6 +283,37 @@ public interface ServerManagementClusterCommands { | |||
*/ | |||
CompletableFuture<ClusterValue<String[]>> time(Route route); | |||
|
|||
/** | |||
* Synchronously saves the database(s) to disk.<br> |
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.
Nit:
Performs a synchronous save of the dataset producing a point in time snapshot of all the data inside the Redis instance, in the form of an RDB file.
Just copy valkey/redis? Could be confusing to see the keyword snapshot in the return but not talked about in the description.
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.
Copied from there:
127.0.0.1:6379> command docs save
1# "save" =>
1# "summary" => "Synchronously saves the database(s) to disk."
2# "since" => "1.0.0"
3# "group" => "server"
4# "complexity" => "O(N) where N is the total number of keys in all databases"
* @param <T> Command return type. | ||
*/ | ||
@SneakyThrows | ||
public static <T> Pair<T, String> tryCommandWithExpectedError( |
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.
Do we want to ask the AWS team what they think the testing we are doing for save?
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.
Sure. @barshaul @shohamazon,
I use that function, because the command may return the error. I don't interpret this as a failure, so just ignore the error.
There is also 2 sec sleep between command calls to reduce the chance of the error. Unfortunately, can't eliminate it completely, even using a loop.
@SneakyThrows | ||
public void save() { | ||
String error = "Background save already in progress"; | ||
// use another client, because it could be blocked |
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.
Are you closing the clients if you are not using default?
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.
try
block closes the temporary client
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Suspended - no desicion on how should we test that and whether GLIDE client needs that command |
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Issue #, if available:
N/A
Description of changes:
https://redis.io/docs/latest/commands/save/
Note: No IT for that command, because:
Background save already in progress
errorBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.