alibaba / alibaba/DataX

请问下mysqlwriter的writeMode写入方式insert/replace/update,后两种是否无效?

Open
#860 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
17.4k
Forks
5.7k
PR merge metrics
No merged PRs in 30d

Description

我试了一下update/replace,当主键冲突时并没有更新数据,而是执行了回滚操作,冲突的数据没变,增量的数据是入库成功了。以下是我的配置信息,请问下是否配置错误:
{
"job": {
"content": [
{
"reader": {
"name": "mysqlreader",
"parameter": {
"column": [
"id",
"account",
"ip",
"api_name",
"type",
"operation_time",
"detail"
],
"connection": [
{
"jdbcUrl": [
"jdbc:mysql://*.*.*.*:3306/gda_sys?useUnicode=true&serverTimezone=UTC&characterEncoding=utf8"
],
"table": [
"operation_log"
]
}
],
"password": "123456",
"splitPk": "id",
"username": "root",
"where": "type ='LOGIN'"
}
},
"writer": {
"name": "mysqlwriter",
"parameter": {
"column": [
"id",
"account",
"ip",
"api_name",
"type",
"operation_time",
"detail"
],
"connection": [
{
"jdbcUrl": "jdbc:mysql://*.*.*.*:3306/gda_sys?useUnicode=true&serverTimezone=UTC&characterEncoding=utf8",
"table": [
"operation_log_copy1"
]
}
],
"password": "123456",
"table": "operation_log_copy1",
"username": "root",
"writerMode": "update"
}
}
}
],
"setting": {
"errorLimit": {},
"speed": {
"channel": 3
}
}
}
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the mysqlwriter entry point and inspect how the supplied writerMode values—insert, replace, and update—are handled. Reproduce the primary-key conflict with the configuration in the issue, then verify whether the rollback is caused by configuration or implementation. Done means the supported conflict behavior is confirmed and the relevant behavior is corrected or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.