TDSQL 集群 sysbench shard实例 lua脚本 Proxy ERROR:get_auto_inc_id error 错误解决方法
作者:
dave
在之前的博客我们了解了TDSQL 集群中常用的性能测试的几个工具,如下:
TDSQL 集群 POC TPCC 性能测试 常用工具 说明
https://www.cndba.cn/dave/article/4626
在使用sysbench 压groupshard实例遇到错误,记录如下。
1 错误描述
使用sysbench往TDSQL groupshard实例中压数据时报如下错误:
[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个地方法:
- 注释掉lua脚本 58-61行
- 建表语句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)
----省略
然后就可以成功执行了。
[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]#
版权声明:本文为博主原创文章,未经博主允许不得转载。