Repository navigation
[raft] Protobuf encoding of proposals - #1765
MariemBaccari wants to merge 1 commit into
Conversation
d9a1f8f to
0fa1ec8
Compare
dc1f2e9 to
e09b2bb
Compare
e09b2bb to
1f46e33
Compare
1f46e33 to
47af5a5
Compare
| @@ -0,0 +1,23 @@ | |||
| FROM golang:1.27.1 | |||
There was a problem hiding this comment.
Consider passing the go version as an argument from the makefile:
- in general we will this version to be >= version in the go.mod
- there are several other places where a go version is specified that would be good to be kept in sync (e.g. openapi-to-go-server, test-certs, dummy-oauth, etc.). Not necessarily in this PR, but that would at least prepare the ground work for that (drop a TODO comment if not implemented in this PR)
| return Proposal{ | ||
| ID: id.String(), | ||
| NodeID: pb.GetNodeId(), | ||
| Timestamp: pb.GetTimestamp().AsTime(), |
There was a problem hiding this comment.
Have you checked the validity of this regarding timezones?
IIUC tz info is lost after decoding here, but it might be irrelevant (e.g. always set to UTC, tz are never taken into account, etc.)
In any case: it is worth a check and an explicit clarification somewhere somehow. Especially since I expect different nodes to operate in different timezones in our case.
There was a problem hiding this comment.
I just added a comment to clarify that the timestamp is always set to UTC to avoid this 👍
ddfc59e to
bad1496
Compare
bad1496 to
6637975
Compare
mickmis
left a comment
There was a problem hiding this comment.
Discussed offline:
- actually define the payload as a proto message with a
oneofreplacingrequest_typeandvalue - proto files in interfaces root folder
Example:
syntax = "proto3";
package dss.raftstore.consensus;
import "google/protobuf/timestamp.proto";
option go_package = "github.com/interuss/dss/pkg/raftstore/consensus/proposalpb";
// in interfaces
message UpsertOperationalIntent {
string id = 1;
string manager = 2;
// etc. ...
}
message SearchOperationalIntents {
google.protobuf.Timestamp start = 2;
// etc. ...
}
message Proposal {
bytes id = 1;
uint64 node_id = 2;
google.protobuf.Timestamp timestamp = 3;
oneof payload {
UpsertOperationalIntent UpsertOperationalIntent = 10;
SearchOperationalIntents searchOperationalIntents = 11;
// etc.
}
// string request_type = 4; // replaced by payload
// bytes value = 5; // replaced by payload
// bool read_only = 6; // could be inferred replaced by payload maybe?
}|
Considering @mickmis 's feedback, I'm closing this PR. |
This PR extracts the work of #1587 to implement protobuf based encoding of the proposal envelope (part of #1709). The previous PR used binary encoding but protobuf is a simplification that only adds a few bytes to each payload.
Follow-up PRs will implement compression and custom encoding for the payload values which will further reduce the payload size.
A small experiment shows the size difference between the json and protobuf encodings: