Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mediumint(8) unsigned 9999999-->16777215 #182

Closed
Thy0108 opened this issue Jul 1, 2019 · 1 comment · Fixed by #183
Closed

mediumint(8) unsigned 9999999-->16777215 #182

Thy0108 opened this issue Jul 1, 2019 · 1 comment · Fixed by #183

Comments

@Thy0108
Copy link

Thy0108 commented Jul 1, 2019

测试表DDL:
CREATE TABLE t_test (
id int(11) NOT NULL AUTO_INCREMENT,
test mediumint(8) unsigned NOT NULL,
test1 tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;

主要配置如下:
"config": {
"name": "test-int",
"prome-persist": false,
"version": "1.0",
"input": {
"type": "mysql",
"mode": "replication",
"config": {
"batch-per-second-limit": 10,
"nr-scanner": 10,
"source": {
"host": "127.0.0.1",
"password": "xxxx",
"port": 3306,
"username": "xxx"
},
"table-configs": [
{
"schema": "test",
"table": "t_test"
}
],
"table-scan-batch": 1000
}
},
"output": {
"type": "mysql",
"config": {
"enable-ddl": true,
"routes": [
{
"match-schema": "test",
"match-table": "t_test",
"target-schema": "test",
"target-table": "t_test_copy"
}
],
"target": {
"host": "127.0.0.1",
"password": "xxxx",
"port": 3306,
"username": "xxx"
}
}
},
"scheduler": {
"type": "batch-table-scheduler",
"config": {
"batch-size": 1,
"nr-worker": 10,
"queue-size": 1024,
"sliding-window-size": 10240
}
}
}

开启任务之后执行下面的增量DML

DML:
insert into t_test values(1,9999999,230);

结果如下
t_test数据

image

t_test_copy数据
image

PS:之前在使用go-mysql的时候tinyint 超过128 解析为负数的情况

@Ryan-Git
Copy link
Collaborator

Ryan-Git commented Jul 1, 2019

@Thy0108
问题是 medium int 是 24 位,golang 里没有原生的对应类型,用了 int32,导致转成 uint32 时候出现问题。
go-mysql replication 模块没问题,binlog 里不带符号的,但 canal 模块有同样的问题。
临时方案你们看能不能把 medium int 改了,其他整数类型都没问题的。我这边也想办法修一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants