Commit 9326aa42 authored by unknown's avatar unknown

fixes in mysqltest and mysqlbinlog

trying to understand why --bootstrap option does not create tables
on disk, hope the problem will be fixed when I pull, if not will
debug, but need to commit in order to pull


client/mysqltest.c:
  added safe_connect() and chaned all calls to mysql_real_connect() to
  safe_connect()
mysql-test/install_test_db.sh:
  more diagnostic
sql/log_event.cc:
  fixed compile error in mysqlbinlog
parent e704dd72
...@@ -1096,6 +1096,25 @@ char* safe_get_param(char* str, char** arg, const char* msg) ...@@ -1096,6 +1096,25 @@ char* safe_get_param(char* str, char** arg, const char* msg)
DBUG_RETURN(str); DBUG_RETURN(str);
} }
int safe_connect(MYSQL* con, const char* host, const char* user,
const char* pass,
const char* db, int port, const char* sock)
{
int con_error = 1;
int i;
for (i = 0; i < MAX_CON_TRIES; ++i)
{
if(mysql_real_connect(con, host,user, pass,
db, port, sock, 0))
{
con_error = 0;
break;
}
sleep(CON_RETRY_SLEEP);
}
return con_error;
}
int do_connect(struct st_query* q) int do_connect(struct st_query* q)
{ {
...@@ -1104,7 +1123,7 @@ int do_connect(struct st_query* q) ...@@ -1104,7 +1123,7 @@ int do_connect(struct st_query* q)
char* p=q->first_argument; char* p=q->first_argument;
char buff[FN_REFLEN]; char buff[FN_REFLEN];
int con_port; int con_port;
int i, con_error; int con_error;
DBUG_ENTER("do_connect"); DBUG_ENTER("do_connect");
DBUG_PRINT("enter",("connect: %s",p)); DBUG_PRINT("enter",("connect: %s",p));
...@@ -1137,20 +1156,9 @@ int do_connect(struct st_query* q) ...@@ -1137,20 +1156,9 @@ int do_connect(struct st_query* q)
con_sock=fn_format(buff, con_sock, TMPDIR, "",0); con_sock=fn_format(buff, con_sock, TMPDIR, "",0);
if (!con_db[0]) if (!con_db[0])
con_db=db; con_db=db;
con_error = 1; if((con_error = safe_connect(&next_con->mysql, con_host,
for (i = 0; i < MAX_CON_TRIES; ++i)
{
if(mysql_real_connect(&next_con->mysql, con_host,
con_user, con_pass, con_user, con_pass,
con_db, con_port, con_sock, 0)) con_db, con_port, con_sock)))
{
con_error = 0;
break;
}
sleep(CON_RETRY_SLEEP);
}
if(con_error)
die("Could not open connection '%s': %s", con_name, die("Could not open connection '%s': %s", con_name,
mysql_error(&next_con->mysql)); mysql_error(&next_con->mysql));
...@@ -1950,9 +1958,8 @@ int main(int argc, char** argv) ...@@ -1950,9 +1958,8 @@ int main(int argc, char** argv)
if (!cur_con->name) if (!cur_con->name)
die("Out of memory"); die("Out of memory");
if (!mysql_real_connect(&cur_con->mysql, host, if (safe_connect(&cur_con->mysql, host,
user, pass, db, port, unix_sock, user, pass, db, port, unix_sock))
0))
die("Failed in mysql_real_connect(): %s", mysql_error(&cur_con->mysql)); die("Failed in mysql_real_connect(): %s", mysql_error(&cur_con->mysql));
while (!read_query(&q)) while (!read_query(&q))
......
...@@ -190,8 +190,11 @@ then ...@@ -190,8 +190,11 @@ then
c_c="$c_c comment='Column privileges';" c_c="$c_c comment='Column privileges';"
fi fi
if $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \ mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb --skip-gemini $EXTRA_ARG << END_OF_DATA --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb --skip-gemini $EXTRA_ARG"
echo "running $mysqld_boot"
if $mysqld_boot << END_OF_DATA
use mysql; use mysql;
$c_d $c_d
$i_d $i_d
...@@ -211,5 +214,6 @@ END_OF_DATA ...@@ -211,5 +214,6 @@ END_OF_DATA
then then
exit 0 exit 0
else else
echo "Error executing mysqld --boostrap"
exit 1 exit 1
fi fi
...@@ -30,6 +30,7 @@ static void pretty_print_str(FILE* file, char* str, int len) ...@@ -30,6 +30,7 @@ static void pretty_print_str(FILE* file, char* str, int len)
fputc('\'', file); fputc('\'', file);
while (str < end) while (str < end)
{ {
char c;
switch ((c=*str++)) { switch ((c=*str++)) {
case '\n': fprintf(file, "\\n"); break; case '\n': fprintf(file, "\\n"); break;
case '\r': fprintf(file, "\\r"); break; case '\r': fprintf(file, "\\r"); break;
......
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