1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Merge with 4.0.8

BitKeeper/etc/logging_ok:
  auto-union
VC++Files/sql/mysqld.dsp:
  Auto merged
acinclude.m4:
  Auto merged
include/my_base.h:
  Auto merged
include/myisam.h:
  Auto merged
include/myisammrg.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
myisam/mi_check.c:
  Auto merged
myisam/mi_write.c:
  Auto merged
myisam/myisamdef.h:
  Auto merged
mysql-test/mysql-test-run.sh:
  Auto merged
mysql-test/r/case.result:
  Auto merged
mysql-test/r/distinct.result:
  Auto merged
mysql-test/r/fulltext.result:
  Auto merged
mysql-test/r/key_diff.result:
  Auto merged
mysql-test/r/multi_update.result:
  Auto merged
mysql-test/r/order_by.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/show_check.result:
  Auto merged
mysql-test/t/multi_update.test:
  Auto merged
mysql-test/t/rpl_log_pos.test:
  Auto merged
mysys/Makefile.am:
  Auto merged
scripts/Makefile.am:
  Auto merged
sql/field.cc:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/ha_myisammrg.cc:
  Auto merged
sql/ha_myisammrg.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_create.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/lex.h:
  Auto merged
sql/log.cc:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/repl_failsafe.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/slave.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_udf.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql-bench/crash-me.sh:
  Auto merged
sql-bench/server-cfg.sh:
  Auto merged
sql/share/english/errmsg.txt:
  Auto merged
sql/structs.h:
  Auto merged
This commit is contained in:
unknown
2003-01-03 00:04:33 +02:00
94 changed files with 2596 additions and 801 deletions

View File

@@ -507,6 +507,7 @@ check_connections(THD *thd)
{
vio_in_addr(net->vio,&thd->remote.sin_addr);
thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
thd->host[strnlen(thd->host, HOSTNAME_LENGTH)]= 0;
if (connect_errors > max_connect_errors)
return(ER_HOST_IS_BLOCKED);
}
@@ -523,6 +524,7 @@ check_connections(THD *thd)
thd->ip=0;
bzero((char*) &thd->remote,sizeof(struct sockaddr));
}
/* Ensure that wrong hostnames doesn't cause buffer overflows */
vio_keepalive(net->vio, TRUE);
ulong pkt_len=0;
@@ -753,7 +755,7 @@ pthread_handler_decl(handle_one_connection,arg)
goto end_thread;
}
if ((ulong) thd->variables.max_join_size == (ulonglong) HA_POS_ERROR)
if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
if (thd->client_capabilities & CLIENT_COMPRESS)
net->compress=1; // Use compression
@@ -829,7 +831,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
#endif
if ((ulong) thd->variables.max_join_size == (ulonglong) HA_POS_ERROR)
if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
thd->proc_info=0;
@@ -959,6 +961,12 @@ bool do_command(THD *thd)
vio_description(net->vio) ));
return TRUE;
}
else if (!packet_length)
{
send_error(net,net->last_errno,NullS);
net->error=0;
DBUG_RETURN(FALSE);
}
else
{
packet=(char*) net->read_pos;
@@ -1243,6 +1251,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
if (lower_case_table_names)
my_casedn_str(files_charset_info, db);
if (check_access(thd,DROP_ACL,db,0,1))
break;
if (thd->locked_tables || thd->active_transaction())
{
send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION);
@@ -1283,10 +1293,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (check_global_access(thd,RELOAD_ACL))
break;
mysql_log.write(thd,command,NullS);
if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0))
send_error(thd,0);
else
send_eof(thd);
/* error sending is deferred to reload_acl_and_cache */
reload_acl_and_cache(thd, options, (TABLE_LIST*) 0) ;
break;
}
case COM_SHUTDOWN:
@@ -1860,6 +1868,24 @@ mysql_execute_command(THD *thd)
break;
}
case SQLCOM_SLAVE_STOP:
/*
If the client thread has locked tables, a deadlock is possible.
Assume that
- the client thread does LOCK TABLE t READ.
- then the master updates t.
- then the SQL slave thread wants to update t,
so it waits for the client thread because t is locked by it.
- then the client thread does SLAVE STOP.
SLAVE STOP waits for the SQL slave thread to terminate its
update t, which waits for the client thread because t is locked by it.
To prevent that, refuse SLAVE STOP if the
client thread has locked tables
*/
if (thd->locked_tables || thd->active_transaction())
{
send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION);
break;
}
{
LOCK_ACTIVE_MI;
stop_slave(thd,active_mi,1/* net report*/);
@@ -2653,10 +2679,8 @@ mysql_execute_command(THD *thd)
case SQLCOM_RESET:
if (check_global_access(thd,RELOAD_ACL) || check_db_used(thd, tables))
goto error;
if (reload_acl_and_cache(thd, lex->type, tables))
send_error(thd,0);
else
send_ok(thd);
/* error sending is deferred to reload_acl_and_cache */
reload_acl_and_cache(thd, lex->type, tables) ;
break;
case SQLCOM_KILL:
kill_one_thread(thd,lex->thread_id);
@@ -3669,10 +3693,15 @@ void add_join_natural(TABLE_LIST *a,TABLE_LIST *b)
b->natural_join=a;
}
/*
Reload/resets privileges and the different caches
*/
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
{
bool result=0;
bool error_already_sent=0;
select_errors=0; /* Write if more errors */
if (options & REFRESH_GRANT)
{
@@ -3730,11 +3759,29 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
{
LOCK_ACTIVE_MI;
if (reset_slave(thd, active_mi))
{
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;
}
if (options & REFRESH_USER_RESOURCES)
reset_mqh(thd,(LEX_USER *) NULL);
if (thd && !error_already_sent)
{
if (result)
send_error(&thd->net,0);
else
send_ok(&thd->net);
}
return result;
}