alibaba / otter

阿里巴巴分布式数据库同步系统(解决中美异地机房)
Apache License 2.0
8.07k stars 2.49k forks source link

mysql longblob同步字段同步异常。 #912

Open ningguixin opened 4 years ago

ningguixin commented 4 years ago

otter版本4.2.18 源库表确实有app_icon 字段为longblob 而且确实写入了值,同步给B库同样的表结构 怀疑canal采集longblob 字段没有采集到, longblob 存的图片。 Channel挂起,报错如下: pid:5 nid:3 exception:setl:com.alibaba.otter.node.etl.load.exception.LoadException: java.util.concurrent.ExecutionException: com.alibaba.otter.node.etl.load.exception.LoadException: com.alibaba.otter.node.etl.load.exception.LoadException: com.alibaba.otter.node.etl.load.exception.LoadException: java.lang.ClassCastException: java.lang.String cannot be cast to [B at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.doPreparedStatement(DbLoadAction.java:786) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.access$800(DbLoadAction.java:517) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker$2$1.setValues(DbLoadAction.java:628) at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:816) at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:1) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:812) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:868) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker$2.doInTransaction(DbLoadAction.java:625) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.doCall(DbLoadAction.java:617) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.call(DbLoadAction.java:545) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction.doTwoPhase(DbLoadAction.java:462) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction.doLoad(DbLoadAction.java:275) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction.load(DbLoadAction.java:161) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$$FastClassByCGLIB$$d932a4cb.invoke() at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:618) at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$$EnhancerByCGLIB$$80fd23c2.load() at com.alibaba.otter.node.etl.load.loader.db.DataBatchLoader$2.call(DataBatchLoader.java:198) at com.alibaba.otter.node.etl.load.loader.db.DataBatchLoader$2.call(DataBatchLoader.java:189) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

PairId: 88 , TableId: 156 , EventType : I , Time : 1585136799000

---Columns EventColumn[index=1,columnType=-5,columnName=RES_TYPE_ID,columnValue=11,isNull=false,isKey=false,isUpdate=true] EventColumn[index=2,columnType=-5,columnName=RES_MANU_ID,columnValue=10011,isNull=false,isKey=false,isUpdate=true] EventColumn[index=3,columnType=-5,columnName=RES_SERIES_ID,columnValue=20110,isNull=false,isKey=false,isUpdate=true] EventColumn[index=4,columnType=-5,columnName=RES_VERSION_ID,columnValue=20110,isNull=false,isKey=false,isUpdate=true] EventColumn[index=5,columnType=12,columnName=APP_NAME,columnValue=xxxxxxx,isNull=false,isKey=false,isUpdate=true] EventColumn[index=6,columnType=12,columnName=APP_CODE,columnValue=JTNGJTTS,isNull=false,isKey=false,isUpdate=true] EventColumn[index=7,columnType=12,columnName=DESCRIPTION,columnValue=,isNull=false,isKey=false,isUpdate=true] EventColumn[index=8,columnType=1,columnName=SYNC_STATUS,columnValue=1,isNull=false,isKey=false,isUpdate=true] EventColumn[index=9,columnType=12,columnName=SYNC_DESC,columnValue=success,isNull=false,isKey=false,isUpdate=true] EventColumn[index=10,columnType=1,columnName=LOCK_STATUS,columnValue=5,isNull=false,isKey=false,isUpdate=true] EventColumn[index=11,columnType=12,columnName=LOCK_DESC,columnValue=xxxxxx,isNull=false,isKey=false,isUpdate=true] EventColumn[index=12,columnType=-5,columnName=LOCK_MAIN_ACCT_ID,columnValue=10008812,isNull=false,isKey=false,isUpdate=true] EventColumn[index=13,columnType=93,columnName=LOCK_TIME,columnValue=2018-10-09 10:50:50,isNull=false,isKey=false,isUpdate=true] EventColumn[index=14,columnType=1,columnName=DIFF_FLAG,columnValue=1,isNull=false,isKey=false,isUpdate=true] EventColumn[index=15,columnType=93,columnName=CREATE_TIME,columnValue=2019-08-27 12:07:36,isNull=false,isKey=false,isUpdate=true] EventColumn[index=16,columnType=93,columnName=LAST_UPDATE_TIME,columnValue=2019-08-28 17:11:40,isNull=false,isKey=false,isUpdate=true] EventColumn[index=17,columnType=1,columnName=DIALING_TEST_STATUS,columnValue=1,isNull=false,isKey=false,isUpdate=true] EventColumn[index=18,columnType=1,columnName=IMPORTANT_LEVEL,columnValue=,isNull=false,isKey=false,isUpdate=true] ### EventColumn[index=19,columnType=2004,columnName=APP_ICON,columnValue=,isNull=false,isKey=false,isUpdate=true]**** EventColumn[index=20,columnType=12,columnName=APP_ICON_NAME,columnValue=,isNull=false,isKey=false,isUpdate=true] EventColumn[index=21,columnType=4,columnName=AUTHEN_LEVEL,columnValue=,isNull=true,isKey=false,isUpdate=true] EventColumn[index=22,columnType=1,columnName=IS_BS,columnValue=1,isNull=false,isKey=false,isUpdate=true] EventColumn[index=23,columnType=12,columnName=SSO_PROTOAL,columnValue=,isNull=false,isKey=false,isUpdate=true] EventColumn[index=24,columnType=12,columnName=LOGIN_BROWSER_TYPE,columnValue=01,isNull=false,isKey=false,isUpdate=true] EventColumn[index=25,columnType=12,columnName=NET_WORK_AREA,columnValue=,isNull=true,isKey=false,isUpdate=true]

ningguixin commented 4 years ago

@agapple

xuanhusuo commented 4 years ago

786行处理下: case Types.BLOB: lobCreator.setBlobAsBytes(ps, paramIndex, param.toString().getBytes());

ningguixin commented 4 years ago

786行处理下: case Types.BLOB: lobCreator.setBlobAsBytes(ps, paramIndex, param.toString().getBytes());

感谢。

linqh1 commented 4 years ago

我是binary类型,但是不知道为什么走到case Types.BLOB这里面, 感觉上游的解析有点问题

linqh1 commented 4 years ago

binary类型的字段如果设置成0值会导致同步失败