Bug #16171 mysqlslap not using the correct schema during testing
Submitted: 4 Jan 2006 2:58 Modified: 11 Apr 2006 21:23
Reporter: Omer Barnir (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1 OS:Linux (SuSE 9.3)
Assigned to: Magnus Blåudd CPU Architecture:Any

[4 Jan 2006 2:58] Omer Barnir
Description:
mysqlslap is not using the tables it creates in the schema specified on the command line. Instead it is using the default 'mysqlslap' schema (and complains if it doesn't exist).

The schema specified in the command line is created but not used as shown below:

----Running mysqlslap:
omer@linux:~/source/src51_1230/client> ./mysqlslap --socket=/home/omer/source/src51_1230/mysql-test/var/tmp/master.sock --user=root --create="create table t1 (f1 int)" --data="insert into t1 values (42)"  --repeat-data=1  --concurrency-load=1 --engine="myisam" --create-schema="omer" --preserve-schema-exit

Running for engine myisam
/home/omer/source/src51_1230/client/.libs/lt-mysqlslap: Unknown database 'mysqlslap'
Seconds to load data: 0.00247
Number of clients loading data: 1
Number of inserts per client: 1

>>> Complaining about the 'mysqlslap' not being there although needs to use 'omer' 

----Creating the database using the mysql client:
mysql>
mysql> create database mysqlslap;
Query OK, 1 row affected (0.00 sec)

---Trying again:

omer@linux:~/source/src51_1230/client> ./mysqlslap --socket=/home/omer/source/src51_1230/mysql-test/var/tmp/master.sock --user=root --create="create table t1 (f1 int)" --data="insert into t1 values (42)"  --repeat-data=1  --concurrency-load=1 --engine="myisam" --create-schema="omer" --preserve-schema-exit
Running for engine myisam
/home/omer/source/src51_1230/client/.libs/lt-mysqlslap: Cannot run query insert into t1 values (42) ERROR : Table 'mysqlslap.t1' doesn't exist
Seconds to load data: 0.01573
Number of clients loading data: 1
Number of inserts per client: 1

>>> Now complains about the table

--- Adding the table from mysql
mysql> use mysqlslap;
Database changed
mysql> create table t1 (f1 int);
Query OK, 0 rows affected (0.02 sec)

--- Now seems to run:

omer@linux:~/source/src51_1230/client> ./mysqlslap --socket=/home/omer/source/src51_1230/mysql-test/var/tmp/master.sock --user=root --create="create table t1 (f1 int)" --data="insert into t1 values (42)"  --repeat-data=1  --concurrency-load=1 --engine="myisam" --create-schema="omer" --preserve-schema-exit
Running for engine myisam
Seconds to load data: 0.00499
Number of clients loading data: 1
Number of inserts per client: 1

omer@linux:~/source/src51_1230/client>

--- Checking from mysql:

mysql> select count(*) from mysqlslap.t1;
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from omer.t1;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

mysql>

>>> So the program creates the schema and the table specified on the command line but does not use it!

How to repeat:
Follow the above steps

Suggested fix:
Have the program use the schema specified on the command line
[11 Apr 2006 21:23] Magnus Blåudd
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Tested to run with latest mysqlslap and it works fine.