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

批量写入目标表存在重复写入问题 #301

Closed
momisabuilder opened this issue Jan 7, 2021 · 3 comments
Closed

批量写入目标表存在重复写入问题 #301

momisabuilder opened this issue Jan 7, 2021 · 3 comments

Comments

@momisabuilder
Copy link
Contributor

测试场景
源表字符串类型数据存储到目标表整型数据类型,批量写入,发现有重复写入目标表问题

测试的时候发现:当批量写入抛出异常的时候,产生2个结果,1.写入部分数据 2.程序转到处理异常的代码块,在异常代码块会再次重新将批量数据一条一条写入目标库,这样就导致重复了

源表信息
表结构
image
表数据
image

目标表信息
表结构
image

json结构
{"job": {
"content": [
{
"reader": {
"parameter": {
"password": "test123",
"column": [
"COL1",
"COL2"
],
"connection": [
{
"jdbcUrl": [
"jdbc:oracle:thin:@//xxxx:1521/helowin"
],
"table": [
"TEST.SRC_STU_ERRORLIMIT"
]
}
],
"username": "test"
},
"name": "oraclereader"
},
"writer": {
"parameter": {
"password": "test123",
"column": [
"COL1",
"COL2"
],
"batchSize": 1024,
"connection": [
{
"jdbcUrl": "jdbc:oracle:thin:@//yyy:1521/helowin",
"table": [
"TEST.TAR_STU_ERRORLMIT"
]
}
],
"writeMode": "insert",
"username": "test"
},
"name": "oraclewriter"
}
}
],
"setting": {
"errorLimit": {
"record": 3
},
"speed": {
"bytes": 1048576,
"channel": 1
}
}
}
}

批量写入类

image

异常处理

image

@kanata163
Copy link
Contributor

@momisabuilder 感谢反馈
是的,这里这里执行异常会导致数据重复插入,内部分支已修复,稍后会推送一般到开源分支。

@momisabuilder
Copy link
Contributor Author

momisabuilder commented Jan 11, 2021 via email

@kanata163
Copy link
Contributor

嗯,我们也是这么做的。

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

No branches or pull requests

2 participants