Skip to content
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

gogo/protobuf is deprecated #16

Open
johnlanda opened this issue Dec 29, 2022 · 1 comment
Open

gogo/protobuf is deprecated #16

johnlanda opened this issue Dec 29, 2022 · 1 comment

Comments

@johnlanda
Copy link

The gogoproto project is deprecated.

I noticed that there is an issue in the etcd repo but wanted to raise this here as well now that raft is in its own repo.

It seems like the consensus was to move to google.golang.org/protobuf

@tbg
Copy link
Collaborator

tbg commented Jan 11, 2023

Unfortunately, the official protobuf library lacks an equivalent to (gogoproto.nullable). We have a number of non-primitive fields that would then be turned into pointers, which would likely negatively impair the memory efficiency of raft:

raft/raftpb/raft.proto

Lines 70 to 107 in 09c91d8

message Message {
optional MessageType type = 1 [(gogoproto.nullable) = false];
optional uint64 to = 2 [(gogoproto.nullable) = false];
optional uint64 from = 3 [(gogoproto.nullable) = false];
optional uint64 term = 4 [(gogoproto.nullable) = false];
// logTerm is generally used for appending Raft logs to followers. For example,
// (type=MsgApp,index=100,logTerm=5) means the leader appends entries starting
// at index=101, and the term of the entry at index 100 is 5.
// (type=MsgAppResp,reject=true,index=100,logTerm=5) means follower rejects some
// entries from its leader as it already has an entry with term 5 at index 100.
// (type=MsgStorageAppendResp,index=100,logTerm=5) means the local node wrote
// entries up to index=100 in stable storage, and the term of the entry at index
// 100 was 5. This doesn't always mean that the corresponding MsgStorageAppend
// message was the one that carried these entries, just that those entries were
// stable at the time of processing the corresponding MsgStorageAppend.
optional uint64 logTerm = 5 [(gogoproto.nullable) = false];
optional uint64 index = 6 [(gogoproto.nullable) = false];
repeated Entry entries = 7 [(gogoproto.nullable) = false];
optional uint64 commit = 8 [(gogoproto.nullable) = false];
// (type=MsgStorageAppend,vote=5,term=10) means the local node is voting for
// peer 5 in term 10. For MsgStorageAppends, the term, vote, and commit fields
// will either all be set (to facilitate the construction of a HardState) if
// any of the fields have changed or will all be unset if none of the fields
// have changed.
optional uint64 vote = 13 [(gogoproto.nullable) = false];
// snapshot is non-nil and non-empty for MsgSnap messages and nil for all other
// message types. However, peer nodes running older binary versions may send a
// non-nil, empty value for the snapshot field of non-MsgSnap messages. Code
// should be prepared to handle such messages.
optional Snapshot snapshot = 9 [(gogoproto.nullable) = true];
optional bool reject = 10 [(gogoproto.nullable) = false];
optional uint64 rejectHint = 11 [(gogoproto.nullable) = false];
optional bytes context = 12 [(gogoproto.nullable) = true];
// responses are populated by a raft node to instruct storage threads on how
// to respond and who to respond to when the work associated with a message
// is complete. Populated for MsgStorageAppend and MsgStorageApply messages.
repeated Message responses = 14 [(gogoproto.nullable) = false];
}

We have the same problem over in https://github.com/cockroachdb/cockroach/. I know we have an issue but I can't find it right now.

This doesn't mean we want to stick with gogoproto forever, just pointing out that it's not trivial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants