-
Notifications
You must be signed in to change notification settings - Fork 76
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
Go: Implement PfMerge command #3082
base: main
Are you sure you want to change the base?
Go: Implement PfMerge command #3082
Conversation
Signed-off-by: Niharika Bhavaraju <[email protected]>
// | ||
// [valkey.io]: https://valkey.io/commands/pfmerge/ | ||
func (client *baseClient) PfMerge(destination string, sourceKeys []string) (string, error) { | ||
result, err := client.executeCommand(C.PfMerge, append([]string{destination}, sourceKeys...)) |
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.
Can we check if at-least one sourceKey is as PFMerge
require at least one source key and this would lead to anyhow failure and will waste one network call, we can use something like this :-
if len(sourceKeys) == 0 {
return "", errors.New("at least one source key is required for PfMerge")
}
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.
No need, we don't do this in other commands/clients
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.
But adding this check will make the execution of command more efficient isn't it, and if other clients have not implemented such behavior, it seems a miss because anyhow the execution of command is going to fail.
go/api/base_client.go
Outdated
// Note: | ||
// | ||
// In cluster mode, if keys in `keyValueMap` map to different hash slots, the command | ||
// will be split across these slots and executed separately for each. This means the command | ||
// is atomic only at the slot level. If one or more slot-specific requests fail, the entire | ||
// call will return the first encountered error, even though some requests may have succeeded | ||
// while others did not. If this behavior impacts your application logic, consider splitting | ||
// the request into sub-requests per slot to ensure atomicity. |
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.
There should be another cross-slot notice. If keys mapped to different slots, command fails.
Signed-off-by: Niharika Bhavaraju <[email protected]>
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.
Please update command example to match new example template (see developer doc and/or other commands)
Add a changelog entry
Go: Implement PfMerge command