当前位置:网站首页>Thinking (88): Use protobuf custom options for multi-version management of data
Thinking (88): Use protobuf custom options for multi-version management of data
2022-08-05 03:06:00 【fananchong2】
Data multi-version management
In the production environment of the project, the data is iterated for many times, and the data structure may also be expanded.
There needs to be a way to identify such changes and to do data version upgrades and other requirements
Common ideas, such as: the data in the DB has a version number, and the data structure definition in the code also determines the latest version in some way
Recently seen a more elegant way also available in Etcd
I did the next exercise for reference, and recorded one or two
Entry Multiversion Management for WAL in Etcd
Entry in the WAL file in the Etcd version iteration, resulting in changes to the data structure as the version iterates
Etcd has such a requirement: when the Entry version in its own code is lower than that in the WAL file, it is regarded as an error and the service is closed
Etcd uses protobuf customization options to achieve multi-version definition of Entry
For example:
enum EntryType {option (versionpb.etcd_version_enum) = "3.0";EntryNormal = 0;EntryConfChange = 1; // corresponds to pb.ConfChangeEntryConfChangeV2 = 2 [(versionpb.etcd_version_enum_value)="3.4"]; // corresponds to pb.ConfChangeV2}message Entry {option (versionpb.etcd_version_msg) = "3.0";optional uint64 Term = 2 [(gog
边栏推荐
- 【滤波跟踪】基于matlab无迹卡尔曼滤波惯性导航+DVL组合导航【含Matlab源码 2019期】
- Beyond YOLO5-Face | YOLO-FaceV2 officially open source Trick+ academic point full
- 龙蜥社区第二届理事大会圆满召开!理事换届选举、4 位特约顾问加入
- Compressed storage of special matrices
- The Tanabata copywriting you want has been sorted out for you!
- Data storage practice based on left-order traversal
- Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
- 627. Change of gender
- 22-07-31周总结
- 开源协议说明LGPL
猜你喜欢
随机推荐
静态方法获取配置文件数据
Countdown to 2 days|Cloud native Meetup Guangzhou Station, waiting for you!
ASP.NET application--Hello World
Data storage practice based on left-order traversal
HDU 1114:Piggy-Bank ← 完全背包问题
(11) Metaclass
Simple description of linked list and simple implementation of code
Physical backup issues caused by soft links
通过模拟Vite一起深入其工作原理
Talking about data security governance and privacy computing
Hash table lookup (hash table)
Multithreading (2)
QT语言文件制作
mysql没法Execute 大拿们求解
Syntax basics (variables, input and output, expressions and sequential statements)
Compressed storage of special matrices
开源协议说明LGPL
语法基础(变量、输入输出、表达式与顺序语句完成情况)
Everyone in China said data, you need to focus on core characteristic is what?
1527. Patients suffering from a disease