Add new error message to detect as non-cluster redis (#11719)

This commit is contained in:
Martin Angers 2023-05-16 14:24:38 -04:00 committed by GitHub
parent 9a876ece1c
commit 043606895c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -345,8 +345,14 @@ func isClusterDisabled(err error) bool {
// On GCP Memorystore the CLUSTER command is entirely unavailable and fails with
// this error. See
// https://cloud.google.com/memorystore/docs/redis/product-constraints#blocked_redis_commands
//
// At some point it seems like the error message changed from wrapping the
// command name with backticks to single quotes.
func isClusterCommandUnknown(err error) bool {
return strings.Contains(err.Error(), "ERR unknown command `CLUSTER`")
return strings.Contains(err.Error(), "ERR unknown command `CLUSTER`") ||
strings.Contains(err.Error(), "ERR unknown command 'CLUSTER'") ||
strings.Contains(err.Error(), "ERR unknown command CLUSTER") ||
strings.Contains(err.Error(), `ERR unknown command "CLUSTER"`)
}
func ScanKeys(pool fleet.RedisPool, pattern string, count int) ([]string, error) {