当前位置:网站首页>思考(八十八):使用 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
边栏推荐
- The 22-07-31 weeks summary
- 通过模拟Vite一起深入其工作原理
- 【 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
- 百日刷题计划 ———— DAY2
- J9 Digital Currency: What is the creator economy of web3?
- 腾讯云【Hiflow】新时代自动化工具
- 基于左序遍历的数据存储实践
- 北斗三号短报文终端露天矿山高边坡监测方案
- 龙蜥社区第二届理事大会圆满召开!理事换届选举、4 位特约顾问加入
- 1484. Sell Products by Date
猜你喜欢
Intersection of Boolean Operations in SuperMap iDesktop.Net - Repairing Complex Models with Topological Errors
Compressed storage of special matrices
Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
QT MV\MVC structure
【软件测试】自动化测试之unittest框架
How OpenGL works
How to sort multiple fields and multiple values in sql statement
Countdown to 2 days|Cloud native Meetup Guangzhou Station, waiting for you!
lua学习
Study Notes-----Left-biased Tree
随机推荐
Talking about data security governance and privacy computing
云原生(三十二) | Kubernetes篇之平台存储系统介绍
QT MV\MVC structure
private package
人人都在说的数据中台,你需要关注的核心特点是什么?
Why did they choose to fall in love with AI?
QT: The Magical QVarient
The design idea of DMicro, the Go microservice development framework
Details such as compiling pretreatment
Ant Sword Advanced Module Development
undo problem
剑指offer专项突击版第20天
A small tool to transfer files using QR code - QFileTrans 1.2.0.1
虚拟内存原理与技术
Linux下常见的开源数据库,你知道几个?
[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)
shell语句修改txt文件或者sh文件
数据增强Mixup原理与代码解读
Likou - preorder traversal, inorder traversal, postorder traversal of binary tree
shell statement to modify txt file or sh file