-
Notifications
You must be signed in to change notification settings - Fork 3.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
util/encoding: types JSON and SENTINEL_TYPE have the same value #25759
Comments
I think the code is correct. The problem is the explanation in the comment to Namely:
What's going on here is that the protobuf encoding has special casing for values up to and including 15. Namely all those values are encoded in a single byte. Values above that are encoded in multiple bytes. The constant I think the name "SentinelType" is not sufficiently descriptive, and also the comment next to it is not describing what's going on sufficiently. I have not yet thought enough about this to make an educated proposal. |
The existence of the SentinelType, which overlaps in value with other values in the enum confuses readers. Fixes cockroachdb#25759. Release note: None
The existence of the SentinelType, which overlaps in value with other values in the enum confuses readers. Fixes cockroachdb#25759. Release note: None
26430: util: explicitly enumerate encoding types r=arjunravinarayan a=arjunravinarayan The existence of the SentinelType, which overlaps in value with other values in the enum confuses readers. Also improve the comment on SentinelType. Fixes #25759. 26466: distsql: beef up lookup join tests r=solongordon a=solongordon I improved our lookup join tests by adding unit tests for left outer joins and distributing the logic tests across multiple nodes. Fixes #25862 Release note: None Co-authored-by: Arjun Narayan <[email protected]> Co-authored-by: Solon Gordon <[email protected]>
This seems... like a bug? We have an
iota
enum for all the types, but we special caseSENTINEL_TYPE
becauseDo not change SentinelType from 15. This value is specifically used for bit manipulation in EncodeValueTag.
But then we define JSON afterwards, it also has value
15
.Here is the output of the following code:
There is a helpful
// TODO(dan): Make this into a proto enum.
above the const declaration, which is possibly worth investing in. A proto definition would have avoided these problems.I would appreciate some commentary on what's going on here. Looking at the code paths, there isn't any overlap so there's no extant bug based on this shadowing, but we should probably bump the
JSON
type value up to16
,or take the opportunity to proto-ify this code.cc @knz
The text was updated successfully, but these errors were encountered: