Skip to content

Commit fe01523

Browse files
author
Chengbing Liu
committed
[FLINK-39197][jdbc&mysql] Fix NPE when finding chunk end
1 parent c155638 commit fe01523

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

flink-cdc-connect/flink-cdc-source-connectors/flink-cdc-base/src/main/java/org/apache/flink/cdc/connectors/base/source/assigner/splitter/JdbcSourceChunkSplitter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,9 @@ private Object nextChunkEnd(
518518
// chunk end might be null when max values are removed
519519
Object chunkEnd =
520520
queryNextChunkMax(jdbc, tableId, splitColumn, chunkSize, previousChunkEnd);
521+
if (chunkEnd == null) {
522+
return null;
523+
}
521524
if (Objects.equals(previousChunkEnd, chunkEnd)) {
522525
// we don't allow equal chunk start and end,
523526
// should query the next one larger than chunkEnd

flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/assigners/MySqlChunkSplitter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ private Object nextChunkEnd(
334334
Object chunkEnd =
335335
StatementUtils.queryNextChunkMax(
336336
jdbc, tableId, splitColumnName, chunkSize, previousChunkEnd);
337+
if (chunkEnd == null) {
338+
return null;
339+
}
337340
if (Objects.equals(previousChunkEnd, chunkEnd)) {
338341
// we don't allow equal chunk start and end,
339342
// should query the next one larger than chunkEnd

0 commit comments

Comments
 (0)