Commit 21544d63 authored by igor@rurik.mysql.com's avatar igor@rurik.mysql.com

Merge rurik.mysql.com:/home/igor/mysql-4.1

into rurik.mysql.com:/home/igor/dev/mysql-4.1-0
parents 4352f12c e9c2a370
...@@ -607,3 +607,7 @@ vio/test-ssl ...@@ -607,3 +607,7 @@ vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
client_test
thread_test
select_test
insert_test
...@@ -520,7 +520,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -520,7 +520,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
case ADMIN_FLUSH_PRIVILEGES: case ADMIN_FLUSH_PRIVILEGES:
case ADMIN_RELOAD: case ADMIN_RELOAD:
if (mysql_refresh(mysql,REFRESH_GRANT) < 0) if (mysql_query(mysql,"flush privileges"))
{ {
my_printf_error(0,"reload failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"reload failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
...@@ -531,7 +531,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -531,7 +531,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_refresh(mysql, if (mysql_refresh(mysql,
(uint) ~(REFRESH_GRANT | REFRESH_STATUS | (uint) ~(REFRESH_GRANT | REFRESH_STATUS |
REFRESH_READ_LOCK | REFRESH_SLAVE | REFRESH_READ_LOCK | REFRESH_SLAVE |
REFRESH_MASTER)) < 0) REFRESH_MASTER)))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
...@@ -539,7 +539,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -539,7 +539,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
break; break;
case ADMIN_FLUSH_THREADS: case ADMIN_FLUSH_THREADS:
if (mysql_refresh(mysql,(uint) REFRESH_THREADS) < 0) if (mysql_refresh(mysql,(uint) REFRESH_THREADS))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
...@@ -726,7 +726,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -726,7 +726,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
case ADMIN_FLUSH_HOSTS: case ADMIN_FLUSH_HOSTS:
{ {
if (mysql_refresh(mysql,REFRESH_HOSTS)) if (mysql_query(mysql,"flush hosts"))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
...@@ -736,7 +736,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -736,7 +736,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
case ADMIN_FLUSH_TABLES: case ADMIN_FLUSH_TABLES:
{ {
if (mysql_refresh(mysql,REFRESH_TABLES)) if (mysql_query(mysql,"flush tables"))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
...@@ -746,7 +746,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -746,7 +746,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
case ADMIN_FLUSH_STATUS: case ADMIN_FLUSH_STATUS:
{ {
if (mysql_refresh(mysql,REFRESH_STATUS)) if (mysql_query(mysql,"flush status"))
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
...@@ -793,7 +793,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -793,7 +793,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
case ADMIN_START_SLAVE: case ADMIN_START_SLAVE:
if (mysql_query(mysql, "SLAVE START")) if (mysql_query(mysql, "START SLAVE"))
{ {
my_printf_error(0, "Error starting slave: %s", MYF(ME_BELL), my_printf_error(0, "Error starting slave: %s", MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
...@@ -803,7 +803,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -803,7 +803,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
puts("Slave started"); puts("Slave started");
break; break;
case ADMIN_STOP_SLAVE: case ADMIN_STOP_SLAVE:
if (mysql_query(mysql, "SLAVE STOP")) if (mysql_query(mysql, "STOP SLAVE"))
{ {
my_printf_error(0, "Error stopping slave: %s", MYF(ME_BELL), my_printf_error(0, "Error stopping slave: %s", MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
......
...@@ -2272,7 +2272,7 @@ else ...@@ -2272,7 +2272,7 @@ else
CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'` CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
fi fi
CHARSETS="$DEFAULT_CHARSET $CHARSETS" CHARSETS="$default_charset $CHARSETS"
use_mb="no" use_mb="no"
......
...@@ -625,7 +625,9 @@ report_stats () { ...@@ -625,7 +625,9 @@ report_stats () {
$RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp $RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
# Remove some non fatal warnings from the log files # Remove some non fatal warnings from the log files
$SED -e 's!Warning: Table:.* on delete!!g' \ $SED -e 's!Warning: Table:.* on delete!!g' \
$MY_LOG_DIR/*.err > $MY_LOG_DIR/warnings.tmp $MY_LOG_DIR/*.err \
| $SED -e 's!Warning: Table:.* on rename!!g' \
> $MY_LOG_DIR/warnings.tmp
found_error=0 found_error=0
# Find errors # Find errors
......
...@@ -23,7 +23,7 @@ Warnings: ...@@ -23,7 +23,7 @@ Warnings:
Note 1051 Unknown table 't1' Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2' Note 1051 Unknown table 't2'
create table t1 (b char(0) not null, index(b)); create table t1 (b char(0) not null, index(b));
The used table handler can't index column 'b' The used storage engine can't index column 'b'
create table t1 (a int not null auto_increment,primary key (a)) type=heap; create table t1 (a int not null auto_increment,primary key (a)) type=heap;
create table t1 (a int not null,b text) type=heap; create table t1 (a int not null,b text) type=heap;
The used table type doesn't support BLOB/TEXT columns The used table type doesn't support BLOB/TEXT columns
...@@ -269,6 +269,8 @@ SELECT @@table_type; ...@@ -269,6 +269,8 @@ SELECT @@table_type;
@@table_type @@table_type
GEMINI GEMINI
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
Warnings:
Warning 1259 Using storage engine MYISAM for table 't1'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (a int);
insert into t1 values (10);
create table t2 (a int);
create table t3 (a int) type=merge union(t1);
create table t4 (a int);
insert into t4 select * from t3;
rename table t1 to t5, t2 to t1;
flush no_write_to_binlog tables;
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 4 Start 1 4 Server ver: 4.1.1-alpha-debug-log, Binlog ver: 3
master-bin.000001 79 Query 1 79 use `test`; create table t1 (a int)
master-bin.000001 137 Query 1 137 use `test`; insert into t1 values (10)
master-bin.000001 198 Query 1 198 use `test`; create table t2 (a int)
master-bin.000001 256 Query 1 256 use `test`; create table t3 (a int) type=merge union(t1)
master-bin.000001 335 Query 1 335 use `test`; create table t4 (a int)
master-bin.000001 393 Query 1 393 use `test`; insert into t4 select * from t3
master-bin.000001 459 Query 1 459 use `test`; rename table t1 to t5, t2 to t1
select * from t3;
a
flush tables;
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 4 Start 1 4 Server ver: 4.1.1-alpha-debug-log, Binlog ver: 3
master-bin.000001 79 Query 1 79 use `test`; create table t1 (a int)
master-bin.000001 137 Query 1 137 use `test`; insert into t1 values (10)
master-bin.000001 198 Query 1 198 use `test`; create table t2 (a int)
master-bin.000001 256 Query 1 256 use `test`; create table t3 (a int) type=merge union(t1)
master-bin.000001 335 Query 1 335 use `test`; create table t4 (a int)
master-bin.000001 393 Query 1 393 use `test`; insert into t4 select * from t3
master-bin.000001 459 Query 1 459 use `test`; rename table t1 to t5, t2 to t1
master-bin.000001 525 Query 1 525 use `test`; flush tables
select * from t3;
a
...@@ -347,7 +347,7 @@ a 1 ...@@ -347,7 +347,7 @@ a 1
hello 1 hello 1
drop table t1; drop table t1;
create table t1 (a text, key (a(300))); create table t1 (a text, key (a(300)));
Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the table handler doesn't support unique sub keys Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the store engine doesn't support unique sub keys
create table t1 (a text, key (a(255))); create table t1 (a text, key (a(255)));
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
......
#
# Test of replicating FLUSH TABLES to make
# RENAME TABLE work with MERGE tables on the slave.
# Test of FLUSH NO_WRITE_TO_BINLOG by the way.
#
source include/master-slave.inc;
create table t1 (a int);
insert into t1 values (10);
create table t2 (a int);
create table t3 (a int) type=merge union(t1);
create table t4 (a int);
# We force the slave to open t3 (because we want to try confusing him) with this :
insert into t4 select * from t3;
rename table t1 to t5, t2 to t1;
# RENAME may have confused the master (this is a known bug): so FLUSH tables,
# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
flush no_write_to_binlog tables;
# Check that it's not in the binlog.
show binlog events;
# Check that the master is not confused.
select * from t3;
# This FLUSH should go into the binlog to not confuse the slave.
flush tables;
# Check that it's in the binlog.
show binlog events;
save_master_pos;
connection slave;
sync_with_master;
# Check that the slave is not confused.
select * from t3;
# Note that all this confusion may cause warnings 'table xx is open on rename'
# in the .err files; these are not fatal and are not reported by mysql-test-run.
...@@ -412,6 +412,7 @@ static SYMBOL symbols[] = { ...@@ -412,6 +412,7 @@ static SYMBOL symbols[] = {
{ "WRITE", SYM(WRITE_SYM),0,0}, { "WRITE", SYM(WRITE_SYM),0,0},
{ "WHEN", SYM(WHEN_SYM),0,0}, { "WHEN", SYM(WHEN_SYM),0,0},
{ "WHERE", SYM(WHERE),0,0}, { "WHERE", SYM(WHERE),0,0},
{ "NO_WRITE_TO_BINLOG", SYM(NO_WRITE_TO_BINLOG),0,0},
{ "XOR", SYM(XOR),0,0}, { "XOR", SYM(XOR),0,0},
{ "X509", SYM(X509_SYM),0,0}, { "X509", SYM(X509_SYM),0,0},
{ "YEAR", SYM(YEAR_SYM),0,0}, { "YEAR", SYM(YEAR_SYM),0,0},
......
...@@ -369,7 +369,8 @@ bool do_command(THD *thd); ...@@ -369,7 +369,8 @@ bool do_command(THD *thd);
bool dispatch_command(enum enum_server_command command, THD *thd, bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length); char* packet, uint packet_length);
bool check_stack_overrun(THD *thd,char *dummy); bool check_stack_overrun(THD *thd,char *dummy);
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables); bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
bool *write_to_binlog);
void table_cache_init(void); void table_cache_init(void);
void table_cache_free(void); void table_cache_free(void);
uint cached_tables(void); uint cached_tables(void);
......
...@@ -1496,7 +1496,7 @@ static void check_data_home(const char *path) ...@@ -1496,7 +1496,7 @@ static void check_data_home(const char *path)
static void sig_reload(int signo) static void sig_reload(int signo)
{ {
// Flush everything // Flush everything
reload_acl_and_cache((THD*) 0,REFRESH_LOG, (TABLE_LIST*) 0); reload_acl_and_cache((THD*) 0,REFRESH_LOG, (TABLE_LIST*) 0, NULL);
signal(signo, SIG_ACK); signal(signo, SIG_ACK);
} }
...@@ -1832,7 +1832,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) ...@@ -1832,7 +1832,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST | (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
REFRESH_STATUS | REFRESH_GRANT | REFRESH_STATUS | REFRESH_GRANT |
REFRESH_THREADS | REFRESH_HOSTS), REFRESH_THREADS | REFRESH_HOSTS),
(TABLE_LIST*) 0); // Flush logs (TABLE_LIST*) 0, NULL); // Flush logs
mysql_print_status((THD*) 0); // Send debug some info mysql_print_status((THD*) 0); // Send debug some info
} }
break; break;
......
...@@ -481,7 +481,7 @@ typedef struct st_lex ...@@ -481,7 +481,7 @@ typedef struct st_lex
uint fk_delete_opt, fk_update_opt, fk_match_option; uint fk_delete_opt, fk_update_opt, fk_match_option;
uint param_count; uint param_count;
bool drop_primary, drop_if_exists, drop_temporary, local_file; bool drop_primary, drop_if_exists, drop_temporary, local_file;
bool in_comment, ignore_space, verbose, simple_alter; bool in_comment, ignore_space, verbose, simple_alter, no_write_to_binlog;
bool derived_tables, describe; bool derived_tables, describe;
bool safe_to_cache_query; bool safe_to_cache_query;
uint slave_thd_opt; uint slave_thd_opt;
......
...@@ -1391,8 +1391,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1391,8 +1391,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (check_global_access(thd,RELOAD_ACL)) if (check_global_access(thd,RELOAD_ACL))
break; break;
mysql_log.write(thd,command,NullS); mysql_log.write(thd,command,NullS);
/* error sending is deferred to reload_acl_and_cache */ if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0, NULL))
reload_acl_and_cache(thd, options, (TABLE_LIST*) 0) ; send_error(thd, 0);
else
send_ok(thd);
break; break;
} }
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
...@@ -2164,6 +2166,16 @@ mysql_execute_command(THD *thd) ...@@ -2164,6 +2166,16 @@ mysql_execute_command(THD *thd)
check_table_access(thd,SELECT_ACL | INSERT_ACL, tables)) check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
res = mysql_repair_table(thd, tables, &lex->check_opt); res = mysql_repair_table(thd, tables, &lex->check_opt);
/* ! we write after unlocking the table */
if (!res && !lex->no_write_to_binlog)
{
mysql_update_log.write(thd, thd->query, thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
}
}
break; break;
} }
case SQLCOM_CHECK: case SQLCOM_CHECK:
...@@ -2180,6 +2192,16 @@ mysql_execute_command(THD *thd) ...@@ -2180,6 +2192,16 @@ mysql_execute_command(THD *thd)
check_table_access(thd,SELECT_ACL | INSERT_ACL, tables)) check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
res = mysql_analyze_table(thd, tables, &lex->check_opt); res = mysql_analyze_table(thd, tables, &lex->check_opt);
/* ! we write after unlocking the table */
if (!res && !lex->no_write_to_binlog)
{
mysql_update_log.write(thd, thd->query, thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
}
}
break; break;
} }
...@@ -2209,6 +2231,16 @@ mysql_execute_command(THD *thd) ...@@ -2209,6 +2231,16 @@ mysql_execute_command(THD *thd)
} }
else else
res = mysql_optimize_table(thd, tables, &lex->check_opt); res = mysql_optimize_table(thd, tables, &lex->check_opt);
/* ! we write after unlocking the table */
if (!res && !lex->no_write_to_binlog)
{
mysql_update_log.write(thd, thd->query, thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
}
}
break; break;
} }
case SQLCOM_UPDATE: case SQLCOM_UPDATE:
...@@ -2894,13 +2926,42 @@ mysql_execute_command(THD *thd) ...@@ -2894,13 +2926,42 @@ mysql_execute_command(THD *thd)
} }
break; break;
} }
case SQLCOM_FLUSH:
case SQLCOM_RESET: case SQLCOM_RESET:
/*
RESET commands are never written to the binary log, so we have to
initialize this variable because RESET shares the same code as FLUSH
*/
lex->no_write_to_binlog= 1;
case SQLCOM_FLUSH:
{
if (check_global_access(thd,RELOAD_ACL) || check_db_used(thd, tables)) if (check_global_access(thd,RELOAD_ACL) || check_db_used(thd, tables))
goto error; goto error;
/* error sending is deferred to reload_acl_and_cache */ /*
reload_acl_and_cache(thd, lex->type, tables); reload_acl_and_cache() will tell us if we are allowed to write to the
binlog or not.
*/
bool write_to_binlog;
if (reload_acl_and_cache(thd, lex->type, tables, &write_to_binlog))
send_error(thd, 0);
else
{
/*
We WANT to write and we CAN write.
! we write after unlocking the table.
*/
if (!lex->no_write_to_binlog && write_to_binlog)
{
mysql_update_log.write(thd, thd->query, thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
}
}
send_ok(thd);
}
break; break;
}
case SQLCOM_KILL: case SQLCOM_KILL:
kill_one_thread(thd,lex->thread_id); kill_one_thread(thd,lex->thread_id);
break; break;
...@@ -3957,14 +4018,31 @@ void add_join_natural(TABLE_LIST *a,TABLE_LIST *b) ...@@ -3957,14 +4018,31 @@ void add_join_natural(TABLE_LIST *a,TABLE_LIST *b)
/* /*
Reload/resets privileges and the different caches Reload/resets privileges and the different caches.
SYNOPSIS
reload_acl_and_cache()
thd Thread handler
options What should be reset/reloaded (tables, privileges,
slave...)
tables Tables to flush (if any)
write_to_binlog Depending on 'options', it may be very bad to write the
query to the binlog (e.g. FLUSH SLAVE); this is a
pointer where, if it is not NULL, reload_acl_and_cache()
will put 0 if it thinks we really should not write to
the binlog. Otherwise it will put 1.
RETURN
0 ok
!=0 error
*/ */
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
bool *write_to_binlog)
{ {
bool result=0; bool result=0;
bool error_already_sent=0;
select_errors=0; /* Write if more errors */ select_errors=0; /* Write if more errors */
bool tmp_write_to_binlog= 1;
if (options & REFRESH_GRANT) if (options & REFRESH_GRANT)
{ {
acl_reload(thd); acl_reload(thd);
...@@ -3974,6 +4052,12 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) ...@@ -3974,6 +4052,12 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
} }
if (options & REFRESH_LOG) if (options & REFRESH_LOG)
{ {
/*
Writing this command to the binlog may result in infinite loops when doing
mysqlbinlog|mysql, and anyway it does not really make sense to log it
automatically (would cause more trouble to users than it would help them)
*/
tmp_write_to_binlog= 0;
mysql_log.new_file(1); mysql_log.new_file(1);
mysql_update_log.new_file(1); mysql_update_log.new_file(1);
mysql_bin_log.new_file(1); mysql_bin_log.new_file(1);
...@@ -4002,10 +4086,16 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) ...@@ -4002,10 +4086,16 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
query_cache.flush(); // RESET QUERY CACHE query_cache.flush(); // RESET QUERY CACHE
} }
#endif /*HAVE_QUERY_CACHE*/ #endif /*HAVE_QUERY_CACHE*/
/*
Note that if REFRESH_READ_LOCK bit is set then REFRESH_TABLES is set too
(see sql_yacc.yy)
*/
if (options & (REFRESH_TABLES | REFRESH_READ_LOCK)) if (options & (REFRESH_TABLES | REFRESH_READ_LOCK))
{ {
if ((options & REFRESH_READ_LOCK) && thd) if ((options & REFRESH_READ_LOCK) && thd)
{ {
// writing to the binlog could cause deadlocks, as we don't log UNLOCK TABLES
tmp_write_to_binlog= 0;
if (lock_global_read_lock(thd)) if (lock_global_read_lock(thd))
return 1; return 1;
} }
...@@ -4019,8 +4109,11 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) ...@@ -4019,8 +4109,11 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
flush_thread_cache(); flush_thread_cache();
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if (options & REFRESH_MASTER) if (options & REFRESH_MASTER)
{
tmp_write_to_binlog= 0;
if (reset_master(thd)) if (reset_master(thd))
result=1; result=1;
}
#endif #endif
#ifdef OPENSSL #ifdef OPENSSL
if (options & REFRESH_DES_KEY_FILE) if (options & REFRESH_DES_KEY_FILE)
...@@ -4032,32 +4125,17 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) ...@@ -4032,32 +4125,17 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if (options & REFRESH_SLAVE) if (options & REFRESH_SLAVE)
{ {
tmp_write_to_binlog= 0;
LOCK_ACTIVE_MI; LOCK_ACTIVE_MI;
if (reset_slave(thd, active_mi)) if (reset_slave(thd, active_mi))
{
result=1; result=1;
/*
reset_slave() sends error itself.
If it didn't, one would either change reset_slave()'s prototype, to
pass *errorcode and *errmsg to it when it's called or
change reset_slave to use my_error() to register the error.
*/
error_already_sent=1;
}
UNLOCK_ACTIVE_MI; UNLOCK_ACTIVE_MI;
} }
#endif #endif
if (options & REFRESH_USER_RESOURCES) if (options & REFRESH_USER_RESOURCES)
reset_mqh(thd,(LEX_USER *) NULL); reset_mqh(thd,(LEX_USER *) NULL);
if (write_to_binlog)
if (thd && !error_already_sent) *write_to_binlog= tmp_write_to_binlog;
{
if (result)
send_error(thd,0);
else
send_ok(thd);
}
return result; return result;
} }
......
...@@ -746,16 +746,9 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) ...@@ -746,16 +746,9 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
thd Thread handler thd Thread handler
mi Master info for the slave mi Master info for the slave
NOTES
We don't send ok in this functions as this is called from
reload_acl_and_cache() which may have done other tasks, which may
have failed for which we want to send and error.
RETURN RETURN
0 ok 0 ok
1 error 1 error
In this case error is sent to the client with send_error()
*/ */
...@@ -804,8 +797,8 @@ int reset_slave(THD *thd, MASTER_INFO* mi) ...@@ -804,8 +797,8 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
err: err:
unlock_slave_threads(mi); unlock_slave_threads(mi);
if (thd && error) if (error)
send_error(thd, sql_errno, errmsg); my_error(sql_errno, MYF(0), errmsg);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -3436,7 +3436,7 @@ static void update_depend_map(JOIN *join) ...@@ -3436,7 +3436,7 @@ static void update_depend_map(JOIN *join)
uint i; uint i;
for (i=0 ; i < ref->key_parts ; i++,item++) for (i=0 ; i < ref->key_parts ; i++,item++)
depend_map|=(*item)->used_tables(); depend_map|=(*item)->used_tables();
ref->depend_map=depend_map & OUTER_REF_TABLE_BIT; ref->depend_map=depend_map & ~OUTER_REF_TABLE_BIT;
depend_map&= ~OUTER_REF_TABLE_BIT; depend_map&= ~OUTER_REF_TABLE_BIT;
for (JOIN_TAB **tab=join->map2table; for (JOIN_TAB **tab=join->map2table;
depend_map ; depend_map ;
......
...@@ -381,6 +381,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -381,6 +381,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token WHERE %token WHERE
%token WITH %token WITH
%token WRITE_SYM %token WRITE_SYM
%token NO_WRITE_TO_BINLOG
%token X509_SYM %token X509_SYM
%token XOR %token XOR
%token COMPRESSED_SYM %token COMPRESSED_SYM
...@@ -582,7 +583,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -582,7 +583,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <num> %type <num>
type int_type real_type order_dir opt_field_spec lock_option type int_type real_type order_dir opt_field_spec lock_option
udf_type if_exists opt_local opt_table_options table_options udf_type if_exists opt_local opt_table_options table_options
table_option opt_if_not_exists opt_var_type opt_var_ident_type table_option opt_if_not_exists opt_no_write_to_binlog opt_var_type opt_var_ident_type
delete_option opt_temporary all_or_any opt_distinct delete_option opt_temporary all_or_any opt_distinct
%type <ulong_num> %type <ulong_num>
...@@ -1718,10 +1719,11 @@ backup: ...@@ -1718,10 +1719,11 @@ backup:
}; };
repair: repair:
REPAIR table_or_tables REPAIR opt_no_write_to_binlog table_or_tables
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command = SQLCOM_REPAIR; lex->sql_command = SQLCOM_REPAIR;
lex->no_write_to_binlog= $2;
lex->check_opt.init(); lex->check_opt.init();
} }
table_list opt_mi_repair_type table_list opt_mi_repair_type
...@@ -1742,10 +1744,11 @@ mi_repair_type: ...@@ -1742,10 +1744,11 @@ mi_repair_type:
| USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; }; | USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; };
analyze: analyze:
ANALYZE_SYM table_or_tables ANALYZE_SYM opt_no_write_to_binlog table_or_tables
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command = SQLCOM_ANALYZE; lex->sql_command = SQLCOM_ANALYZE;
lex->no_write_to_binlog= $2;
lex->check_opt.init(); lex->check_opt.init();
} }
table_list opt_mi_check_type table_list opt_mi_check_type
...@@ -1779,16 +1782,23 @@ mi_check_type: ...@@ -1779,16 +1782,23 @@ mi_check_type:
| CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; }; | CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; };
optimize: optimize:
OPTIMIZE table_or_tables OPTIMIZE opt_no_write_to_binlog table_or_tables
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command = SQLCOM_OPTIMIZE; lex->sql_command = SQLCOM_OPTIMIZE;
lex->no_write_to_binlog= $2;
lex->check_opt.init(); lex->check_opt.init();
} }
table_list opt_mi_check_type table_list opt_mi_check_type
{} {}
; ;
opt_no_write_to_binlog:
/* empty */ { $$= 0; }
| NO_WRITE_TO_BINLOG { $$= 1; }
| LOCAL_SYM { $$= 1; }
;
rename: rename:
RENAME table_or_tables RENAME table_or_tables
{ {
...@@ -3738,10 +3748,11 @@ opt_describe_column: ...@@ -3738,10 +3748,11 @@ opt_describe_column:
/* flush things */ /* flush things */
flush: flush:
FLUSH_SYM FLUSH_SYM opt_no_write_to_binlog
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command= SQLCOM_FLUSH; lex->type=0; lex->sql_command= SQLCOM_FLUSH; lex->type=0;
lex->no_write_to_binlog= $2;
} }
flush_options flush_options
{} {}
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Implemention of my_strtoll(): Converting a string to a 64 bit integer. # Implemention of my_strtoll(): Converting a string to a 64 bit integer.
# For documentation, check my_strtoll.c
.file "my_strtoll10-x86.s" .file "my_strtoll10-x86.s"
.version "01.01" .version "01.01"
...@@ -62,7 +63,6 @@ my_strtoll10: ...@@ -62,7 +63,6 @@ my_strtoll10:
movl 8(%ebp),%esi # esi= nptr movl 8(%ebp),%esi # esi= nptr
movl 16(%ebp),%ecx # ecx= error (Will be overwritten later) movl 16(%ebp),%ecx # ecx= error (Will be overwritten later)
movl 12(%ebp),%eax # eax= endptr movl 12(%ebp),%eax # eax= endptr
cld # Move forward in esi
cmpl $0,%eax # if (endptr) cmpl $0,%eax # if (endptr)
je .L110 je .L110
...@@ -72,7 +72,8 @@ my_strtoll10: ...@@ -72,7 +72,8 @@ my_strtoll10:
.L100: .L100:
cmpl %ebx,%esi cmpl %ebx,%esi
je .Lno_conv je .Lno_conv
lodsb # al= next byte movb (%esi), %al # al= next byte
incl %esi
cmpb $32,%al # Skip space cmpb $32,%al # Skip space
je .L100 je .L100
cmpb $9,%al # Skip tab cmpb $9,%al # Skip tab
...@@ -86,7 +87,8 @@ my_strtoll10: ...@@ -86,7 +87,8 @@ my_strtoll10:
movl %edi,12(%ebp) # endptr= &dummy, for easier end check movl %edi,12(%ebp) # endptr= &dummy, for easier end check
.p2align 4,,7 .p2align 4,,7
.L120: .L120:
lodsb # al= next byte movb (%esi), %al # al= next byte
incl %esi
cmpb $32,%al cmpb $32,%al
je .L120 je .L120
cmpb $9,%al cmpb $9,%al
...@@ -120,21 +122,23 @@ my_strtoll10: ...@@ -120,21 +122,23 @@ my_strtoll10:
.L460: .L460:
cmpl %ebx,%esi # Check if overflow cmpl %ebx,%esi # Check if overflow
je .Lno_conv je .Lno_conv
lodsb # al= next byte after sign movb (%esi), %al # al= next byte after sign
incl %esi
# Remove pre zero to be able to handle a lot of pre-zero # Remove pre zero to be able to handle a lot of pre-zero
.L462: .L462:
cmpb $48,%al cmpb $48,%al
jne .L475 # Number doesn't start with 0 jne .L475 # Number doesn't start with 0
movl %esi, %edi decl %esi
.p2align 4,,7 .p2align 4,,7
.L481: # Skip pre zeros
# Skip pre zeros
.L481:
incl %esi # Skip processed byte
cmpl %ebx,%esi cmpl %ebx,%esi
je .Lms_return_zero je .Lms_return_zero
scasb cmpb (%esi),%al # Test if next byte is also zero
je .L481 je .L481
movl %edi, %esi
decl %esi # Point to last non '0' digit
leal 9(%esi),%ecx # ecx = end-of-current-part leal 9(%esi),%ecx # ecx = end-of-current-part
xorl %edi,%edi # Store first 9 digits in edi xorl %edi,%edi # Store first 9 digits in edi
jmp .L482 jmp .L482
...@@ -158,7 +162,8 @@ my_strtoll10: ...@@ -158,7 +162,8 @@ my_strtoll10:
.p2align 4,,7 .p2align 4,,7
.L488: .L488:
lodsb # al= next byte movb (%esi), %al # al= next byte
incl %esi
addb $-48,%al addb $-48,%al
cmpb $9,%al cmpb $9,%al
ja .Lend_i_dec_esi ja .Lend_i_dec_esi
...@@ -187,7 +192,8 @@ my_strtoll10: ...@@ -187,7 +192,8 @@ my_strtoll10:
.p2align 4,,7 .p2align 4,,7
.L498: .L498:
lodsb # al= next byte movb (%esi), %al # al= next byte
incl %esi
addb $-48,%al addb $-48,%al
cmpb $9,%al cmpb $9,%al
ja .Lend_i_and_j_decl_esi ja .Lend_i_and_j_decl_esi
...@@ -299,7 +305,7 @@ my_strtoll10: ...@@ -299,7 +305,7 @@ my_strtoll10:
cmpl $0,-20(%ebp) cmpl $0,-20(%ebp)
je .Lreturn_save_endptr # Positive number je .Lreturn_save_endptr # Positive number
negl %eax negl %eax
cltd # Negetive result in edx:eax cltd # Neg result in edx:eax
jmp .Lreturn_save_endptr jmp .Lreturn_save_endptr
# Return value (%ebp-8) * lfactor[(uint) (edx-start)] + edi # Return value (%ebp-8) * lfactor[(uint) (edx-start)] + edi
......
...@@ -33,7 +33,7 @@ static unsigned long lfactor[9]= ...@@ -33,7 +33,7 @@ static unsigned long lfactor[9]=
Convert a string to an to unsigned long long integer value Convert a string to an to unsigned long long integer value
SYNOPSYS SYNOPSYS
str2ull10(char *nptr, char **enptr, *long error) my_strtoll10()
nptr in pointer to the string to be converted nptr in pointer to the string to be converted
endptr in/out pointer to the end of the string/ endptr in/out pointer to the end of the string/
pointer to the stop character pointer to the stop character
......
...@@ -26,7 +26,7 @@ EXTRA_DIST = auto_increment.res auto_increment.tst \ ...@@ -26,7 +26,7 @@ EXTRA_DIST = auto_increment.res auto_increment.tst \
pmail.pl mail_to_db.pl table_types.pl \ pmail.pl mail_to_db.pl table_types.pl \
udf_test udf_test.res myisam-big-rows.tst udf_test udf_test.res myisam-big-rows.tst
noinst_PROGRAMS = insert_test select_test thread_test noinst_PROGRAMS = insert_test select_test thread_test client_test
# #
# C Test for 4.1 protocol # C Test for 4.1 protocol
...@@ -34,13 +34,15 @@ noinst_PROGRAMS = insert_test select_test thread_test ...@@ -34,13 +34,15 @@ noinst_PROGRAMS = insert_test select_test thread_test
INCLUDES = -I$(top_srcdir)/include $(openssl_includes) INCLUDES = -I$(top_srcdir)/include $(openssl_includes)
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la
noinst_PROGRAMS = client_test
client_test_LDADD= $(LDADD) $(CXXLDFLAGS) client_test_LDADD= $(LDADD) $(CXXLDFLAGS)
client_test_SOURCES= client_test.c client_test_SOURCES= client_test.c
client_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) client_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
# Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK
thread_test.o: thread_test.c thread_test.o: thread_test.c
$(COMPILE) -c @MT_INCLUDES@ $(INCLUDES) $< $(COMPILE) -c @MT_INCLUDES@ $(INCLUDES) $<
......
...@@ -39,9 +39,9 @@ static char *database,*host,*user,*password,*unix_socket,*query; ...@@ -39,9 +39,9 @@ static char *database,*host,*user,*password,*unix_socket,*query;
uint tcp_port; uint tcp_port;
#ifndef __WIN__ #ifndef __WIN__
void *test_thread(void *arg) void *test_thread(void *arg __attribute__((unused)))
#else #else
unsigned __stdcall test_thread(void *arg) unsigned __stdcall test_thread(void *arg __attribute__((unused)))
#endif #endif
{ {
MYSQL *mysql; MYSQL *mysql;
...@@ -186,7 +186,8 @@ int main(int argc, char **argv) ...@@ -186,7 +186,8 @@ int main(int argc, char **argv)
{ {
pthread_t tid; pthread_t tid;
pthread_attr_t thr_attr; pthread_attr_t thr_attr;
int i,error; uint i;
int error;
MY_INIT(argv[0]); MY_INIT(argv[0]);
get_options(argc,argv); get_options(argc,argv);
......
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