Coder Social home page Coder Social logo

Caused by: java.io.IOException: java.sql.SQLException: Attempt to execute batch failed, exhausted retry times = 3 about flink-connector-clickhouse HOT 6 CLOSED

zjialin avatar zjialin commented on July 19, 2024
Caused by: java.io.IOException: java.sql.SQLException: Attempt to execute batch failed, exhausted retry times = 3

from flink-connector-clickhouse.

Comments (6)

itinycheng avatar itinycheng commented on July 19, 2024

This is an exception where writing ClickHouse fails, refer to: ClickHouseExecutor
The exception info above miss the original exception info, I can't figure out the cause of the exception.
In order to find out the problem, you'd better do some breakpoint test.

from flink-connector-clickhouse.

zjialin avatar zjialin commented on July 19, 2024

2022-08-09 16:22:19
org.apache.flink.runtime.JobException: Recovery is suppressed by NoRestartBackoffTimeStrategy
at org.apache.flink.runtime.executiongraph.failover.flip1.ExecutionFailureHandler.handleFailure(ExecutionFailureHandler.java:138)
at org.apache.flink.runtime.executiongraph.failover.flip1.ExecutionFailureHandler.getFailureHandlingResult(ExecutionFailureHandler.java:82)
at org.apache.flink.runtime.scheduler.DefaultScheduler.handleTaskFailure(DefaultScheduler.java:252)
at org.apache.flink.runtime.scheduler.DefaultScheduler.maybeHandleTaskFailure(DefaultScheduler.java:242)
at org.apache.flink.runtime.scheduler.DefaultScheduler.updateTaskExecutionStateInternal(DefaultScheduler.java:233)
at org.apache.flink.runtime.scheduler.SchedulerBase.updateTaskExecutionState(SchedulerBase.java:684)
at org.apache.flink.runtime.scheduler.SchedulerNG.updateTaskExecutionState(SchedulerNG.java:79)
at org.apache.flink.runtime.jobmaster.JobMaster.updateTaskExecutionState(JobMaster.java:444)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.lambda$handleRpcInvocation$1(AkkaRpcActor.java:316)
at org.apache.flink.runtime.concurrent.akka.ClassLoadingUtils.runWithContextClassLoader(ClassLoadingUtils.java:83)
at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleRpcInvocation(AkkaRpcActor.java:314)
at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleRpcMessage(AkkaRpcActor.java:217)
at org.apache.flink.runtime.rpc.akka.FencedAkkaRpcActor.handleRpcMessage(FencedAkkaRpcActor.java:78)
at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleMessage(AkkaRpcActor.java:163)
at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:24)
at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:20)
at scala.PartialFunction.applyOrElse(PartialFunction.scala:123)
at scala.PartialFunction.applyOrElse$(PartialFunction.scala:122)
at akka.japi.pf.UnitCaseStatement.applyOrElse(CaseStatements.scala:20)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:171)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:172)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:172)
at akka.actor.Actor.aroundReceive(Actor.scala:537)
at akka.actor.Actor.aroundReceive$(Actor.scala:535)
at akka.actor.AbstractActor.aroundReceive(AbstractActor.scala:220)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:580)
at akka.actor.ActorCell.invoke(ActorCell.scala:548)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
at akka.dispatch.Mailbox.run(Mailbox.scala:231)
at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1067)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1703)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:172)
Caused by: java.lang.RuntimeException: Flush exception found.
at com.ververica.cdc.connectors.clickhouse.internal.AbstractClickHouseOutputFormat.checkFlushException(AbstractClickHouseOutputFormat.java:103)
at com.ververica.cdc.connectors.clickhouse.internal.ClickHouseBatchOutputFormat.writeRecord(ClickHouseBatchOutputFormat.java:78)
at com.ververica.cdc.connectors.clickhouse.internal.ClickHouseBatchOutputFormat.writeRecord(ClickHouseBatchOutputFormat.java:17)
at org.apache.flink.streaming.api.functions.sink.OutputFormatSinkFunction.invoke(OutputFormatSinkFunction.java:87)
at org.apache.flink.streaming.api.functions.sink.SinkFunction.invoke(SinkFunction.java:50)
at org.apache.flink.table.runtime.operators.sink.SinkOperator.processElement(SinkOperator.java:65)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.pushToOperator(CopyingChainingOutput.java:82)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:57)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:29)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:56)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:29)
at org.apache.flink.streaming.api.operators.StreamFilter.processElement(StreamFilter.java:39)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.pushToOperator(CopyingChainingOutput.java:82)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:57)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:29)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:56)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:29)
at StreamExecCalc$10.processElement(Unknown Source)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.pushToOperator(CopyingChainingOutput.java:82)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:57)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:29)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:56)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:29)
at org.apache.flink.streaming.api.operators.StreamFilter.processElement(StreamFilter.java:39)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.pushToOperator(CopyingChainingOutput.java:82)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:57)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:29)
at org.apache.flink.streaming.runtime.tasks.SourceOperatorStreamTask$AsyncDataOutputToOutput.emitRecord(SourceOperatorStreamTask.java:196)
at org.apache.flink.streaming.api.operators.source.SourceOutputWithWatermarks.collect(SourceOutputWithWatermarks.java:110)
at org.apache.flink.streaming.api.operators.source.SourceOutputWithWatermarks.collect(SourceOutputWithWatermarks.java:101)
at com.ververica.cdc.connectors.mysql.source.reader.MySqlRecordEmitter$OutputCollector.collect(MySqlRecordEmitter.java:141)
at com.ververica.cdc.debezium.table.RowDataDebeziumDeserializeSchema.emit(RowDataDebeziumDeserializeSchema.java:155)
at com.ververica.cdc.debezium.table.RowDataDebeziumDeserializeSchema.deserialize(RowDataDebeziumDeserializeSchema.java:137)
at com.ververica.cdc.connectors.mysql.source.reader.MySqlRecordEmitter.emitElement(MySqlRecordEmitter.java:116)
at com.ververica.cdc.connectors.mysql.source.reader.MySqlRecordEmitter.emitRecord(MySqlRecordEmitter.java:98)
at com.ververica.cdc.connectors.mysql.source.reader.MySqlRecordEmitter.emitRecord(MySqlRecordEmitter.java:52)
at org.apache.flink.connector.base.source.reader.SourceReaderBase.pollNext(SourceReaderBase.java:143)
at org.apache.flink.streaming.api.operators.SourceOperator.emitNext(SourceOperator.java:354)
at org.apache.flink.streaming.runtime.io.StreamTaskSourceInput.emitNext(StreamTaskSourceInput.java:68)
at org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processInput(StreamOneInputProcessor.java:65)
at org.apache.flink.streaming.runtime.tasks.StreamTask.processInput(StreamTask.java:496)
at org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.runMailboxLoop(MailboxProcessor.java:203)
at org.apache.flink.streaming.runtime.tasks.StreamTask.runMailboxLoop(StreamTask.java:809)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:761)
at org.apache.flink.runtime.taskmanager.Task.runWithSystemExitMonitoring(Task.java:958)
at org.apache.flink.runtime.taskmanager.Task.restoreAndInvoke(Task.java:937)
at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:766)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:575)
at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.RuntimeException: Flush exception found.
at com.ververica.cdc.connectors.clickhouse.internal.AbstractClickHouseOutputFormat.checkFlushException(AbstractClickHouseOutputFormat.java:103)
at com.ververica.cdc.connectors.clickhouse.internal.AbstractClickHouseOutputFormat.checkBeforeFlush(AbstractClickHouseOutputFormat.java:72)
at com.ververica.cdc.connectors.clickhouse.internal.ClickHouseBatchOutputFormat.flush(ClickHouseBatchOutputFormat.java:94)
at com.ververica.cdc.connectors.clickhouse.internal.AbstractClickHouseOutputFormat.lambda$scheduledFlush$0(AbstractClickHouseOutputFormat.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
... 1 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.lang.RuntimeException: Flush exception found.
... 11 more
Caused by: java.io.IOException: java.sql.SQLException: Attempt to execute batch failed, exhausted retry times = 3
at com.ververica.cdc.connectors.clickhouse.internal.AbstractClickHouseOutputFormat.checkBeforeFlush(AbstractClickHouseOutputFormat.java:76)
... 9 more
Caused by: java.sql.SQLException: Attempt to execute batch failed, exhausted retry times = 3
at com.ververica.cdc.connectors.clickhouse.internal.executor.ClickHouseExecutor.attemptExecuteBatch(ClickHouseExecutor.java:67)
at com.ververica.cdc.connectors.clickhouse.internal.executor.ClickHouseUpsertExecutor.executeBatch(ClickHouseUpsertExecutor.java:125)
at com.ververica.cdc.connectors.clickhouse.internal.AbstractClickHouseOutputFormat.checkBeforeFlush(AbstractClickHouseOutputFormat.java:74)
... 9 more

from flink-connector-clickhouse.

zjialin avatar zjialin commented on July 19, 2024

请大神指教一下问题出在哪点

from flink-connector-clickhouse.

itinycheng avatar itinycheng commented on July 19, 2024

@zjialin
这个是upsert模式下的报错,因为有看到调用ClickHouseUpsertExecutor. executeBatch,具体报错原因从当前错误信息中还是找不出来,你最好本地断点测试下;
如果不必须用upsert模式就添加配置catalog.ignore-primary-key = true,ClickHouse的Mutation操作比较重,不是特别建议用,我生产基本是append模式 + TableEngine来做类似数据更新的操作;

from flink-connector-clickhouse.

zjialin avatar zjialin commented on July 19, 2024

我设置catalog.ignore-primary-key = true 目前同样的错。

CREATE TABLE SOURCE_test1 (
id BIGINT,
user_name VARCHAR(64),
create_date TIMESTAMP(0),
create_date_test TIMESTAMP(0),
PRIMARY KEY(id) NOT ENFORCED
) WITH (
'connector' = 'mysql-cdc',
'hostname' = '10.96.183.42',
'port' = '32282',
'username' = 'root',
'password' = '',
'database-name' = 'test_flink',
'table-name' = 'test1'
);
CREATE TABLE SINK_test1 (
id BIGINT,
user_name STRING,
create_date TIMESTAMP(0),
create_date_test TIMESTAMP(0),
its_ck_sign TINYINT,
PRIMARY KEY(id) NOT ENFORCED
) WITH (
'connector' = 'clickhouse',
'url' = 'clickhouse://10.96.183.45:8123',
'username' = 'default',
'password' = '
',
'database-name' = 'test_flink',
'table-name' = 'test1',
'sink.batch-size' = '500',
'sink.flush-interval' = '1000',
'catalog.ignore-primary-key' = 'true',
'sink.max-retries' = '5'

);
insert into SINK_test1(id,user_name,create_date,create_date_test) select * from SOURCE_test1;

from flink-connector-clickhouse.

itinycheng avatar itinycheng commented on July 19, 2024

我设置catalog.ignore-primary-key = true 目前同样的错。

CREATE TABLE SOURCE_test1 ( id BIGINT, user_name VARCHAR(64), create_date TIMESTAMP(0), create_date_test TIMESTAMP(0), PRIMARY KEY(id) NOT ENFORCED ) WITH ( 'connector' = 'mysql-cdc', 'hostname' = '10.96.183.42', 'port' = '32282', 'username' = 'root', 'password' = '', 'database-name' = 'test_flink', 'table-name' = 'test1' ); CREATE TABLE SINK_test1 ( id BIGINT, user_name STRING, create_date TIMESTAMP(0), create_date_test TIMESTAMP(0), its_ck_sign TINYINT, PRIMARY KEY(id) NOT ENFORCED ) WITH ( 'connector' = 'clickhouse', 'url' = 'clickhouse://10.96.183.45:8123', 'username' = 'default', 'password' = '', 'database-name' = 'test_flink', 'table-name' = 'test1', 'sink.batch-size' = '500', 'sink.flush-interval' = '1000', 'catalog.ignore-primary-key' = 'true', 'sink.max-retries' = '5'

); insert into SINK_test1(id,user_name,create_date,create_date_test) select * from SOURCE_test1;

catalog.ignore-primary-key = true 只在create catalog时候生效,生成的表是忽略主键的;你看字面意思就应该明白哈,或是仔细看下readme.md;

你建表语句去掉primary key 就可用append模式了,这个我后续会添加单独的的mode=append/upsert参数来标识;

from flink-connector-clickhouse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.