Skip to content

Commit 4e484f2

Browse files
committed
[hotfix-32675][jdbc]数据库没有数据,间隔轮训查询会进入死循环,因为事务没有提交,即使后续数据库插入数据 也无法读取事务 所以每次查询之前要手动提交
1 parent e793e44 commit 4e484f2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

flinkx-rdb/flinkx-rdb-reader/src/main/java/com.dtstack.flinkx.rdb.inputformat/JdbcInputFormat.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,8 @@ private void queryStartLocation() throws SQLException{
843843
//执行到此处代表轮询任务startLocation为空,且数据库中无数据,此时需要查询增量字段的最小值
844844
ps.setFetchDirection(ResultSet.FETCH_FORWARD);
845845
resultSet.close();
846+
//如果事务不提交 就会导致数据库即使插入数据 也无法读到数据
847+
dbConn.commit();
846848
resultSet = ps.executeQuery();
847849
hasNext = resultSet.next();
848850
//每隔五分钟打印一次

0 commit comments

Comments
 (0)