alibaba / alibaba/DataX

求解!mysqlwriter 中方法注释程序仍然可以正常运行!

Open
#696 2 comments 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

前提:txtfilereader -> mysqlwriter,保留核心包,其余reader、writer已删除
```
//MysqlWriter:78
public void startWrite(RecordReceiver recordReceiver) {
this.commonRdbmsWriterTask.startWrite(recordReceiver, this.writerSliceConfig,
super.getTaskPluginCollector());
}
```

```
//CommonRdbmsWriter:310
public void startWrite(RecordReceiver recordReceiver,
Configuration writerSliceConfig,
TaskPluginCollector taskPluginCollector) {
System.out.println("方法进入");
/*
Connection connection = DBUtil.getConnection(this.dataBaseType,
this.jdbcUrl, username, password);
DBUtil.dealWithSessionConfig(connection, writerSliceConfig,
this.dataBaseType, BASIC_MESSAGE);
startWriteWithConnection(recordReceiver, taskPluginCollector, connection);
*/
}
```
如图,整个方法内部调用注释了,打包后仍然可以正常运行,方法中的输出没有出现。

测试是否打包问题:第2个参数传null
```
//MysqlWriter:78
public void startWrite(RecordReceiver recordReceiver) {
this.commonRdbmsWriterTask.startWrite(recordReceiver, null,
super.getTaskPluginCollector());
}
```

```
//CommonRdbmsWriter:310
public void startWrite(RecordReceiver recordReceiver,
Configuration writerSliceConfig,
TaskPluginCollector taskPluginCollector) {
System.out.println("方法进入");
Connection connection = DBUtil.getConnection(this.dataBaseType,
this.jdbcUrl, username, password);
DBUtil.dealWithSessionConfig(connection, writerSliceConfig,
this.dataBaseType, BASIC_MESSAGE);
startWriteWithConnection(recordReceiver, taskPluginCollector, connection);
}
```
传入null参数,抛出空指针异常,排除打包缓存等问题。并且输出依然没有出现在控制台。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the MysqlWriter and CommonRdbmsWriter startWrite methods around the lines cited in the issue. Reproduce the txtfilereader-to-mysqlwriter case with the core package only, then compare the executed packaged code with the source and the null-argument test. Done means identifying why the observed method body is not reached and documenting or correcting that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
data-engineering, 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.