Fix #119 (oltp_insert.lua + --auto-inc=0 fails)

Fix oltp_insert.lua when run with --auto-inc disabled. Add regression tests.
This commit is contained in:
Alexey Kopytov
2017-03-12 10:45:03 +03:00
parent 6c7c13913d
commit 89ab44d50e
10 changed files with 58 additions and 7 deletions

View File

@ -40,7 +40,8 @@ function event()
if (sysbench.opt.auto_inc) then
i = 0
else
i = sysbench.rand.unique()
-- Convert a uint32_t value to SQL INT
i = sysbench.rand.unique() - 2147483648
end
con:query(string.format("INSERT INTO %s (id, k, c, pad) VALUES " ..

View File

@ -56,6 +56,4 @@ uninstall-local:
rm -f -r $(DESTDIR)$(testdir)
test:
PATH="$(top_srcdir)/third_party/cram/scripts:$$PATH" \
PYTHONPATH="$(top_srcdir)/third_party/cram:$$PYTHONPATH" \
./test_run.sh
./test_run.sh

View File

@ -47,7 +47,7 @@ db_show_table sbtest6 || true # Error on non-existing table
db_show_table sbtest7 || true # Error on non-existing table
db_show_table sbtest8 || true # Error on non-existing table
# Test --create-secondary=off
echo "# Test --create-secondary=off"
ARGS="${OLTP_SCRIPT_PATH} ${DB_DRIVER_ARGS} ${SB_EXTRA_ARGS} --tables=1"
sysbench --create-secondary=off $ARGS prepare
@ -55,3 +55,11 @@ sysbench --create-secondary=off $ARGS prepare
db_show_table sbtest1
sysbench $ARGS cleanup
echo "# Test --auto-inc=off"
ARGS="$ARGS --auto-inc=off --verbosity=1"
sysbench $ARGS prepare
sysbench $ARGS run
sysbench $ARGS cleanup

View File

@ -177,6 +177,7 @@ oltp_point_select.lua + MySQL tests
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest6' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest7' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest8' doesn't exist
# Test --create-secondary=off
sysbench * (glob)
Creating table 'sbtest1'...
@ -193,3 +194,8 @@ oltp_point_select.lua + MySQL tests
sysbench * (glob)
Dropping table 'sbtest1'...
# Test --auto-inc=off
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Dropping table 'sbtest1'...

View File

@ -178,6 +178,7 @@ oltp_point_select.lua + PostgreSQL tests
Did not find any relation named "sbtest6".
Did not find any relation named "sbtest7".
Did not find any relation named "sbtest8".
# Test --create-secondary=off
sysbench * (glob)
Creating table 'sbtest1'...
@ -195,3 +196,8 @@ oltp_point_select.lua + PostgreSQL tests
sysbench * (glob)
Dropping table 'sbtest1'...
# Test --auto-inc=off
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Dropping table 'sbtest1'...

View File

@ -177,6 +177,7 @@ oltp_point_select.lua + MySQL tests
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest6' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest7' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest8' doesn't exist
# Test --create-secondary=off
sysbench * (glob)
Creating table 'sbtest1'...
@ -193,3 +194,8 @@ oltp_point_select.lua + MySQL tests
sysbench * (glob)
Dropping table 'sbtest1'...
# Test --auto-inc=off
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Dropping table 'sbtest1'...

View File

@ -178,6 +178,7 @@ oltp_point_select.lua + PostgreSQL tests
Did not find any relation named "sbtest6".
Did not find any relation named "sbtest7".
Did not find any relation named "sbtest8".
# Test --create-secondary=off
sysbench * (glob)
Creating table 'sbtest1'...
@ -195,3 +196,8 @@ oltp_point_select.lua + PostgreSQL tests
sysbench * (glob)
Dropping table 'sbtest1'...
# Test --auto-inc=off
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Dropping table 'sbtest1'...

View File

@ -181,6 +181,7 @@ oltp_read_write.lua + MySQL tests
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest6' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest7' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest8' doesn't exist
# Test --create-secondary=off
sysbench * (glob)
Creating table 'sbtest1'...
@ -196,6 +197,11 @@ oltp_read_write.lua + MySQL tests
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
sysbench * (glob)
Dropping table 'sbtest1'...
# Test --auto-inc=off
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Dropping table 'sbtest1'...
$ DB_DRIVER_ARGS="--db-driver=mysql --mysql-storage-engine=innodb $SBTEST_MYSQL_ARGS"
@ -372,6 +378,7 @@ oltp_read_write.lua + MySQL tests
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest6' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest7' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest8' doesn't exist
# Test --create-secondary=off
sysbench * (glob)
Creating table 'sbtest1'...
@ -388,3 +395,8 @@ oltp_read_write.lua + MySQL tests
sysbench * (glob)
Dropping table 'sbtest1'...
# Test --auto-inc=off
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Dropping table 'sbtest1'...

View File

@ -181,6 +181,7 @@ oltp_read_write.lua + PostgreSQL tests
Did not find any relation named "sbtest6".
Did not find any relation named "sbtest7".
Did not find any relation named "sbtest8".
# Test --create-secondary=off
sysbench * (glob)
Creating table 'sbtest1'...
@ -198,3 +199,8 @@ oltp_read_write.lua + PostgreSQL tests
sysbench * (glob)
Dropping table 'sbtest1'...
# Test --auto-inc=off
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
Dropping table 'sbtest1'...

View File

@ -42,8 +42,6 @@ ${dirlist[@]}"
exit 1
fi
PATH="${sysbench_dir}:$PATH"
if [ -z ${srcdir+x} ]
then
SBTEST_INCDIR="$PWD/include"
@ -74,6 +72,10 @@ export SBTEST_SUITEDIR="$testroot/t"
export SBTEST_CONFIG
export SBTEST_INCDIR
# Add directories containing sysbench and cram to PATH
export PATH="${sysbench_dir}:${SBTEST_ROOTDIR}/../third_party/cram/scripts:$PATH"
export PYTHONPATH="${SBTEST_ROOTDIR}/../third_party/cram:$PYTHONPATH"
export LUA_PATH="$SBTEST_SCRIPTDIR/?.lua"
. $SBTEST_CONFIG