-
Notifications
You must be signed in to change notification settings - Fork 4.1k
roachpb: Protobuf encoding does not omit empty messages #85312
Copy link
Copy link
Closed
Labels
A-kvAnything in KV that doesn't belong in a more specific category.Anything in KV that doesn't belong in a more specific category.C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.T-kvKV TeamKV Team
Description
As seen over in #85138 (comment), it appears that gogoproto is encoding embedded messages even though they are empty. In other words, consider this message:
message Foo {
Timestamp timestamp = 1;
}
message Timestamp {
int64 wall_time = 1;
int32 logical = 2;
bool synthetic = 3;
}Even though empty Protobuf fields can be omitted, gogoproto will encode an empty Foo into 2 bytes: 0x0a 0x00, which essentially says field 1 of wire type delimited with length 0 (see encoding spec).
The encoding should be able to omit this field entirely, which might net us some minor savings throughout the codebase (e.g. for every unset timestamp field).
Jira issue: CRDB-18178
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-kvAnything in KV that doesn't belong in a more specific category.Anything in KV that doesn't belong in a more specific category.C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.T-kvKV TeamKV Team