lnx-search / datacake

Tooling for creating your own distributed systems.
MIT License
390 stars 22 forks source link

RPC Backward and Forward Compatibility #35

Open simon-fu opened 1 year ago

simon-fu commented 1 year ago

Suppose we add some fields to RPC message and upgrade cluster in production ENV. We must upgrade each node one by one instead of stopping all nodes of cluster. So old nodes and new nodes maybe co-exist in the same cluster, that required RPC message supporting backward and forward compatibility.

Does datacake-rpc support this scenario ?

ChillFish8 commented 1 year ago

Currently, the RPC framework does not do anything to modify the structure of the serialized data really, so in theory, providing the messages you send aren't different between versions there shouldn't be any inter-op issues.

One thing to note though is the format is dependent on rkyv, which is currently at 0.7 and may change when it stabilises, if i remember correctly though the data layout is that of how it is laid out in rust, so providing your messages are repr(C) (and the derived archived messages which can be done via the archived_attr macro) your format should be stable. I recommend using repr(C) on the messages in general for extra peace of mind.