Closed FZambia closed 1 year ago
Hi @FZambia,
Yes, it went wrong with RESP2/RESP3 detection.
Thankfully, the automatic detection won't be too tricky. I had fixed it in https://github.com/rueian/rueidis/commit/9e18fa61686f5c83e12575906e554c182cfa674e and would release it this weekend.
Thanks!
One more thing with it is that for some reason:
func (r *RedisError) IsNoScript() bool {
return strings.HasPrefix(r.string, "NOSCRIPT")
}
does not work, the r.string
is ERR NOSCRIPT No matching script. Please use EVAL
in case of kvrocks. For real Redis it's NOSCRIPT No matching script. Please use EVAL.
Yeah... :(
kvrocks:
❯ redis-cli
127.0.0.1:6379> evalsha 1212 1 t
(error) ERR NOSCRIPT No matching script. Please use EVAL
Redis:
❯ redis-cli
127.0.0.1:6379> evalsha 1212 1 t
(error) NOSCRIPT No matching script. Please use EVAL.
It's actually interesting that Redigo works fine, even though it uses the same HasPrefix check https://github.com/gomodule/redigo/blob/d6854479365f0307560fa28e18e2bd0634b05229/redis/script.go#L82
Maybe it strips ERR
prefix somewhere...
https://github.com/apache/incubator-kvrocks/issues/485 mentions this.
It's actually interesting that Redigo works fine, even though it uses the same HasPrefix check
Found the reason - that's because in Redigo implementation I preloaded scripts manually on start.
I was linked that in go-redis
error messages are stripped to work with kvrocks: https://github.com/go-redis/redis/blob/4bda6ec2fb4a836bbffc0032ad3a0f2f79528ccb/error.go#L23. Not sure whether this should be added to rueidis
too or I better fix this on the application level for now?
Hi @FZambia,
I think just removing the ERR
prefix is a good idea. It is not only fast but also unified error message handling.
I believe no one would rely on the meaningless ERR
prefix to identify redis error, therefore just removing it is probably safe.
This has been addressed in https://github.com/rueian/rueidis/commit/e0b466d32a46e56d9d0b1537831922e08f511119 along with new Lua integration tests.
Think it's safe yep, thanks - this will simplify my life a bit.
Checked - everything works fine now, many thanks!
Rueidis worked with
kvrocks
before, but does not work with its new release:Test fails:
Redigo works fine with new
kvrocks
release. I suppose sth goes wrong with RESP2/RESP3 detection.If the automatic detection becomes too tricky – then probably an option to force RESP2 or RESP3 could make sense.