当前位置:网站首页>思考(八十八):使用 protobuf 自定义选项,做数据多版本管理
思考(八十八):使用 protobuf 自定义选项,做数据多版本管理
2022-08-05 03:01:00 【fananchong2】
数据多版本管理
项目在生产环境中,数据经版本多次迭代,数据结构也可能随之扩充
需要有方法,识别这种变化,来做数据版本升级等需求
常见的思路,如:DB 中数据带版本号,代码中数据结构定义也通过某种方式确定最新版本
最近看到 Etcd 中也提供了一种更为优雅的方式
借鉴做了下练习,并记录一二
Etcd 中 WAL 的 Entry 多版本管理
在 Etcd 版本迭代中 WAL 文件中的 Entry ,随着版本迭代,导致数据结构发生变化
Etcd 有这样的需求:自身代码中的 Entry 版本比 WAL 文件中的低时,视为错误,关闭服务
Etcd 使用 protobuf 自定义选项,来达成 Entry 的多版本定义
比如:
enum EntryType {
option (versionpb.etcd_version_enum) = "3.0";
EntryNormal = 0;
EntryConfChange = 1; // corresponds to pb.ConfChange
EntryConfChangeV2 = 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边栏推荐
- 正则表达式,匹配中间的某一段字符串
- UOS系统下ksql应用缺少动态库”libtinfo.so.5“问题
- Hash table lookup (hash table)
- Review 51 MCU
- dmp(dump)转储文件
- How OpenGL works
- Intersection of Boolean Operations in SuperMap iDesktop.Net - Repairing Complex Models with Topological Errors
- 1484. Sell Products by Date
- The usage of try...catch and finally in js
- Details such as compiling pretreatment
猜你喜欢
随机推荐
Lexicon - the maximum depth of a binary tree
Programmer's Tanabata Romantic Moment
HDU 1114: Piggy-Bank ← The Complete Knapsack Problem
mysql没法Execute 大拿们求解
你要的七夕文案,已为您整理好!
How to transfer a single node of Youxuan database to a cluster
[Fortune-telling-60]: "The Soldier, the Tricky Way"-2-Interpretation of Sun Tzu's Art of War
【 genius_platform software platform development 】 : seventy-six vs the preprocessor definitions written cow force!!!!!!!!!!(in the other groups conding personnel told so cow force configuration to can
(十一)元类
The 22-07-31 weeks summary
Study Notes-----Left-biased Tree
One hundred - day plan -- -- DAY2 brush
Solve connect: The requested address is not valid in its context
Principle and Technology of Virtual Memory
甘特图来啦,项目管理神器,模板直接用
shell statement to modify txt file or sh file
Error: Not a signal or slot declaration
Data storage practice based on left-order traversal
大像素全景制作完成后,推广方式有哪些?
STM32 uses stm32cubemx LL library series tutorial









