From 70ae8f692f82a422cc27acf72e628a66ad2640a7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 08:50:38 -0700 Subject: [PATCH 1/3] On internals@mysql a developer at IBM pointed out that DBTYPE needed to be removed from the example (its a single line which was needed for previous versions of MySQL). Its been removed. Added a couple of comments. storage/example/ha_example.cc: Removed line, added comment about Skeleton. storage/example/plug.in: Corrected explanation --- storage/example/ha_example.cc | 5 ++++- storage/example/plug.in | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 06efc727837..1c3b84d3f5f 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -79,6 +79,10 @@ ha_example::open() would also have been necessary. Calls to ha_example::extra() are hints as to what will be occuring to the request. + A Longer Example can be found called the "Skeleton Engine" which can be + found on TangentOrg. It has both an engine and a full build environment + for building a pluggable storage engine. + Happy coding!
-Brian */ @@ -132,7 +136,6 @@ static int example_init_func(void *p) (hash_get_key) example_get_key,0,0); example_hton->state= SHOW_OPTION_YES; - example_hton->db_type= DB_TYPE_EXAMPLE_DB; example_hton->create= example_create_handler; example_hton->flags= HTON_CAN_RECREATE; diff --git a/storage/example/plug.in b/storage/example/plug.in index ba35b1ea117..ee6beaac64f 100644 --- a/storage/example/plug.in +++ b/storage/example/plug.in @@ -1,3 +1,3 @@ MYSQL_STORAGE_ENGINE(example,, [Example Storage Engine], - [Skeleton for Storage Engines for developers], [max,max-no-ndb]) + [Example for Storage Engines for developers], [max,max-no-ndb]) MYSQL_PLUGIN_DYNAMIC(example, [ha_example.la]) From 8d025792a5cbb8a1ed5361116d5d4f5d1db10a56 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Aug 2007 13:01:29 -0700 Subject: [PATCH 2/3] Two bugs in one! The count call was duplicating internally the counts for loaded tests (not autosql tests, just loaded). This could manifest itself by executing by file, or by executing a pre statement. BUG#29803 client/mysqlslap.c: 1) Declared VOID on pre/post statement return values (we were not using the return value and I prefer to see this declared explicitly) 2) Removed extra count call which was causing duplication of rows with parsed files examples. mysql-test/r/mysqlslap.result: The additional selects come from fixing the pre return count call. Dropping the final select is a result of fixing the true count. --- client/mysqlslap.c | 19 +++++++++---------- mysql-test/r/mysqlslap.result | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/client/mysqlslap.c b/client/mysqlslap.c index aa15141bfdc..43d8b1b1560 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1407,15 +1407,15 @@ get_options(int *argc,char ***argv) tmp_string[sbuf.st_size]= '\0'; my_close(data_file,MYF(0)); if (user_supplied_pre_statements) - actual_queries= parse_delimiter(tmp_string, &pre_statements, - delimiter[0]); + (void)parse_delimiter(tmp_string, &pre_statements, + delimiter[0]); my_free(tmp_string, MYF(0)); } else if (user_supplied_pre_statements) { - actual_queries= parse_delimiter(user_supplied_pre_statements, - &pre_statements, - delimiter[0]); + (void)parse_delimiter(user_supplied_pre_statements, + &pre_statements, + delimiter[0]); } if (user_supplied_post_statements && my_stat(user_supplied_post_statements, &sbuf, MYF(0))) @@ -1438,14 +1438,14 @@ get_options(int *argc,char ***argv) tmp_string[sbuf.st_size]= '\0'; my_close(data_file,MYF(0)); if (user_supplied_post_statements) - parse_delimiter(tmp_string, &post_statements, - delimiter[0]); + (void)parse_delimiter(tmp_string, &post_statements, + delimiter[0]); my_free(tmp_string, MYF(0)); } else if (user_supplied_post_statements) { - parse_delimiter(user_supplied_post_statements, &post_statements, - delimiter[0]); + (void)parse_delimiter(user_supplied_post_statements, &post_statements, + delimiter[0]); } if (verbose >= 2) @@ -1993,7 +1993,6 @@ parse_delimiter(const char *script, statement **stmt, char delm) ptr+= retstr - ptr + 1; if (isspace(*ptr)) ptr++; - count++; } if (ptr != script+length) diff --git a/mysql-test/r/mysqlslap.result b/mysql-test/r/mysqlslap.result index cc8bc3dac31..dfe721d10d2 100644 --- a/mysql-test/r/mysqlslap.result +++ b/mysql-test/r/mysqlslap.result @@ -129,7 +129,6 @@ INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2'); select * from t1; select * from t2; -select * from t1; DROP SCHEMA IF EXISTS `mysqlslap`; DROP SCHEMA IF EXISTS `mysqlslap`; CREATE SCHEMA `mysqlslap`; @@ -141,7 +140,6 @@ INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2'); select * from t1; select * from t2; -select * from t1; DROP SCHEMA IF EXISTS `mysqlslap`; DROP SCHEMA IF EXISTS `mysqlslap`; CREATE SCHEMA `mysqlslap`; @@ -153,6 +151,7 @@ INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2'); SHOW TABLES; select * from t1; +select * from t2; SHOW TABLES; DROP SCHEMA IF EXISTS `mysqlslap`; DROP SCHEMA IF EXISTS `mysqlslap`; @@ -165,6 +164,7 @@ INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2'); SHOW TABLES; select * from t1; +select * from t2; SHOW TABLES; DROP SCHEMA IF EXISTS `mysqlslap`; DROP SCHEMA IF EXISTS `mysqlslap`; From c8b9315db3fbdc0a26097c3451ebe89e32c49d45 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Aug 2007 13:03:50 -0700 Subject: [PATCH 3/3] Extending tests for detach (found a memory issue in it, this fixes that and now tests it). client/mysqlslap.c: Fix memory allocation mysql-test/t/mysqlslap.test: Extend test for --detach --- client/mysqlslap.c | 7 +++++++ mysql-test/t/mysqlslap.test | 2 ++ 2 files changed, 9 insertions(+) diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 43d8b1b1560..2811011a1ef 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1804,6 +1804,13 @@ limit_not_met: { mysql_close(mysql); + if (!(mysql= mysql_init(NULL))) + { + fprintf(stderr,"%s: mysql_init() failed ERROR : %s\n", + my_progname, mysql_error(mysql)); + exit(0); + } + if (slap_connect(mysql)) goto end; } diff --git a/mysql-test/t/mysqlslap.test b/mysql-test/t/mysqlslap.test index 192aefb0e03..dffa226d101 100644 --- a/mysql-test/t/mysqlslap.test +++ b/mysql-test/t/mysqlslap.test @@ -38,3 +38,5 @@ --exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam" --post-query="SHOW TABLES" --pre-query="SHOW TABLES"; --exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam" --post-query="SHOW TABLES" --pre-query="SHOW TABLES" --number-of-queries=6 --commit=1; + +--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --detach=2