-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Should prefixNext(0xFF)
return "" instead of 0xFF00
?
#12598
Comments
/cc @coocood |
Another option is to return |
In practice set |
I think it is a good idea too. |
prefixNext(0xFF)
return "" instead of 0xFF0x00
?prefixNext(0xFF)
return "" instead of 0xFF00
?
@coocood Does this problem still exist? |
Yes, but we are not sure if it needs to be fixed. |
@coocood I think it is a serious bug that needs to be fixed. distributed/titan which is a Redis layer above TiKV uses |
Typically, we use
prefixNext(x)
to calculate the upper bound when we want to scan all keys have prefixx
.In other word, the range
[x, prefixNext(x))
should contain all keys that start withx
.For the specific key
0xFF
, all other keys that are equal or greater than it start with0xFF
, so the upper bound should be+inf
. Then it leads to the conclusion thatprefixNext(0xFF)
should return "" (represents +inf when it is the range end key).This issue does not affect any usage in tidb. But if someone use txn API and try to scan keys prefixed with 0xFF, it will fail.
Current implementation:
tidb/kv/key.go
Lines 43 to 58 in c0d6185
The text was updated successfully, but these errors were encountered: