Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] sqlservercdc throw a NullPointerException when table name contains point #2439

Closed
1 of 2 tasks
edmond-kk opened this issue Aug 29, 2023 · 3 comments · Fixed by #2443
Closed
1 of 2 tasks

[Bug] sqlservercdc throw a NullPointerException when table name contains point #2439

edmond-kk opened this issue Aug 29, 2023 · 3 comments · Fixed by #2443
Assignees
Labels
bug Something isn't working

Comments

@edmond-kk
Copy link

edmond-kk commented Aug 29, 2023

Search before asking

  • I searched in the issues and found nothing similar.

Flink version

1.13.6

Flink CDC version

2.5-SNAPSHOT

Database and its version

sqlserver 2016

Minimal reproduce step

`SqlServerSourceBuilder.SqlServerIncrementalSource sqlServerSource =
new SqlServerSourceBuilder()
.hostname("10.10.17.35")
.port(1433)
.databaseList("CRDB")
.tableList("dbo.tCR0021_V2.0")
.username("app")
.password("app127")
.deserializer(new JsonDebeziumDeserializationSchema())
.startupOptions(StartupOptions.initial())
.build();
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
// enable checkpoint
// set the source parallelism to 2

    env.fromSource(
            sqlServerSource,
            WatermarkStrategy.noWatermarks(),
            "SqlServerIncrementalSource")
            .setParallelism(2)
            .print()
            .setParallelism(1);

    env.execute("Print SqlServer Snapshot + Change Stream");`

What did you expect to see?

正常执行

What did you see instead?

Executing this code throws a NullPointerException

Caused by: java.lang.RuntimeException: SplitFetcher thread 0 received unexpected exception while polling the records
at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.runOnce(SplitFetcher.java:150)
at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.run(SplitFetcher.java:105)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
Caused by: org.apache.flink.util.FlinkRuntimeException: Read split SnapshotSplit{tableId=CRDB.dbo.tCR0021_V2, splitId='CRDB.dbo.tCR0021_V2.0:1', splitKeyType=[ID INT NOT NULL], splitStart=[9084], splitEnd=[18167], highWatermark=null} error due to java.lang.NullPointerException.
at com.ververica.cdc.connectors.base.source.reader.external.IncrementalSourceScanFetcher.checkReadException(IncrementalSourceScanFetcher.java:182)
at com.ververica.cdc.connectors.base.source.reader.external.IncrementalSourceScanFetcher.pollSplitRecords(IncrementalSourceScanFetcher.java:129)
at com.ververica.cdc.connectors.base.source.reader.IncrementalSourceSplitReader.fetch(IncrementalSourceSplitReader.java:73)
at org.apache.flink.connector.base.source.reader.fetcher.FetchTask.run(FetchTask.java:58)
at org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher.runOnce(SplitFetcher.java:142)
... 7 more
Caused by: io.debezium.DebeziumException: java.lang.NullPointerException
at com.ververica.cdc.connectors.sqlserver.source.reader.fetch.SqlServerScanFetchTask$SqlServerSnapshotSplitReadTask.execute(SqlServerScanFetchTask.java:262)
at com.ververica.cdc.connectors.sqlserver.source.reader.fetch.SqlServerScanFetchTask.execute(SqlServerScanFetchTask.java:94)
at com.ververica.cdc.connectors.base.source.reader.external.IncrementalSourceScanFetcher.lambda$submitTask$0(IncrementalSourceScanFetcher.java:95)
... 6 more
Caused by: java.lang.NullPointerException
at com.ververica.cdc.connectors.sqlserver.source.reader.fetch.SqlServerScanFetchTask$SqlServerSnapshotSplitReadTask.createDataEventsForTable(SqlServerScanFetchTask.java:335)
at com.ververica.cdc.connectors.sqlserver.source.reader.fetch.SqlServerScanFetchTask$SqlServerSnapshotSplitReadTask.createDataEvents(SqlServerScanFetchTask.java:319)
at com.ververica.cdc.connectors.sqlserver.source.reader.fetch.SqlServerScanFetchTask$SqlServerSnapshotSplitReadTask.doExecute(SqlServerScanFetchTask.java:289)
at com.ververica.cdc.connectors.sqlserver.source.reader.fetch.SqlServerScanFetchTask$SqlServerSnapshotSplitReadTask.execute(SqlServerScanFetchTask.java:257)
... 8 more

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@edmond-kk edmond-kk added the bug Something isn't working label Aug 29, 2023
@GOODBOY008
Copy link
Member

Ok, I will take a look.

@GOODBOY008
Copy link
Member

@edmond-kk You can check out my branch and compile on your local.

@edmond-kk
Copy link
Author

I found that this issue occurred again when the task was resumed from the checkpoint. Through logging, I discovered that in the table Schema obtained from checkpoints, the tableId had its portion after the dot truncated, resulting in the task being unable to recover from the checkpoint and throw a NullPointerException.
@GOODBOY008

@edmond-kk edmond-kk reopened this Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants