Beebol's 快乐分享

Beebol 一些生活和工作上的分享

【TiDB】inconsistent index order_93025c2f handle count 31 isn't eq


TiDB在查询SQL时有现如下异常:

select o.account_id,sum(o.amount),sum(if(c.open_type = 1,o.amount,0)),sum(if(c.open_type = 1,1,0)),sum(if(c.open_type != 1,o.amount,0)),sum(if(c.open_type != 1,1,0)) from `order` o left join invoice i on i.order_id = o.id left join product p on i.product_id = p.id  
                     left join channel c on c.id = o.channel_id  where o.account_id = 134139663 and i.end_time >=  '2019-06-07'  and  i.delivered_at >= '2019-05-05 13:01:48' and  i.delivered_at < '2019-06-07'  and p.cate =1 and i.status =1 and c.open_type in (1,2,3) 
user_auto_charge_rate_all  (1105, "inconsistent index order_93025c2f handle count 31 isn't equal to value count 30")

Traceback (most recent call last):
  File "/data/www/audit_3a/app/renew/union/user_auto_charge_rate_all.py", line 342, in <module>
    system_main(sys.argv)
  File "/data/www/audit_3a/app/renew/union/user_auto_charge_rate_all.py", line 331, in system_main
    cts.user_charge_rate(date_now,day_type)
  File "/data/www/audit_3a/app/renew/union/user_auto_charge_rate_all.py", line 152, in user_charge_rate
    cursor.execute(raw_sql_limit)
  File "/opt/python/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/opt/python/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1105, "inconsistent index order_93025c2f handle count 31 isn't equal to value count 30")

目前TiDB版本已经在上一个问题:查询结果集少数据 已经升级到最新版本3.0-rc2 TiDB写是从上游MySQL集群通过DM同步,其它操作TiDB集群的都为读操作。

提交issue地址:https://github.com/pingcap/tidb/issues/10674后,PingCap团队很力,快速联系并收集相关信息,期间由于TiDB的日志不够全面,单独升级了TiDB-server。

最后确认为一个bug:gc_worker: fix bug of saving gc safe point to pd before do distributed gc #10927,触发原因是sql执行时间超了GC的时间(默认10分钟),导致读到索引数据后再去读数据行时,被GC掉了。临时解决,将gc周期时间改大,问题不再发生。

# GC的周期运行时间要大于最大事务的执行时间
update mysql.tidb set VARIABLE_VALUE = '3h' where VARIABLE_NAME = 'tikv_gc_run_interval';

如下是PingCAP开发的分析结论: PingCAP开发的分析结论



文章最后更新时间: 2019年06月26日 15:27:02


统计

今日PV:79 今日UV:78

文章总数:159 评论总数:7840

原创156 转载0 翻译3

分类文章统计

Django(5)

Flask(1)

Python常见错误(3)

Python基础(10)

shell(11)

linux排障(4)

虚拟化(1)

Consul(3)

Linux基础(6)

Redis(2)

oracle(10)

MySQL(64)

ProxySQL(7)

SequoiaDB(2)

TiDB(4)

常用软件(2)

硬件排障(2)

HTML(1)

JavaScript(1)

我们的作品(18)

windows(1)

总结(1)

按年文章统计

2013(43)

2014(19)

2015(25)

2016(6)

2017(30)

2018(7)

2019(17)

2020(4)

2021(4)

2023(1)

2024(3)

老版入口

IT OPer's 快乐分享

亲,扫我吧!
ITOpers
友情链接

飞哥的:imbusy.me/
冰川的:www.mindg.cn
海洋的:hiaero.net
宏斌的:techindeep.com
若水的:nosa.me
段郎的:sixther.me
肥客联邦:fk68.net