签到成功

知道了

CNDBA社区CNDBA社区

TDSQL 集群 sysbench shard实例 lua脚本 Proxy ERROR:get_auto_inc_id error 错误解决方法

2021-07-29 12:28 1921 0 原创 TDSQL
作者: dave

在之前的博客我们了解了TDSQL 集群中常用的性能测试的几个工具,如下:

http://www.cndba.cn/cndba/dave/article/4627

TDSQL 集群 POC TPCC 性能测试 常用工具 说明
https://www.cndba.cn/dave/article/4626

在使用sysbench 压groupshard实例遇到错误,记录如下。 http://www.cndba.cn/cndba/dave/article/4627

1 错误描述

使用sysbench往TDSQL groupshard实例中压数据时报如下错误:

http://www.cndba.cn/cndba/dave/article/4627
http://www.cndba.cn/cndba/dave/article/4627http://www.cndba.cn/cndba/dave/article/4627http://www.cndba.cn/cndba/dave/article/4627

[dave@www.cndba.cn  src]# sysbench lua/oltp_common_shard.lua  --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --tables=10 --table-size=1000 --db-driver=mysql --report-interval=10 --threads=10 --time=120 prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

Initializing worker threads...

Creating table 'sbtest5'...
Creating table 'sbtest10'...
Creating table 'sbtest4'...
Creating table 'sbtest7'...
Creating table 'sbtest1'...
Creating table 'sbtest6'...
Creating table 'sbtest8'...
Creating table 'sbtest9'...
Creating table 'sbtest3'...
Creating table 'sbtest2'...
Inserting 1000 records into 'sbtest5'
Inserting 1000 records into 'sbtest2'
Inserting 1000 records into 'sbtest3'
FATAL: mysql_drv_query() returned error 609 (Proxy ERROR:get_auto_inc_id error) for query 'INSERT INTO sbtest5(k, c, pad) VALUES(106, '56566333582-59976060859-86108079942-45518225134-51197308472-09648585484-88074416798-00942389294-30845637870-78506709924', '85766613585-13315785698-34679708195-99179161427-70230474152'),(906,
……

这里是按照官方的方法,在oltp_common_shard.lua 脚本

print(string.format(“Creating table ‘sbtest%d’…”, table_num))
后面加上一句:
extra_table_options = extra_table_options .. “ shardkey=id”后执行的。

因为是github上下载的最新的sysbench。 所以应该是版本跌倒导致的出入。

2 解决方法

在最新的sysbench中,支持groupshard的修改需要改2个地方法:http://www.cndba.cn/cndba/dave/article/4627

  1. 注释掉lua脚本 58-61行
  2. 建表语句199行处添加 shardkey=id
vi src/lua/oltp_common.lua

----省略
      range_selects =
      {"Enable/disable all range SELECT queries", true},
--   auto_inc =
--   {"Use AUTO_INCREMENT column as Primary Key (for MySQL), " ..
--       "or its alternatives in other DBMS. When disabled, use " ..
--       "client-generated IDs", true},
   create_table_options =
      {"Extra CREATE TABLE options", ""},

----省略

   query = string.format([[
CREATE TABLE sbtest%d(
  id %s,
  k INTEGER DEFAULT '0' NOT NULL,
  c CHAR(120) DEFAULT '' NOT NULL,
  pad CHAR(60) DEFAULT '' NOT NULL,
  %s (id)
) %s %s shardkey=id]],
      table_num, id_def, id_index_def, engine_def,
      sysbench.opt.create_table_options)
----省略

然后就可以成功执行了。 http://www.cndba.cn/cndba/dave/article/4627http://www.cndba.cn/cndba/dave/article/4627http://www.cndba.cn/cndba/dave/article/4627

[dave@www.cndba.cn  src]# sysbench lua/oltp_common_shard.lua  --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --tables=10 --table-size=1000 --db-driver=mysql --report-interval=10 --threads=10 --time=120 prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

Initializing worker threads...

Creating table 'sbtest6'...
Creating table 'sbtest1'...
Creating table 'sbtest9'...
Creating table 'sbtest4'...
Creating table 'sbtest2'...
Creating table 'sbtest7'...
Creating table 'sbtest10'...
Creating table 'sbtest8'...
Creating table 'sbtest3'...
Creating table 'sbtest5'...
Inserting 1000 records into 'sbtest3'
Inserting 1000 records into 'sbtest8'
Inserting 1000 records into 'sbtest6'
Inserting 1000 records into 'sbtest5'
Inserting 1000 records into 'sbtest2'
Inserting 1000 records into 'sbtest1'
Inserting 1000 records into 'sbtest4'
Inserting 1000 records into 'sbtest10'
Inserting 1000 records into 'sbtest7'
Inserting 1000 records into 'sbtest9'
Creating a secondary index on 'sbtest4'...
Creating a secondary index on 'sbtest3'...
Creating a secondary index on 'sbtest5'...
Creating a secondary index on 'sbtest2'...
Creating a secondary index on 'sbtest10'...
Creating a secondary index on 'sbtest8'...
Creating a secondary index on 'sbtest9'...
Creating a secondary index on 'sbtest1'...
Creating a secondary index on 'sbtest7'...
Creating a secondary index on 'sbtest6'...
You have new mail in /var/spool/mail/root
[dave@www.cndba.cn  src]#

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
dave

dave

关注

人的一生应该是这样度过的:当他回首往事的时候,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞耻;这样,在临死的时候,他就能够说:“我的整个生命和全部精力,都已经献给世界上最壮丽的事业....."

  • 2283
    原创
  • 3
    翻译
  • 579
    转载
  • 196
    评论
  • 访问:8171421次
  • 积分:4428
  • 等级:核心会员
  • 排名:第1名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ