Commit 86763e61 authored by brian@zim.tangent.org's avatar brian@zim.tangent.org

Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  zim.tangent.org:/home/brian/mysql/dep-5.1
parents af149459 faa1b429
......@@ -48,15 +48,19 @@ mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c \
$(top_srcdir)/mysys/my_vle.c \
$(top_srcdir)/mysys/base64.c
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
mysqlslap_LDADD = $(LDADD) $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS)
mysqlimport_LDADD = $(LDADD) $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
$(top_builddir)/mysys/libmysys.a
mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
$(top_builddir)/mysys/libmysys.a
mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix)
mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix)
mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix)
mysqlslap_SOURCES= mysqlslap.c $(top_srcdir)/mysys/my_lock.c \
$(top_srcdir)/mysys/my_alarm.c \
mysqlslap_SOURCES= mysqlslap.c \
$(yassl_dummy_link_fix)
mysqldump_SOURCES= mysqldump.c my_user.c $(yassl_dummy_link_fix)
mysqlimport_SOURCES= mysqlimport.c \
......
......@@ -516,7 +516,11 @@ pthread_handler_t worker_thread(void *arg)
{
int error;
char *raw_table_name= (char *)arg;
MYSQL *mysql;
MYSQL *mysql= 0;
if (mysql_thread_init())
goto error;
if (!(mysql= db_connect(current_host,current_db,current_user,opt_password)))
{
goto error;
......@@ -528,6 +532,9 @@ pthread_handler_t worker_thread(void *arg)
goto error;
}
/*
We are not currently catching the error here.
*/
if((error= write_to_table(raw_table_name, mysql)))
if (exitcode == 0)
exitcode= error;
......@@ -539,6 +546,8 @@ error:
pthread_mutex_lock(&counter_mutex);
counter--;
pthread_mutex_unlock(&counter_mutex);
my_thread_end();
return 0;
}
......
......@@ -76,6 +76,7 @@ TODO:
#define RAND_STRING_SIZE 126
#include "client_priv.h"
#include <my_pthread.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
......@@ -89,7 +90,6 @@ TODO:
#include <sys/wait.h>
#endif
#include <ctype.h>
#include <my_pthread.h>
#define MYSLAPLOCK "/myslaplock.lck"
#define MYSLAPLOCK_DIR "/tmp"
......@@ -170,6 +170,7 @@ typedef struct thread_context thread_context;
struct thread_context {
statement *stmt;
ulonglong limit;
bool thread;
};
typedef struct conclusions conclusions;
......@@ -974,6 +975,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
con.stmt= stmts;
con.limit= limit;
con.thread= opt_use_threads ? 1 :0;
lock_file= my_open(lock_file_str, O_CREAT|O_WRONLY|O_TRUNC, MYF(0));
......@@ -1096,8 +1098,8 @@ int
run_task(thread_context *con)
{
ulonglong counter= 0, queries;
File lock_file;
MYSQL mysql;
File lock_file= -1;
MYSQL *mysql;
MYSQL_RES *result;
MYSQL_ROW row;
statement *ptr;
......@@ -1105,19 +1107,25 @@ run_task(thread_context *con)
DBUG_ENTER("run_task");
DBUG_PRINT("info", ("task script \"%s\"", con->stmt->string));
mysql_init(&mysql);
if (!(mysql= mysql_init(NULL)))
goto end;
if (con->thread && mysql_thread_init())
goto end;
DBUG_PRINT("info", ("trying to connect to host %s as user %s", host, user));
lock_file= my_open(lock_file_str, O_RDWR, MYF(0));
my_lock(lock_file, F_RDLCK, 0, F_TO_EOF, MYF(0));
if (!opt_only_print)
{
if (!(mysql_real_connect(&mysql, host, user, opt_password,
"mysqlslap", opt_mysql_port, opt_mysql_unix_port,
0)))
if (!(mysql= mysql_real_connect(NULL, host, user, opt_password,
create_schema_string,
opt_mysql_port,
opt_mysql_unix_port,
0)))
{
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
exit(1);
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(mysql));
goto end;
}
}
DBUG_PRINT("info", ("connected."));
......@@ -1133,15 +1141,15 @@ limit_not_met:
}
else
{
if (mysql_real_query(&mysql, ptr->string, ptr->length))
if (mysql_real_query(mysql, ptr->string, ptr->length))
{
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
my_progname, (uint)ptr->length, ptr->string, mysql_error(&mysql));
exit(1);
my_progname, (uint)ptr->length, ptr->string, mysql_error(mysql));
goto end;
}
if (mysql_field_count(&mysql))
if (mysql_field_count(mysql))
{
result= mysql_store_result(&mysql);
result= mysql_store_result(mysql);
while ((row = mysql_fetch_row(result)))
counter++;
mysql_free_result(result);
......@@ -1150,18 +1158,25 @@ limit_not_met:
queries++;
if (con->limit && queries == con->limit)
DBUG_RETURN(0);
goto end;
}
if (con->limit && queries < con->limit)
goto limit_not_met;
my_lock(lock_file, F_UNLCK, 0, F_TO_EOF, MYF(0));
my_close(lock_file, MYF(0));
end:
if (lock_file != -1)
{
my_lock(lock_file, F_UNLCK, 0, F_TO_EOF, MYF(0));
my_close(lock_file, MYF(0));
}
if (!opt_only_print)
mysql_close(&mysql);
mysql_close(mysql);
if (con->thread)
my_thread_end();
DBUG_RETURN(0);
}
......
......@@ -6,20 +6,26 @@ Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup status Operation failed
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup status OK
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup status Operation failed
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
drop table t4;
restore table t4 from '../tmp';
Table Op Msg_type Msg_text
test.t4 restore status OK
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
select count(*) from t4;
count(*)
0
......@@ -28,15 +34,20 @@ insert into t1 values (23),(45),(67);
backup table t1 to '../tmp';
Table Op Msg_type Msg_text
test.t1 backup status OK
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
drop table t1;
restore table t1 from '../bogus';
Table Op Msg_type Msg_text
t1 restore error Failed copying .frm file
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
Error 29 File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X)
restore table t1 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
select n from t1;
n
23
......@@ -50,12 +61,16 @@ backup table t2,t3 to '../tmp';
Table Op Msg_type Msg_text
test.t2 backup status OK
test.t3 backup status OK
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
drop table t1,t2,t3;
restore table t1,t2,t3 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
test.t2 restore status OK
test.t3 restore status OK
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
select n from t1;
n
23
......@@ -75,10 +90,14 @@ drop table t1,t2,t3,t4;
restore table t1 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
rename table t1 to t5;
lock tables t5 write;
backup table t5 to '../tmp';
unlock tables;
Table Op Msg_type Msg_text
test.t5 backup status OK
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
drop table t5;
......@@ -5350,6 +5350,7 @@ restore:
RESTORE_SYM table_or_tables
{
Lex->sql_command = SQLCOM_RESTORE_TABLE;
WARN_DEPRECATED("RESTORE TABLE", "Command will be removed in next version.");
}
table_list FROM TEXT_STRING_sys
{
......@@ -5360,6 +5361,7 @@ backup:
BACKUP_SYM table_or_tables
{
Lex->sql_command = SQLCOM_BACKUP_TABLE;
WARN_DEPRECATED("BACKUP TABLE", "Command will be removed in next version.");
}
table_list TO_SYM TEXT_STRING_sys
{
......@@ -8666,7 +8668,8 @@ load: LOAD DATA_SYM
LOAD TABLE_SYM table_ident FROM MASTER_SYM
{
LEX *lex=Lex;
if (lex->sphead)
WARN_DEPRECATED("LOAD TABLE from MASTER", "Command will be removed in next version.");
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD TABLE");
YYABORT;
......
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