当前位置:网站首页>tidb-cdc同步mysql没有的特性到mysql时的处理
tidb-cdc同步mysql没有的特性到mysql时的处理
2022-06-11 17:19:00 【与数据交流的路上】
一、背景
为了保证tidb的稳定运行,我们在tidb的后端接入了一个mysql,但是tidb中又有一些mysql中没有的特性,那这时候cdc会怎么处理呢,下面挑了其中几个常用的特性进行实验
二、实验步骤
1.刷新二进制
# 执行位置:下游mysql
# 目的:为了更容易查看写入到二进制中的真实内容
flush logs
2.创建含SHARD_ROW_ID_BITS特性的表
create table write_hot_3 (id bigint(20) not null, z_name varchar(20), z_info varchar(30),unique key(id)) SHARD_ROW_ID_BITS = 4
PRE_SPLIT_REGIONS=3
create table write_hot_2(id bigint(20) not null auto_random primary key,z_name varchar(20),z_info varchar(30));
insert into write_hot_2(z_name,z_info) values('abc','def');
3.观测结果
3.1 下游建表情况
show create table write_hot_3;
CREATE TABLE `write_hot_3` (
`id` bigint(20) NOT NULL,
`z_name` varchar(20) DEFAULT NULL,
`z_info` varchar(30) DEFAULT NULL,
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
show create table write_hot_2;
CREATE TABLE `write_hot_2` (
`id` bigint(20) NOT NULL,
`z_name` varchar(20) DEFAULT NULL,
`z_info` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb
select * from write_hot_2;
3.2 观察二进制情况
mysqlbinlog --base64-output=decode-rows -vv mysql-bin.000003
# 可以发现二进制中记录的内容是带具体的注释的,说明如果有dm同步的时候,,下游的tidb集群也能创建出包含SHARD_ROW_ID_BITS特性的表
SET @@session.collation_database=DEFAULT/*!*/;
create table write_hot_3 (id bigint(20) not null, z_name varchar(20), z_info varchar(30),unique key(id)) /* 90000 SHARD_ROW_ID_BITS = 4
PRE_SPLIT_REGIONS=3 */
/*!*/;
# at 523
#220527 10:29:16 server id 1 end_log_pos 732 CRC32 0x0564e224 Query thread_id=43 exec_time=0 error_code=0
SET TIMESTAMP=1653618556/*!*/;
create table write_hot_2(id bigint(20) not null /*T![auto_rand] auto_random */ primary key,z_name varchar(20),z_info varchar(30))
/*!*/;
# at 928
#220527 10:34:43 server id 1 end_log_pos 980 CRC32 0x3c2cef4c Write_rows: table id 121 flags: STMT_END_F
### INSERT INTO `test_db`.`write_hot_2`
### SET
### @1=4035225266123964417 /* LONGINT meta=0 nullable=0 is_null=0 */
### @2='abc' /* VARSTRING(80) meta=80 nullable=1 is_null=0 */
### @3='def' /* VARSTRING(120) meta=120 nullable=1 is_null=0 */
三、验证的特性
可以正常同步且二进制中保留特性的功能
- SHARD_ROW_ID_BITS
- auto_random
- auto_random的隐式插入
后续实验持续更新
边栏推荐
- Learning C language from scratch day 039
- LeetCode——42. Connected to rainwater (double pointer)
- 04_特征工程—特征选择
- Hands on deep learning - multiple input and output channels in the convolution layer
- 信息安全数学基础 Chapter 2——同余
- LeetCode-1005. Maximized array sum after K negations
- CLP information -5 keywords to see the development trend of the financial industry in 2022
- 拜登下令强制推行零信任架构
- Meituan won the first place in fewclue in the small sample learning list! Prompt learning+ self training practice
- Authing Share|理解 SAML2 协议
猜你喜欢

which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_ mod

C language: use H and C. summary of problems encountered in documents

从制造到“智造”,探索制造企业破局之道

The use of histogram function in MATLAB

10 times faster than 5g. Are you ready for 10 Gigabit communication?

为什么udp流设置1316字节

From manufacturing to "intelligent manufacturing", explore the way for manufacturing enterprises to break the situation

Bentley 使用 Authing 快速实现应用系统与身份的集成

【线上问题】Timeout waiting for connection from pool 问题排查

C语言:使用.h和.c文件遇到的问题总结
随机推荐
ffmpeg CBR精准码流控制三个步骤
How to simplify a lot of if... Elif... Else code?
用实际案例分析PMP与ACP应该考哪个?哪个更有用?
Authing biweekly news: online application market (5.10-5.22)
which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mod
RecyclerView缓存复用解析,源码解读
Typescript learning notes (II)
[pytest learning] after the pytest case fails to execute, the others will not be executed
ffmpeg奇偶场帧Interlace progressive命令和代码处理
vscode配置eslint自动格式化报错“The setting is deprecated. Use editor.codeActionsOnSave instead with a source“
信息安全数学基础 Chapter 1——整除
What problems are exposed when all Sohu employees are cheated?
JPA循环保存多个实体失败
Cocoapod only updates the specified library (does not update the index)
API management artifact that allows you to call wow directly
JSP page initial loading method
Classification and method of feature fusion
Config: user attribute configuration framework
ffmpeg硬编解码 Inter QSV
AXI协议基础知识