Commit 6d165971 authored by unknown's avatar unknown

Merge mysql.com:/home/wax/mysql/mysql-5.0

into mysql.com:/home/wax/mysql/mysql-5.0test
parents e02a8e60 7fb6ac6d
...@@ -96,6 +96,8 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -96,6 +96,8 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY Host (Host,Db,User)," "PRIMARY KEY Host (Host,Db,User),"
"KEY User (User))" "KEY User (User))"
"engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Database privileges';\n"); "comment='Database privileges';\n");
if (test) if (test)
...@@ -126,10 +128,12 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -126,10 +128,12 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY Host (Host,Db))" "PRIMARY KEY Host (Host,Db))"
"comment='Host privileges;" "engine=MyISAM "
" Merged with database privileges';\n"); "CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Host privileges; Merged with database privileges';\n");
} }
if (test_sys_file(mdata,"mysql/user.frm")) if (test_sys_file(mdata,"mysql/user.frm"))
{ {
#ifdef __WIN__ #ifdef __WIN__
...@@ -184,7 +188,10 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -184,7 +188,10 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"max_updates int(11) unsigned DEFAULT 0 NOT NULL," "max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
"max_connections int(11) unsigned DEFAULT 0 NOT NULL," "max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
"PRIMARY KEY Host (Host,User)" "PRIMARY KEY Host (Host,User)"
") comment='Users and global privileges';\n"); ") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Users and global privileges';\n");
if (test) if (test)
{ {
...@@ -238,7 +245,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -238,7 +245,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"dl char(128) DEFAULT '' NOT NULL," "dl char(128) DEFAULT '' NOT NULL,"
"type enum ('function','aggregate') NOT NULL," "type enum ('function','aggregate') NOT NULL,"
"PRIMARY KEY (name)" "PRIMARY KEY (name)"
") comment='User defined functions';\n"); ") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='User defined functions';\n");
} }
if (test_sys_file(mdata,"mysql/tables_priv.frm")) if (test_sys_file(mdata,"mysql/tables_priv.frm"))
...@@ -258,7 +267,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -258,7 +267,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
" DEFAULT '' NOT NULL," " DEFAULT '' NOT NULL,"
"PRIMARY KEY (Host,Db,User,Table_name)," "PRIMARY KEY (Host,Db,User,Table_name),"
"KEY Grantor (Grantor)" "KEY Grantor (Grantor)"
") comment='Table privileges';\n"); ") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Table privileges';\n");
} }
if (test_sys_file(mdata,"mysql/columns_priv.frm")) if (test_sys_file(mdata,"mysql/columns_priv.frm"))
...@@ -274,7 +285,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -274,7 +285,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Column_priv set('Select','Insert','Update','References')" "Column_priv set('Select','Insert','Update','References')"
" DEFAULT '' NOT NULL," " DEFAULT '' NOT NULL,"
"PRIMARY KEY (Host,Db,User,Table_name,Column_name)" "PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
") comment='Column privileges';\n"); ") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Column privileges';\n");
} }
if (test_sys_file(mdata,"mysql/help_topic.frm")) if (test_sys_file(mdata,"mysql/help_topic.frm"))
...@@ -289,7 +302,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -289,7 +302,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"url varchar(128) not null," "url varchar(128) not null,"
"primary key (help_topic_id)," "primary key (help_topic_id),"
"unique index (name)" "unique index (name)"
") comment='help topics';\n"); ") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='help topics';\n");
} }
if (test_sys_file(mdata,"mysql/help_category.frm")) if (test_sys_file(mdata,"mysql/help_category.frm"))
...@@ -302,7 +317,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -302,7 +317,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"url varchar(128) not null," "url varchar(128) not null,"
"primary key (help_category_id)," "primary key (help_category_id),"
"unique index (name)" "unique index (name)"
") comment='help categories';\n"); ") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='help categories';\n");
} }
if (test_sys_file(mdata,"mysql/help_keyword.frm")) if (test_sys_file(mdata,"mysql/help_keyword.frm"))
...@@ -313,7 +330,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -313,7 +330,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"name varchar(64) not null," "name varchar(64) not null,"
"primary key (help_keyword_id)," "primary key (help_keyword_id),"
"unique index (name)" "unique index (name)"
") comment='help keywords';\n"); ") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='help keywords';\n");
} }
if (test_sys_file(mdata,"mysql/help_relation.frm")) if (test_sys_file(mdata,"mysql/help_relation.frm"))
...@@ -323,7 +342,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -323,7 +342,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"help_topic_id int unsigned not null references help_topic," "help_topic_id int unsigned not null references help_topic,"
"help_keyword_id int unsigned not null references help_keyword," "help_keyword_id int unsigned not null references help_keyword,"
"primary key (help_keyword_id, help_topic_id)" "primary key (help_keyword_id, help_topic_id)"
") comment='keyword-topic relation';\n"); ") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='keyword-topic relation';\n");
} }
if (test_sys_file(mdata,"mysql/time_zone_name.frm")) if (test_sys_file(mdata,"mysql/time_zone_name.frm"))
...@@ -333,7 +354,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -333,7 +354,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Name char(64) NOT NULL," "Name char(64) NOT NULL,"
"Time_zone_id int unsigned NOT NULL," "Time_zone_id int unsigned NOT NULL,"
"PRIMARY KEY Name (Name)" "PRIMARY KEY Name (Name)"
") DEFAULT CHARACTER SET latin1 " ") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zone names';\n"); "comment='Time zone names';\n");
if (test) if (test)
...@@ -341,7 +362,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -341,7 +362,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
fprintf(out, fprintf(out,
"INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES" "INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES"
"('MET', 1), ('UTC', 2), ('Universal', 2), " "('MET', 1), ('UTC', 2), ('Universal', 2), "
"('Europe/Moscow',3), ('leap/Europe/Moscow',4);\n"); "('Europe/Moscow',3), ('leap/Europe/Moscow',4),"
"('Japan', 5);\n");
} }
} }
...@@ -353,13 +376,13 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -353,13 +376,13 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Time_zone_id int unsigned NOT NULL auto_increment," "Time_zone_id int unsigned NOT NULL auto_increment,"
"Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL," "Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY TzId (Time_zone_id)" "PRIMARY KEY TzId (Time_zone_id)"
") DEFAULT CHARACTER SET latin1 " ") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zones';\n"); "comment='Time zones';\n");
if (test) if (test)
{ {
fprintf(out,"INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)" fprintf(out,"INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)"
"VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y');\n"); "VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');\n");
} }
} }
...@@ -371,7 +394,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -371,7 +394,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Transition_time bigint signed NOT NULL," "Transition_time bigint signed NOT NULL,"
"Transition_type_id int unsigned NOT NULL," "Transition_type_id int unsigned NOT NULL,"
"PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)" "PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)"
") DEFAULT CHARACTER SET latin1 " ") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zone transitions';\n"); "comment='Time zone transitions';\n");
if (test) if (test)
...@@ -576,7 +599,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -576,7 +599,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
",(4, 2045689222, 8) ,(4, 2058390022, 9)" ",(4, 2045689222, 8) ,(4, 2058390022, 9)"
",(4, 2077138822, 8) ,(4, 2090444422, 9)" ",(4, 2077138822, 8) ,(4, 2090444422, 9)"
",(4, 2108588422, 8) ,(4, 2121894022, 9)" ",(4, 2108588422, 8) ,(4, 2121894022, 9)"
",(4, 2140038022, 8);\n"); ",(4, 2140038022, 8), (5, -1009875600, 1);\n");
} }
} }
...@@ -590,7 +615,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -590,7 +615,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Is_DST tinyint unsigned DEFAULT 0 NOT NULL," "Is_DST tinyint unsigned DEFAULT 0 NOT NULL,"
"Abbreviation char(8) DEFAULT '' NOT NULL," "Abbreviation char(8) DEFAULT '' NOT NULL,"
"PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)" "PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)"
") DEFAULT CHARACTER SET latin1 " ") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zone transition types';\n"); "comment='Time zone transition types';\n");
if (test) if (test)
...@@ -612,7 +637,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -612,7 +637,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
",(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')" ",(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')"
",(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')" ",(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')"
",(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')" ",(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')"
",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET');\n"); ",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET')"
",(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');\n");
} }
} }
...@@ -623,7 +650,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test) ...@@ -623,7 +650,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Transition_time bigint signed NOT NULL," "Transition_time bigint signed NOT NULL,"
"Correction int signed NOT NULL," "Correction int signed NOT NULL,"
"PRIMARY KEY TranTime (Transition_time)" "PRIMARY KEY TranTime (Transition_time)"
") DEFAULT CHARACTER SET latin1 " ") engine=MyISAM CHARACTER SET utf8 "
"comment='Leap seconds information for time zones';\n"); "comment='Leap seconds information for time zones';\n");
if (test) if (test)
......
...@@ -800,9 +800,12 @@ int removef(const char *format, ...) ...@@ -800,9 +800,12 @@ int removef(const char *format, ...)
#ifndef STRUCT_DIRENT_HAS_D_TYPE #ifndef STRUCT_DIRENT_HAS_D_TYPE
struct stat st; struct stat st;
if (lstat(entry->d_name, &st) == -1) /* create long name */
snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name);
if (lstat(temp, &st) == -1)
{ {
return 1; return 1; /* Error couldn't lstat file */
} }
if (!S_ISDIR(st.st_mode) && !fnmatch(p, entry->d_name,0)) if (!S_ISDIR(st.st_mode) && !fnmatch(p, entry->d_name,0))
......
...@@ -132,7 +132,13 @@ static char skip_test[FN_REFLEN]= ...@@ -132,7 +132,13 @@ static char skip_test[FN_REFLEN]=
" repair ," " repair ,"
" rpl_trunc_binlog ," " rpl_trunc_binlog ,"
" mysqldump ," " mysqldump ,"
" rpl000001 "; " rpl000001 ,"
" derived ,"
" group_by ,"
" select ,"
" rpl000015 ,"
" subselect ";
#endif #endif
static char ignore_test[FN_REFLEN]= ""; static char ignore_test[FN_REFLEN]= "";
...@@ -143,6 +149,8 @@ static char mysql_tmp_dir[FN_REFLEN]; ...@@ -143,6 +149,8 @@ static char mysql_tmp_dir[FN_REFLEN];
static char result_dir[FN_REFLEN]; static char result_dir[FN_REFLEN];
static char master_dir[FN_REFLEN]; static char master_dir[FN_REFLEN];
static char slave_dir[FN_REFLEN]; static char slave_dir[FN_REFLEN];
static char slave1_dir[FN_REFLEN];
static char slave2_dir[FN_REFLEN];
static char lang_dir[FN_REFLEN]; static char lang_dir[FN_REFLEN];
static char char_dir[FN_REFLEN]; static char char_dir[FN_REFLEN];
...@@ -190,6 +198,8 @@ int restarts= 0; ...@@ -190,6 +198,8 @@ int restarts= 0;
FILE *log_fd= NULL; FILE *log_fd= NULL;
static char argument[FN_REFLEN];
/****************************************************************************** /******************************************************************************
functions functions
...@@ -221,7 +231,7 @@ void log_info(const char *, ...); ...@@ -221,7 +231,7 @@ void log_info(const char *, ...);
void log_error(const char *, ...); void log_error(const char *, ...);
void log_errno(const char *, ...); void log_errno(const char *, ...);
void die(const char *); void die(const char *);
char *str_tok(char *string, const char *delim); char *str_tok(char* dest, char *string, const char *delim);
#ifndef __WIN__ #ifndef __WIN__
void run_init_script(const char *script_name); void run_init_script(const char *script_name);
#endif #endif
...@@ -289,11 +299,15 @@ void install_db(char *datadir) ...@@ -289,11 +299,15 @@ void install_db(char *datadir)
add_arg(&al, "--basedir=%s", base_dir); add_arg(&al, "--basedir=%s", base_dir);
add_arg(&al, "--datadir=%s", datadir); add_arg(&al, "--datadir=%s", datadir);
add_arg(&al, "--skip-innodb"); add_arg(&al, "--skip-innodb");
add_arg(&al, "--skip-ndbcluster");
add_arg(&al, "--skip-bdb"); add_arg(&al, "--skip-bdb");
#ifndef __NETWARE__ #ifndef __NETWARE__
add_arg(&al, "--character-sets-dir=%s", char_dir); add_arg(&al, "--character-sets-dir=%s", char_dir);
add_arg(&al, "--language=%s", lang_dir); add_arg(&al, "--language=%s", lang_dir);
#endif #endif
// added
add_arg(&al, "--default-character-set=latin1");
add_arg(&al, "--innodb_data_file_path=ibdata1:50M");
/* spawn */ /* spawn */
if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0) if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0)
...@@ -335,12 +349,27 @@ void mysql_install_db() ...@@ -335,12 +349,27 @@ void mysql_install_db()
mkdir(temp, S_IRWXU); mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir); snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU); mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
mkdir(temp, S_IRWXU); mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir); snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU); mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir); snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU); mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave1-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave1-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave2-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave2-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
#else #else
mkdir(temp); mkdir(temp);
/* create subdirectories */ /* create subdirectories */
...@@ -368,6 +397,8 @@ void mysql_install_db() ...@@ -368,6 +397,8 @@ void mysql_install_db()
install_db(master_dir); install_db(master_dir);
mlog("Creating test databases for slave... \n"); mlog("Creating test databases for slave... \n");
install_db(slave_dir); install_db(slave_dir);
install_db(slave1_dir);
install_db(slave2_dir);
} }
/****************************************************************************** /******************************************************************************
...@@ -384,7 +415,6 @@ void start_master() ...@@ -384,7 +415,6 @@ void start_master()
int err; int err;
char master_out[FN_REFLEN]; char master_out[FN_REFLEN];
char master_err[FN_REFLEN]; char master_err[FN_REFLEN];
/* char temp[FN_REFLEN]; */
char temp2[FN_REFLEN]; char temp2[FN_REFLEN];
/* remove old berkeley db log files that can confuse the server */ /* remove old berkeley db log files that can confuse the server */
...@@ -463,6 +493,11 @@ void start_master() ...@@ -463,6 +493,11 @@ void start_master()
add_arg(&al, "--character-sets-dir=%s", char_dir); add_arg(&al, "--character-sets-dir=%s", char_dir);
add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
add_arg(&al, "--language=%s", lang_dir); add_arg(&al, "--language=%s", lang_dir);
add_arg(&al, "--rpl-recovery-rank=1");
add_arg(&al, "--init-rpl-role=master");
add_arg(&al, "--default-character-set=latin1");
// add_arg(&al, "--innodb_data_file_path=ibdata1:50M");
#ifdef DEBUG /* only for debug builds */ #ifdef DEBUG /* only for debug builds */
add_arg(&al, "--debug"); add_arg(&al, "--debug");
#endif #endif
...@@ -491,13 +526,13 @@ void start_master() ...@@ -491,13 +526,13 @@ void start_master()
{ {
char *p; char *p;
p= (char *)str_tok(master_opt, " \t"); p= (char *)str_tok(argument, master_opt, " \t");
if (!strstr(master_opt, "timezone")) if (!strstr(master_opt, "timezone"))
{ {
while (p) while (p)
{ {
add_arg(&al, "%s", p); add_arg(&al, "%s", p);
p= (char *)str_tok(NULL, " \t"); p= (char *)str_tok(argument, NULL, " \t");
} }
} }
} }
...@@ -624,10 +659,10 @@ void start_slave() ...@@ -624,10 +659,10 @@ void start_slave()
add_arg(&al, "--log-bin=slave-bin"); add_arg(&al, "--log-bin=slave-bin");
add_arg(&al, "--relay_log=slave-relay-bin"); add_arg(&al, "--relay_log=slave-relay-bin");
add_arg(&al, "--basedir=%s", base_dir); add_arg(&al, "--basedir=%s", base_dir);
add_arg(&al, "--port=%u", slave_port);
#if !defined(__NETWARE__) && !defined(__WIN__) #if !defined(__NETWARE__) && !defined(__WIN__)
add_arg(&al, "--socket=%s",slave_socket); add_arg(&al, "--socket=%s",slave_socket);
#endif #endif
add_arg(&al, "--port=%u", slave_port);
add_arg(&al, "--datadir=%s", slave_dir); add_arg(&al, "--datadir=%s", slave_dir);
#ifndef __WIN__ #ifndef __WIN__
add_arg(&al, "--pid-file=%s", slave_pid); add_arg(&al, "--pid-file=%s", slave_pid);
...@@ -651,6 +686,11 @@ void start_slave() ...@@ -651,6 +686,11 @@ void start_slave()
add_arg(&al, "--master-retry-count=10"); add_arg(&al, "--master-retry-count=10");
add_arg(&al, "-O"); add_arg(&al, "-O");
add_arg(&al, "slave_net_timeout=10"); add_arg(&al, "slave_net_timeout=10");
add_arg(&al, "--log-slave-updates");
add_arg(&al, "--log=%s/var/log/slave.log", mysql_test_dir);
add_arg(&al, "--default-character-set=latin1");
add_arg(&al, "--skip-ndbcluster");
#ifdef DEBUG /* only for debug builds */ #ifdef DEBUG /* only for debug builds */
add_arg(&al, "--debug"); add_arg(&al, "--debug");
#endif #endif
...@@ -667,12 +707,12 @@ void start_slave() ...@@ -667,12 +707,12 @@ void start_slave()
{ {
char *p; char *p;
p= (char *)str_tok(slave_master_info, " \t"); p= (char *)str_tok(argument, slave_master_info, " \t");
while (p) while (p)
{ {
add_arg(&al, "%s", p); add_arg(&al, "%s", p);
p= (char *)str_tok(NULL, " \t"); p= (char *)str_tok(argument, NULL, " \t");
} }
} }
else else
...@@ -700,12 +740,12 @@ void start_slave() ...@@ -700,12 +740,12 @@ void start_slave()
{ {
char *p; char *p;
p= (char *)str_tok(slave_opt, " \t"); p= (char *)str_tok(argument, slave_opt, " \t");
while (p) while (p)
{ {
add_arg(&al, "%s", p); add_arg(&al, "%s", p);
p= (char *)str_tok(NULL, " \t"); p= (char *)str_tok(argument, NULL, " \t");
} }
} }
...@@ -753,9 +793,12 @@ void start_slave() ...@@ -753,9 +793,12 @@ void start_slave()
void mysql_start() void mysql_start()
{ {
/* log_info("Starting the MySQL server(s): %u", ++restarts); */
printf("loading master...\r");
start_master(); start_master();
printf("loading slave...\r");
start_slave(); start_slave();
/* activate the test screen */ /* activate the test screen */
...@@ -853,6 +896,7 @@ void mysql_restart() ...@@ -853,6 +896,7 @@ void mysql_restart()
mysql_stop(); mysql_stop();
mlog(DASH); mlog(DASH);
sleep(1);
mysql_start(); mysql_start();
} }
...@@ -912,7 +956,7 @@ int read_option(char *opt_file, char *opt) ...@@ -912,7 +956,7 @@ int read_option(char *opt_file, char *opt)
if ((p= strstr(opt, "\\\\")) != NULL) if ((p= strstr(opt, "\\\\")) != NULL)
{ {
/* bmove is guranteed to work byte by byte */ /* bmove is guranteed to work byte by byte */
bmove(p, p+1, strlen(p+1)); bmove(p, p+1, strlen(p)+1);
} }
} }
else else
...@@ -977,14 +1021,6 @@ void run_test(char *test) ...@@ -977,14 +1021,6 @@ void run_test(char *test)
char err_file[FN_REFLEN]; char err_file[FN_REFLEN];
int err; int err;
arg_list_t al; arg_list_t al;
#ifdef __WIN__
/* Clean test database */
removef("%s/test/*.*", master_dir);
removef("%s/test/*.*", slave_dir);
removef("%s/mysqltest/*.*", master_dir);
removef("%s/mysqltest/*.*", slave_dir);
#endif
/* skip slave? */ /* skip slave? */
flag= skip_slave; flag= skip_slave;
skip_slave= (strncmp(test, "rpl", 3) != 0); skip_slave= (strncmp(test, "rpl", 3) != 0);
...@@ -1045,9 +1081,6 @@ void run_test(char *test) ...@@ -1045,9 +1081,6 @@ void run_test(char *test)
if (!master_running) mysql_start(); if (!master_running) mysql_start();
else if (restart) mysql_restart(); else if (restart) mysql_restart();
/* let the system stabalize */
sleep(1);
/* show test */ /* show test */
mlog("%-46s ", test); mlog("%-46s ", test);
...@@ -1066,10 +1099,12 @@ void run_test(char *test) ...@@ -1066,10 +1099,12 @@ void run_test(char *test)
add_arg(&al, "--silent"); add_arg(&al, "--silent");
add_arg(&al, "--basedir=%s/", mysql_test_dir); add_arg(&al, "--basedir=%s/", mysql_test_dir);
add_arg(&al, "--host=127.0.0.1"); add_arg(&al, "--host=127.0.0.1");
add_arg(&al, "--skip-safemalloc");
add_arg(&al, "-v"); add_arg(&al, "-v");
add_arg(&al, "-R"); add_arg(&al, "-R");
add_arg(&al, "%s", result_file); add_arg(&al, "%s", result_file);
if (use_openssl) if (use_openssl)
{ {
add_arg(&al, "--ssl-ca=%s", ca_cert); add_arg(&al, "--ssl-ca=%s", ca_cert);
...@@ -1079,7 +1114,6 @@ void run_test(char *test) ...@@ -1079,7 +1114,6 @@ void run_test(char *test)
/* spawn */ /* spawn */
err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL); err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL);
/* free args */ /* free args */
free_args(&al); free_args(&al);
...@@ -1259,7 +1293,9 @@ void die(const char *msg) ...@@ -1259,7 +1293,9 @@ void die(const char *msg)
void setup(char *file __attribute__((unused))) void setup(char *file __attribute__((unused)))
{ {
char temp[FN_REFLEN]; char temp[FN_REFLEN];
#if defined(__WIN__) || defined(__NETWARE__)
char file_path[FN_REFLEN*2]; char file_path[FN_REFLEN*2];
#endif
char *p; char *p;
int position; int position;
...@@ -1349,7 +1385,11 @@ void setup(char *file __attribute__((unused))) ...@@ -1349,7 +1385,11 @@ void setup(char *file __attribute__((unused)))
snprintf(client_key, FN_REFLEN, "%s/SSL/client-key.pem", base_dir); snprintf(client_key, FN_REFLEN, "%s/SSL/client-key.pem", base_dir);
/* setup files */ /* setup files */
#ifdef _DEBUG
snprintf(mysqld_file, FN_REFLEN, "%s/mysqld-debug.exe", bin_dir);
#else
snprintf(mysqld_file, FN_REFLEN, "%s/mysqld.exe", bin_dir); snprintf(mysqld_file, FN_REFLEN, "%s/mysqld.exe", bin_dir);
#endif
snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest.exe", bin_dir); snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest.exe", bin_dir);
snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin.exe", bin_dir); snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin.exe", bin_dir);
#else #else
...@@ -1361,6 +1401,8 @@ void setup(char *file __attribute__((unused))) ...@@ -1361,6 +1401,8 @@ void setup(char *file __attribute__((unused)))
snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir); snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir); snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
snprintf(slave1_dir, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir);
snprintf(slave2_dir, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir);
snprintf(lang_dir, FN_REFLEN, "%s/sql/share/english", base_dir); snprintf(lang_dir, FN_REFLEN, "%s/sql/share/english", base_dir);
snprintf(char_dir, FN_REFLEN, "%s/sql/share/charsets", base_dir); snprintf(char_dir, FN_REFLEN, "%s/sql/share/charsets", base_dir);
...@@ -1413,30 +1455,147 @@ void setup(char *file __attribute__((unused))) ...@@ -1413,30 +1455,147 @@ void setup(char *file __attribute__((unused)))
snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir); snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
_putenv(file_path); _putenv(file_path);
snprintf(file_path, FN_REFLEN*2, snprintf(file_path, FN_REFLEN*2,
"MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u", "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -uroot --port=%u",
bin_dir, master_port); bin_dir, master_port);
_putenv(file_path); _putenv(file_path);
snprintf(file_path, FN_REFLEN*2, snprintf(file_path, FN_REFLEN*2,
"MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s", "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s",
bin_dir, mysql_tmp_dir); bin_dir, mysql_tmp_dir);
_putenv(file_path); _putenv(file_path);
#else
snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
putenv(file_path);
snprintf(file_path, FN_REFLEN*2, snprintf(file_path, FN_REFLEN*2,
"MYSQL_DUMP=%s/mysqldump --no-defaults -u root --port=%u --socket=%s", "TESTS_BINDIR=%s/tests", base_dir);
bin_dir, master_port, master_socket); _putenv(file_path);
putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"CHARSETSDIR=%s/sql/share/charsets", base_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL=%s/mysql --port=%u ",
bin_dir, master_port);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2, snprintf(file_path, FN_REFLEN*2,
"MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s", "MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults "
"--host=localhost --port=%u "
"--basedir=%s --bindir=%s --verbose",
base_dir,master_port, base_dir, bin_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"NDB_TOOLS_DIR=%s/ndb/tools", base_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"CLIENT_BINDIR=%s", bin_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase "
"--user=root --port=%u --silent",
base_dir, master_port);
_putenv(file_path);
#else
{
static char env_MYSQL_TEST_DIR[FN_REFLEN*2];
static char env_MYSQL_DUMP[FN_REFLEN*2];
static char env_MYSQL_BINLOG[FN_REFLEN*2];
static char env_MASTER_MYSOCK[FN_REFLEN*2];
static char env_TESTS_BINDIR[FN_REFLEN*2];
static char env_CHARSETSDIR[FN_REFLEN*2];
static char env_MYSQL[FN_REFLEN*2];
static char env_MYSQL_FIX_SYSTEM_TABLES[FN_REFLEN*2];
static char env_CLIENT_BINDIR[FN_REFLEN*2];
static char env_MYSQL_CLIENT_TEST[FN_REFLEN*2];
static char env_NDB_TOOLS_DIR[FN_REFLEN*2];
static char env_NDB_MGM[FN_REFLEN*2];
static char env_NDB_BACKUP_DIR[FN_REFLEN*2];
static char env_NDB_TOOLS_OUTPUT[FN_REFLEN*2];
snprintf(env_MYSQL_TEST_DIR,FN_REFLEN*2,
"MYSQL_TEST_DIR=%s",mysql_test_dir);
putenv(env_MYSQL_TEST_DIR);
snprintf(env_MYSQL_DUMP, FN_REFLEN*2,"MYSQL_DUMP=%s/mysqldump --no-defaults "
"-uroot --port=%u --socket=%s ",
bin_dir, master_port, master_socket);
putenv(env_MYSQL_DUMP);
snprintf(env_MYSQL_BINLOG, FN_REFLEN*2,
"MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s -uroot ",
bin_dir, mysql_tmp_dir); bin_dir, mysql_tmp_dir);
putenv(file_path); putenv(env_MYSQL_BINLOG);
snprintf(env_MASTER_MYSOCK, FN_REFLEN*2,
"MASTER_MYSOCK=%s", master_socket);
putenv(env_MASTER_MYSOCK);
snprintf(env_TESTS_BINDIR, FN_REFLEN*2,
"TESTS_BINDIR=%s/tests", base_dir);
putenv(env_TESTS_BINDIR);
snprintf(env_CHARSETSDIR, FN_REFLEN*2,
"CHARSETSDIR=%s/sql/share/charsets", base_dir);
putenv(env_CHARSETSDIR);
snprintf(env_MYSQL, FN_REFLEN*2,
"MYSQL=%s/mysql --port=%u --socket=%s -uroot ",
bin_dir, master_port, master_socket);
putenv(env_MYSQL);
snprintf(env_MYSQL_FIX_SYSTEM_TABLES, FN_REFLEN*2,
"MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults "
"--host=localhost --port=%u --socket=%s "
"--basedir=%s --bindir=%s --verbose -uroot ",
base_dir,master_port, master_socket, base_dir, bin_dir);
putenv(env_MYSQL_FIX_SYSTEM_TABLES);
snprintf(env_CLIENT_BINDIR, FN_REFLEN*2,
"CLIENT_BINDIR=%s", bin_dir);
putenv(env_CLIENT_BINDIR);
snprintf(env_MYSQL_CLIENT_TEST, FN_REFLEN*2,
"MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase "
"--user=root --socket=%s --port=%u --silent",
base_dir, master_socket, master_port);
putenv(env_MYSQL_CLIENT_TEST);
// NDB
snprintf(env_NDB_TOOLS_DIR, FN_REFLEN*2,
"NDB_TOOLS_DIR=%s/ndb/tools", base_dir);
putenv(env_NDB_TOOLS_DIR);
snprintf(env_NDB_MGM, FN_REFLEN*2,
"NDB_MGM=%s/ndb/src/mgmclient/ndb_mgm", base_dir);
putenv(env_NDB_MGM);
//NDBCLUSTER_PORT=9350
snprintf(env_NDB_BACKUP_DIR, FN_REFLEN*2,
"NDB_BACKUP_DIR=%s/var/ndbcluster-%i", mysql_test_dir, 9350);
putenv(env_NDB_BACKUP_DIR);
snprintf(env_NDB_TOOLS_OUTPUT, FN_REFLEN*2,
"NDB_TOOLS_OUTPUT=%s/var/log/ndb_tools.log", mysql_test_dir);
putenv(env_NDB_TOOLS_OUTPUT);
putenv((char *)"NDB_STATUS_OK=1");
// NDB_MGM="$BASEDIR/ndb/src/mgmclient/ndb_mgm"
// NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
// NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
}
#endif #endif
#ifndef __WIN__ #ifndef __WIN__
putenv((char *)"MASTER_MYPORT=9306"); putenv((char *)"MASTER_MYPORT=9306");
putenv((char *)"SLAVE_MYPORT=9307"); putenv((char *)"SLAVE_MYPORT=9307");
putenv((char *)"MYSQL_TCP_PORT=3306"); putenv((char *)"MYSQL_TCP_PORT=3306");
#else #else
_putenv("MASTER_MYPORT=9306"); _putenv("MASTER_MYPORT=9306");
_putenv("SLAVE_MYPORT=9307"); _putenv("SLAVE_MYPORT=9307");
...@@ -1468,9 +1627,14 @@ int main(int argc, char **argv) ...@@ -1468,9 +1627,14 @@ int main(int argc, char **argv)
char **testes= 0; char **testes= 0;
int name_index; int name_index;
int index; int index;
char var_dir[FN_REFLEN];
/* setup */ /* setup */
setup(argv[0]); setup(argv[0]);
/* delete all file in var */
snprintf(var_dir,FN_REFLEN,"%s/var",mysql_test_dir);
del_tree(var_dir);
/* /*
The --ignore option is comma saperated list of test cases to skip and The --ignore option is comma saperated list of test cases to skip and
should be very first command line option to the test suite. should be very first command line option to the test suite.
...@@ -1484,7 +1648,8 @@ int main(int argc, char **argv) ...@@ -1484,7 +1648,8 @@ int main(int argc, char **argv)
{ {
char *temp, *token; char *temp, *token;
temp= strdup(strchr(argv[1],'=') + 1); temp= strdup(strchr(argv[1],'=') + 1);
for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ",")) for (token=str_tok(argument, temp, ","); token != NULL;
token=str_tok(argument, NULL, ","))
{ {
if (strlen(ignore_test) + strlen(token) + 2 <= FN_REFLEN-1) if (strlen(ignore_test) + strlen(token) + 2 <= FN_REFLEN-1)
sprintf(ignore_test+strlen(ignore_test), " %s ", token); sprintf(ignore_test+strlen(ignore_test), " %s ", token);
...@@ -1671,105 +1836,70 @@ int main(int argc, char **argv) ...@@ -1671,105 +1836,70 @@ int main(int argc, char **argv)
Output: Output:
return the null terminated token of NULL. return the null terminated token of NULL.
*/ */
char *str_tok(char* dest, char *string, const char *delim)
char *str_tok(char *string, const char *delim)
{ {
char *token; /* current token received from strtok */ char *token;
char *qt_token; /* token delimeted by the matching pair of quote */ char *ptr_end_token= NULL;
/* char *ptr_quote= NULL;
if there are any quote chars found in the token then this variable char *ptr_token= NULL;
will hold the concatenated string to return to the caller int count_quotes= 0;
*/
char *ptr_token=NULL;
/* pointer to the quote character in the token from strtok */
char *ptr_quote=NULL;
/* See if the delimeter contains any quote character */ *dest = '\0';
if (strchr(delim,'\'') || strchr(delim,'\"')) if (strchr(delim,'\'') || strchr(delim,'\"'))
return NULL; return NULL;
/* repeate till we are getting some token from strtok */ token= (char*)strtok(string, delim);
while ((token= (char*)strtok(string, delim) ) != NULL) if (token)
{ {
/* /* double quote is found */
make the input string NULL so that next time onward strtok can if (strchr(token,'\"'))
be called with NULL input string.
*/
string= NULL;
/* We don't need to remove any quote character for Windows version */
#ifndef __WIN__
/* check if the current token contain double quote character*/
if ((ptr_quote= (char*)strchr(token,'\"')) != NULL)
{ {
/* do
get the matching the matching double quote in the remaining
input string
*/
qt_token= (char*)strtok(NULL,"\"");
}
/* check if the current token contain single quote character*/
else if ((ptr_quote= (char*)strchr(token,'\'')) != NULL)
{ {
/* if (count_quotes & 1)
get the matching the matching single quote in the remaining
input string
*/
qt_token= (char*)strtok(NULL,"\'");
}
#endif
/*
if the current token does not contains any quote character then
return to the caller.
*/
if (ptr_quote == NULL)
{ {
/* if (*dest == '\0')
if there is any earlier token i.e. ptr_token then append the sprintf(dest,"%s", ptr_token);
current token in it and return it else return the current else
token directly sprintf(dest,"%s %s", dest, ptr_token);
*/ ptr_token= (char*)strtok(NULL, delim);
return ptr_token ? strcat(ptr_token,token) : token; if (!ptr_token)
break;
} }
else
/*
remove the quote character i.e. make NULL so that the token will
be devided in two part and later both part can be concatenated
and hence quote will be removed
*/
*ptr_quote= 0;
/* check if ptr_token has been initialized or not */
if (ptr_token == NULL)
{ {
/* initialize the ptr_token with current token */
ptr_token= token; ptr_token= token;
/* copy entire string between matching pair of quote*/
sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token);
} }
else if (ptr_quote = strchr(ptr_token,'\"'))
{ {
/* ptr_end_token= ptr_token + strlen(ptr_token);
copy the current token and entire string between matching pair do
of quote {
*/ #ifndef __WIN__
if (qt_token == NULL) bmove(ptr_quote, ptr_quote+1, ptr_end_token - ptr_quote);
#endif
count_quotes++;
} while (ptr_quote != NULL && (ptr_quote = strchr(ptr_quote+1,'\"')));
}
/* there are unpair quotes we have to search next quote*/
} while (count_quotes & 1);
if (ptr_token != NULL)
{ {
sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1); if (*dest == '\0')
sprintf(dest,"%s", ptr_token);
else
sprintf(dest,"%s %s",dest,ptr_token);
}
} }
else else
{ {
sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1, sprintf(dest,"%s",token);
qt_token );
} }
} }
} return token ? dest : NULL;
/* return the concatenated token */
return ptr_token;
} }
#ifndef __WIN__ #ifndef __WIN__
/* /*
Synopsis: Synopsis:
This function run scripts files on Linux and Netware This function run scripts files on Linux and Netware
......
...@@ -329,7 +329,7 @@ prepare stmt4 from ' show engine bdb logs '; ...@@ -329,7 +329,7 @@ prepare stmt4 from ' show engine bdb logs ';
execute stmt4; execute stmt4;
--enable_result_log --enable_result_log
prepare stmt4 from ' show full processlist '; prepare stmt4 from ' show full processlist ';
--replace_column 1 number 6 time --replace_column 1 number 6 time 3 localhost
execute stmt4; execute stmt4;
prepare stmt4 from ' show grants for user '; prepare stmt4 from ' show grants for user ';
--error 1295 --error 1295
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment