开发者社区> 问答> 正文

Update event被识别为INSERT EVENT当表格存储为ndbcluster同时设置有p

创建这样的表格,这里要同时有PK和ndbcluster engine的指定。只指定其一,不会触发这种情况。

create table test3col(id int(3), name varchar(10), last varchar(10), primary key(id))engine=ndbcluster;

mysql> insert into test3col values(1,'a','b'); mysql> update test3col set last='c' where id=1;

SimpleCilent打印出来的log,可以发现update命令被认为是insert类型,同时只显示了主键和更新列 ================> binlog[log-bin.000001:3946366] , name[cudb_user_data,test3col] , eventType : CREATE empty count : 1 empty count : 2 empty count : 3 empty count : 4 empty count : 5 empty count : 6 ================> binlog[log-bin.000001:3946753] , name[mysql,ndb_apply_status] , eventType : INSERT server_id : 501 update=true epoch : 15301516776701952 update=true log_name : update=true start_pos : 0 update=true end_pos : 0 update=true ================> binlog[log-bin.000001:3946814] , name[cudb_user_data,test3col] , eventType : INSERT id : 1 update=true name : a update=true last : b update=true ================> binlog[log-bin.000001:3947108] , name[mysql,ndb_apply_status] , eventType : INSERT server_id : 501 update=true epoch : 15301538251538433 update=true log_name : update=true start_pos : 0 update=true end_pos : 0 update=true ================> binlog[log-bin.000001:3947169] , name[cudb_user_data,test3col] , eventType : INSERT id : 1 update=true last : c update=true

原提问者GitHub用户suxingfate

展开
收起
绿子直子 2023-05-09 16:06:45 100 0
2 条回答
写回答
取消 提交回答
  • 1、只显示主键和变更列,估计和你mysql版本有关,mysql5.6之后支持minial image模式,只会记录变更列和主键

    2、至于update被认为insert,个人初步判断和ndbcluster有关,以前没测试过

    建议你直接看一下show binlog events看一下对应update sql的binlog对象

    原回答者GitHub用户agapple

    2023-05-10 11:05:48
    赞同 展开评论 打赏
  • 随心分享,欢迎友善交流讨论:)

    根据您提供的信息,可以看出是由于 MySQL Server 在使用 NDB Cluster 引擎存储表格时,可能会出现 Update Event 被识别为 Insert Event 的情况。建议您检查 MySQL Server 的版本是否符合 NDB Cluster 引擎的要求,并确认 NDB Cluster 引擎是否已经正确安装和配置。此外,您还可以尝试升级 MySQL Server 版本,或者尝试使用其他的存储引擎来存储数据表格,以解决这个问题。如果您仍然无法解决问题,建议您将更详细的错误信息和日志信息提供出来,以便更好地定位和解决问题。

    2023-05-10 09:36:55
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
TableStore在社交类场景下的应用 立即下载
表格存储实时数据流Steam的技术揭秘和应用场景 立即下载
表格存储(TableStore) 立即下载