#At bzr+ssh://bk-internal.mysql.com/bzrroot/mysql-falcon/ based on revid:hky@stripped
335 Hakan Kuecuekyilmaz 2009-01-23
Fixed my_getopt datatype from gptr * to uchar **
modified:
c_testcases/Makefile
c_testcases/falcon_bug_26324.c
c_testcases/my_getopt_test.c
per-file messages:
c_testcases/Makefile
Added falcon_repeatable_read
c_testcases/falcon_bug_26324.c
Fixed my_getopt datatype from gptr * to uchar **
c_testcases/my_getopt_test.c
Fixed my_getopt datatype from gptr * to uchar **
=== modified file 'c_testcases/Makefile'
--- a/c_testcases/Makefile 2007-12-10 09:52:31 +0000
+++ b/c_testcases/Makefile 2009-01-23 12:59:21 +0000
@@ -1,11 +1,15 @@
all:
echo "Usage:"
echo "make falcon_bug_26324"
+ echo "make falcon_repeatable_read"
echo "make my_getopt_test"
falcon_bug_26324: falcon_bug_26324.c
gcc falcon_bug_26324.c -Wall -g -o falcon_bug_26324 -I/usr/local/mysql/include/mysql -L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lpthread
+falcon_repeatable_read: falcon_repeatable_read.c
+ gcc falcon_repeatable_read.c -Wall -g -o falcon_repeatable_read -I/usr/local/mysql/include/mysql -L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lpthread
+
my_getopt_test: my_getopt_test.c
gcc my_getopt_test.c -Wall -g -o my_getopt_test -I/usr/local/mysql/include/mysql -L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lpthread
=== modified file 'c_testcases/falcon_bug_26324.c'
--- a/c_testcases/falcon_bug_26324.c 2007-12-10 09:52:31 +0000
+++ b/c_testcases/falcon_bug_26324.c 2009-01-23 12:59:21 +0000
@@ -30,43 +30,43 @@ static char *opt_user= "root";
static struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit.",
- (gptr *) &opt_help, (gptr *) &opt_help, 0,
+ (uchar **) &opt_help, (uchar **) &opt_help, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use. Default is 'test'.",
- (gptr *) &opt_database, (gptr *) &opt_database, 0,
+ (uchar **) &opt_database, (uchar **) &opt_database, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"isolation_level", 'i', "Isolation level. Default is 'READ-COMMITTED'.",
- (gptr *) &opt_isolation_level, (gptr *) &opt_isolation_level, 0,
+ (uchar **) &opt_isolation_level, (uchar **) &opt_isolation_level, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Host to use when connecting to database server. Default is 127.0.0.1.",
- (gptr *) &opt_host, (gptr *) &opt_host, 0,
+ (uchar **) &opt_host, (uchar **) &opt_host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"num_threads", 'n', "Number of concurrent threads to start. Default is 2.",
- (gptr *) &opt_num_threads, (gptr *) &opt_num_threads, 0,
+ (uchar **) &opt_num_threads, (uchar **) &opt_num_threads, 0,
GET_UINT, REQUIRED_ARG, 2, 1, 1024, 0, 1, 0},
{"pass", 'p', "Password to use when connecting to database server. Default is ''.",
- (gptr *) &opt_password, (gptr *) &opt_password, 0,
+ (uchar **) &opt_password, (uchar **) &opt_password, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use when connecting to database server. Default is 3306.",
- (gptr *) &opt_port, (gptr *) &opt_port, 0,
+ (uchar **) &opt_port, (uchar **) &opt_port, 0,
GET_UINT, REQUIRED_ARG, 3306, 1, 64 * 1024, 0, 1, 0},
{"run_time", 'r', "Run time in seconds. Default is 500.",
- (gptr *) &opt_run_time, (gptr *) &opt_run_time, 0,
+ (uchar **) &opt_run_time, (uchar **) &opt_run_time, 0,
GET_UINT, REQUIRED_ARG, 500, 5, 60000, 0, 1, 0},
{"seed", 's', "Seed value. Default is 303.",
- (gptr *) &opt_seed, (gptr *) &opt_seed, 0,
+ (uchar **) &opt_seed, (uchar **) &opt_seed, 0,
GET_ULONG, REQUIRED_ARG, 303, 1, 128 * 1024 * 1024, 0, 1, 0},
{"user", 'u', "User name to use when connecting to database server. Default is 'root'.",
- (gptr *) &opt_user, (gptr *) &opt_user, 0,
+ (uchar **) &opt_user, (uchar **) &opt_user, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
@@ -83,26 +83,6 @@ int write_string(char *buf, const int
const long int random_number, const int flag);
void *worker_thread(void *arg);
-/**
- * Here one can handle special option related things.
- */
-static my_bool
-get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
- char *argument)
-{
- switch (optid)
- {
- case 'n':
- // printf("I am in n\n");
- break;
- case 's':
- break;
- case 'r':
- break;
- }
- return 0;
-}
-
int db_query(MYSQL *dbc, char *sql, int show_results)
{
MYSQL_RES *r= NULL;
@@ -422,7 +402,7 @@ int main(int argc, char **argv)
mysql_close(dbc);
printf("About to spawn %d threads\n", opt_num_threads);
-
+
for (i= 0; i < opt_num_threads; i++) {
err= pthread_create(&pthreads[i], NULL, worker_thread, (void *) i);
if (err != 0)
=== modified file 'c_testcases/my_getopt_test.c'
--- a/c_testcases/my_getopt_test.c 2007-12-10 09:52:31 +0000
+++ b/c_testcases/my_getopt_test.c 2009-01-23 12:59:21 +0000
@@ -16,19 +16,19 @@ static ulong opt_seed;
static struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit.",
- (gptr *) &opt_help, (gptr *) &opt_help, 0,
+ (uchar **) &opt_help, (uchar **) &opt_help, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
+
{"num_threads", 'n', "Number of concurrent threads to start. Default is 2.",
- (gptr *) &opt_num_threads, (gptr *) &opt_num_threads, 0,
+ (uchar **) &opt_num_threads, (uchar **) &opt_num_threads, 0,
GET_ULONG, REQUIRED_ARG, 2, 1, 1024, 0, 1, 0},
-
+
{"run_time", 'r', "Run time in seconds. Default is 500.",
- (gptr *) &opt_run_time, (gptr *) &opt_run_time, 0,
+ (uchar **) &opt_run_time, (uchar **) &opt_run_time, 0,
GET_ULONG, REQUIRED_ARG, 500, 5, 60000, 0, 1, 0},
-
+
{"seed", 's', "Seed value. Default is 303",
- (gptr *) &opt_seed, (gptr *) &opt_seed, 0,
+ (uchar **) &opt_seed, (uchar **) &opt_seed, 0,
GET_ULONG, REQUIRED_ARG, 303, 1, 128 * 1024 * 1024, 0, 1, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
@@ -42,13 +42,13 @@ get_one_option(int optid, const struct m
char *argument)
{
switch (optid) {
- case 'n':
+ case 'n':
// printf("I am in n\n");
- break;
- case 's':
- break;
- case 'r':
- break;
+ break;
+ case 's':
+ break;
+ case 'r':
+ break;
}
return 0;
}
@@ -59,19 +59,19 @@ int main(int argc, char **argv)
if ((ho_error= handle_options(&argc, &argv, my_long_options,
get_one_option))) {
- return ho_error;
+ return ho_error;
}
// printf("help is: %d\n", opt_help);
printf("num_threads is: %ld\n", opt_num_threads);
printf("run_time is: %ld\n", opt_run_time);
printf("seed is: %ld\n", opt_seed);
-
+
if (opt_help) {
- my_print_help(my_long_options);
+ my_print_help(my_long_options);
- return 0;
+ return 0;
}
-
+
return 0;
}
| Thread |
|---|
| • bzr commit into mysql-falcon branch (hky:335) | Hakan Kuecuekyilmaz | 23 Jan |