alibaba / alibaba/DataX

Datax rdbms task was blocking when query was killed

Open
#1,873 0 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

Datax rdbms task was blocking when query was killed

CommonRdbmsReader.
void startRead(){
........

while (rs.next()) {

rsNextUsedTime += (System.nanoTime() - lastTime);

this.transportOneRecord(recordSender, rs,
metaData, columnNumber, mandatoryEncoding, taskPluginCollector);

lastTime = System.nanoTime();

}
allResultPerfRecord.end(rsNextUsedTime);

//目前大盘是依赖这个打印,而之前这个Finish read record是包含了sql查询和result next的全部时间
LOG.info("Finished read record...");
//LOG.info("Finished read record by Sql: [{}\n] [{}\n] {}.",
//querySql, (bindVarsArr.isEmpty()?"":bindVarsArr.getJSONArray(idx)),basicMsg);

if(bindVarsArr.isEmpty())
{
LOG.info("Finished read record 1 ");
break;
}
else
{
//关闭游标
DBUtil.closeDBResources(rs, null, null);
idx++;
}
}
while(true);
}catch (Exception e) {
LOG.info("Finished read record with exception :{}" ,e);
throw RdbmsException.asQueryException(this.dataBaseType, e, querySql, table, username);
} finally {
LOG.info("Finished read record close connection 1...");
// 正在进行抽数时候,mysql 的query 被异常中断了,这里的 close connection 会导致阻塞
DBUtil.closeDBResources(null, conn);
LOG.info("Finished read record close connection 2...");
}
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at CommonRdbmsReader.startRead and trace the finally block through DBUtil.closeDBResources(null, conn). Investigate the behavior when a MySQL query is interrupted or killed, focusing on why connection cleanup blocks. Done means the RDBMS task does not remain blocked during cleanup after an interrupted query.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.