生产问题,请加急帮忙处理下,谢谢了,information_schema.views 数据重复导致 入表失败

为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:

【TiDB 版本】
4.0.11

【问题描述】
在使用 create or replace view创建视图后出现重复视图,导致后续插入表操作报错。
操作:
使用 create or replace view该语句创建视图,在sqlyog视图中出现3个,删除一个后,还有两个删除不掉,使用show tables 看不到,但是sqlyog 视图区能看到


写入其他表报错:

查看information_schema.views该表有重复数据:

我看到官方是在4.0.0-beta.1版本进行了修复,但是我这里已经是4.0.11了,仍然有该问题:


若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。

1 个赞

请问是否方便提供下创建视图和表的语句,我们这边先尝试复现下,谢谢

1 个赞

创建视图语句:

CREATE OR REPLACE VIEW bdp_report_2593 AS
SELECT a.id, a.account_id, a.doc_id, a.pub_code, a.pub_type, a.pub_time, s1.name AS subject1, s2.name AS subject2,
s3.name AS subject3, s4.name AS subject4, s5.name AS subject5, s6.name AS subject6, a.subject_keyword,
a1.name AS aspect1, a2.name AS aspect2, a3.name AS aspect3, a4.name AS aspect4, a5.name AS aspect5, a6.name AS aspect6,
a.aspect_keyword, a.subject_sentiment_type_id as sentiment, a.subject_sentiment_keyword as sentiment_keyword, a.sentiment_type_id as sentiment_c,
a.unit_content, a.bi_status_id as bi_status, a.bi_attr_id as bi_attr, a.process_start_time, a.process_end_time,
a.reply_cnt, a.view_cnt, a.like_cnt, a.forward_cnt, a.dislike_cnt, a.collect_cnt, a.play_cnt, a.haha_cnt, a.love_cnt, a.wow_cnt,
a.angry_cnt, a.sad_cnt, a.care_cnt, a.coin_cnt, a.danmaku_cnt, a.pv, a.keyword, a.keyword_frequency, a.media_id, a.media_type_id, a.dedup_label, a.doc_type, a.author_tag, a.flag_qc, a.flag_reject
FROM fact_2593 a
LEFT JOIN dim_subject1_e23f99097f2d477392d3fde279cec0f3 s1 ON a.subject1_id = s1.subject1_id
LEFT JOIN dim_subject2_e23f99097f2d477392d3fde279cec0f3 s2 ON a.subject2_id = s2.subject2_id
LEFT JOIN dim_subject3_e23f99097f2d477392d3fde279cec0f3 s3 ON a.subject3_id = s3.subject3_id
LEFT JOIN dim_subject4_e23f99097f2d477392d3fde279cec0f3 s4 ON a.subject4_id = s4.subject4_id
LEFT JOIN dim_subject5_e23f99097f2d477392d3fde279cec0f3 s5 ON a.subject5_id = s5.subject5_id
LEFT JOIN dim_subject6_e23f99097f2d477392d3fde279cec0f3 s6 ON a.subject6_id = s6.subject6_id
LEFT JOIN (select * from dim_aspect_eb59ed0d2dd94914ba05988155a2541d) a1 ON a.aspect1_id = a1.aspect_id AND a1.level = 1
LEFT JOIN (select * from dim_aspect_eb59ed0d2dd94914ba05988155a2541d) a2 ON a.aspect2_id = a2.aspect_id AND a2.level = 2
LEFT JOIN (select * from dim_aspect_eb59ed0d2dd94914ba05988155a2541d) a3 ON a.aspect3_id = a3.aspect_id AND a3.level = 3
LEFT JOIN (select * from dim_aspect_eb59ed0d2dd94914ba05988155a2541d) a4 ON a.aspect4_id = a4.aspect_id AND a4.level = 4
LEFT JOIN (select * from dim_aspect_eb59ed0d2dd94914ba05988155a2541d) a5 ON a.aspect5_id = a5.aspect_id AND a5.level = 5
LEFT JOIN (select * from dim_aspect_eb59ed0d2dd94914ba05988155a2541d) a6 ON a.aspect6_id = a6.aspect_id AND a6.level = 6

1 个赞

视图和建表语句.txt (5.3 KB)

1 个赞

生产问题,非常紧急,烦请加急处理下,谢谢谢谢

1 个赞

我已经删除了这个视图,但是information_schema.views 仍然有重复数据,请问怎么能临时删除,影响生产了非常着急

1 个赞

收到,我们这边内部加快处理下。

1 个赞

老师,能否有办法先吧information_schema.views表里重复数据删除,目前生产已经不能使用了,很着急,root用户也删不掉,有别的方法先解决这个吗

1 个赞

您好,麻烦提供一下:curl http://{TiDBIP}:{STATUS_PORT}/schema/{db}

其中 STATUS_PORT 默认是 10080,db 是视图所在库名

1 个赞

这是结果文件result.zip (277.9 KB)

1 个赞

老师,我看到我们重复的是2593,但是导出来的这个数据里并没有这个视图

麻烦再取一下这个结果:

select * from information_schema.tables where table_name = 'bdp_report_2593 ';

确认下,您这边受影响的原因,是上面提到的 “写入其他表报错 Multiple entries with same key: bdp_report_2593=table_id: 48368” 这条么

这里具体 “写入其他表” 是指什么操作?

使用tispark save 一个 table

您的图没有截全,还请再发一下这个结果:

select CREATE_TIME, TIDB_TABLE_ID from information_schema.tables where table_name = ‘bdp_report_2593’

此外,也请 share 一下 curl http://{TiDBIP}:{STATUS_PORT}/ddl/history 的结果,谢谢

ddl_history这个文件有点大,近200M

OK,我们直接联系排查吧