mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
New SET syntax & system variables.
Made a some new buffers thread specific and changeable. Resize of key_buffer. AUTO_COMMIT -> AUTOCOMMIT Fixed mutex bug in DROP DATABASE Fixed bug when using auto_increment as second part of a key where first part could include NULL. Split handler->extra() to extra() and extra_opt() to be able to support thread specific buffers. Don't write message to error log when slave reconnects becasue of timeout. Fixed possible update problem when using DELETE/UPDATE on small tables (In some cases we used index even if table scanning would be better) A lot of minior code cleanups BitKeeper/deleted/.del-net.c~ef21d6402bb882f9: Delete: libmysql/net.c BitKeeper/etc/ignore: added libmysql/net.c Docs/manual.texi: New SET syntax & system variables. client/client_priv.h: moved order of include files client/mysql.cc: Removed compiler warning client/mysqladmin.c: Use new SHOW GLOBAL syntax (if server supports it) configure.in: version change include/Makefile.am: indentation cleanup include/my_getopt.h: Made some helper functions global include/my_sys.h: Removed not used code include/myisam.h: Added extra argument to ..._extra() include/myisammrg.h: Added extra argument to ..._extra() include/mysql_com.h: changed NET to be able to support changeable system variables include/mysql_embed.h: Added MYSQL_SERVER_SUFFIX include/mysql_version.h.in: Added check of multiple including (needed for embedded library) include/mysqld_error.h: New error messages innobase/dict/dict0dict.c: Remove compiler warnings innobase/include/ut0mem.h: Remove compiler warnings innobase/include/ut0mem.ic: Remove compiler warnings isam/isamchk.c: new init_key_cache() arguments isam/isamlog.c: new init_key_cache() arguments isam/test2.c: new init_key_cache() arguments isam/test3.c: new init_key_cache() arguments libmysql/Makefile.am: Removed net.c (Automaticly make it from net_serv.cc) libmysql/Makefile.shared: Removed net.c (Automaticly make it from net_serv.cc) libmysql/libmysql.c: Changeable system variables libmysqld/Makefile.am: Added set_var.cc file libmysqld/embedded_priv.h: Changed order of include fiels libmysqld/lib_sql.cc: merge with mysqld.cc (for changeable variables) libmysqld/libmysqld.c: New changeable system variables myisam/mi_check.c: Added extra argument to ..._extra() myisam/mi_extra.c: Added extra argument to ..._extra() myisam/mi_open.c: Removed not used variable myisam/mi_test1.c: Changed call to init_key_cache myisam/mi_test2.c: Added extra argument to ..._extra() myisam/mi_test3.c: Added extra argument to ..._extra() myisam/mi_write.c: Add cache size argument to bulk-insert-init myisam/myisamchk.c: Use new key cache myisam/myisamdef.h: new mi_init_bulk_insert() arguments myisam/myisamlog.c: Added extra argument to ..._extra() myisam/myisampack.c: Added extra argument to ..._extra() myisammrg/myrg_extra.c: Added extra argument to ..._extra() myisammrg/myrg_rrnd.c: Added extra argument to ..._extra() mysql-test/r/insert_select.result: New changeable system variables mysql-test/r/key.result: Test of bug in auto_increment mysql-test/r/query_cache.result: New changeable system variables mysql-test/r/rpl000001.result: New changeable system variables mysql-test/r/rpl000016.result: New changeable system variables mysql-test/r/union.result: New changeable system variables mysql-test/r/user_var.result: New changeable system variables mysql-test/r/variables.result: New changeable system variables mysql-test/t/key.test: Test of bug in auto_increment mysql-test/t/query_cache.test: New changeable system variables mysql-test/t/rpl000001.test: New changeable system variables mysql-test/t/rpl000009.test: New changeable system variables mysql-test/t/rpl000016.test: New changeable system variables mysql-test/t/rpl_compat.test: New changeable system variables mysql-test/t/union.test: New changeable system variables mysql-test/t/user_var.test: New changeable system variables mysql-test/t/variables.test: New changeable system variables mysys/default.c: Bigger default memory allocation mysys/mf_iocache.c: Removed compiler warning mysys/mf_keycache.c: Made key cache resizable on the fly Removed not needed extra argument to init_key_cache() mysys/my_getopt.c: Made some helper functions global sql/Makefile.am: Aded set_var.cc sql/convert.cc: Comment cleanup sql/field.cc: new changeable system variables sql/filesort.cc: new changeable system variables sql/ha_berkeley.cc: AUTO_COMMIT -> AUTOCOMMIT sql/ha_innodb.cc: new changeable system variables sql/ha_myisam.cc: Added extra argument to ..._extra() sql/ha_myisam.h: Added extra argument to ..._extra() sql/ha_myisammrg.cc: Added extra argument to ..._extra() sql/ha_myisammrg.h: Added extra argument to ..._extra() sql/handler.cc: Added extra argument to ..._extra() Added resize of key cache Change ha_table_typelib for use with new system variables sql/handler.h: Added extra argument to ..._extra() sql/item.cc: new changeable system variables sql/item.h: Added better support of Item_uint sql/item_func.cc: Added support for SET @@[global | session] system_variable sql/item_strfunc.cc: new changeable system variables sql/key.cc: Fixed bug in auto_increment on second part keys sql/lex.h: Removed not needed keywords sql/log.cc: new changeable system variables sql/log_event.cc: new changeable system variables sql/log_event.h: Removed not needed var reference sql/mini_client.cc: new changeable system variables code cleanup sql/mini_client.h: Indentation cleanup sql/mysql_priv.h: Changed order of include files & variables to make file more readable sql/mysqld.cc: Changed order of variables to make file more readable. Support for changeable variables Rename of system variables Moved init_vars to set_var.cc Changed output of --help sql/net_pkg.cc: Added my_net_local_init() to make it possible to set different defaults for network connection depending if you are a client, embedded library or server. sql/net_serv.cc: new changeable system variables To support this, some global variables had to be move to the NET structure. sql/records.cc: new changeable system variables use extra_opt() sql/repl_failsafe.cc: new changeable system variables minior code cleanups sql/repl_failsafe.h: removed not needed external var reference sql/share/czech/errmsg.txt: new changeable system variables sql/share/danish/errmsg.txt: new changeable system variables sql/share/dutch/errmsg.txt: new changeable system variables sql/share/english/errmsg.txt: new changeable system variables sql/share/estonian/errmsg.txt: new changeable system variables sql/share/french/errmsg.txt: new changeable system variables sql/share/german/errmsg.txt: new changeable system variables sql/share/greek/errmsg.txt: new changeable system variables sql/share/hungarian/errmsg.txt: new changeable system variables sql/share/italian/errmsg.txt: new changeable system variables sql/share/japanese/errmsg.txt: new changeable system variables sql/share/korean/errmsg.txt: new changeable system variables sql/share/norwegian-ny/errmsg.txt: new changeable system variables sql/share/norwegian/errmsg.txt: new changeable system variables sql/share/polish/errmsg.txt: new changeable system variables sql/share/portuguese/errmsg.txt: new changeable system variables sql/share/romanian/errmsg.txt: new changeable system variables sql/share/russian/errmsg.txt: new changeable system variables sql/share/slovak/errmsg.txt: new changeable system variables sql/share/spanish/errmsg.txt: new changeable system variables sql/share/swedish/errmsg.txt: new changeable system variables sql/share/ukrainian/errmsg.txt: new changeable system variables sql/slave.cc: new changeable system variables Added some suppression of error messages Initialize current_thd for all slave threads. sql/sql_acl.cc: Added checking of arguments for SET PASSWORD (for new SET defintion) sql/sql_acl.h: new prototypes sql/sql_base.cc: new changeable system variables sql/sql_cache.cc: new changeable system variables sql/sql_cache.h: Renamed some arguments to make code more readable sql/sql_class.cc: new changeable system variables sql/sql_class.h: New changeable system variables Code cleanup sql/sql_db.cc: Fixed bug in DROP DATABASE sql/sql_delete.cc: Usage of wrong define in test (possible speed problem) sql/sql_insert.cc: use extra_opt() Code cleanup sql/sql_lex.cc: Added support for SET @@[global | session] system_variable sql/sql_lex.h: Added support for SET @@[global | session] system_variable sql/sql_load.cc: Cleanup for embedded library Use extra_opt() sql/sql_parse.cc: Cleanup for embedded library New changeable system variables sql/sql_repl.cc: new changeable system variables sql/sql_repl.h: Fixed variable definitions sql/sql_select.cc: new changeable system variables sql/sql_show.cc: New changeable system variables sql/sql_table.cc: Fixed bug in DROP DATABASE sql/sql_union.cc: New changeable system variables sql/sql_update.cc: Usage of wrong define in test (possible speed problem) sql/sql_yacc.yy: New changeable system variables sql/structs.h: Added typedef for SHOW_VAR sql/table.cc: Fixed bug in auto_increment on second part keys sql/uniques.cc: Comment fix sql/unireg.h: A
This commit is contained in:
@ -14,11 +14,6 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
#define net_read_timeout net_read_timeout1
|
||||
#define net_write_timeout net_write_timeout1
|
||||
#endif
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#include "sql_acl.h"
|
||||
#include "sql_repl.h"
|
||||
@ -107,7 +102,7 @@ static void init_signals(void)
|
||||
inline bool end_active_trans(THD *thd)
|
||||
{
|
||||
int error=0;
|
||||
if (thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN |
|
||||
if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN |
|
||||
OPTION_TABLE_LOCK))
|
||||
{
|
||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
||||
@ -203,7 +198,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
|
||||
CLIENT_LONG_PASSWORD),&ur);
|
||||
DBUG_PRINT("info",
|
||||
("Capabilities: %d packet_length: %d Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'",
|
||||
thd->client_capabilities, thd->max_packet_length,
|
||||
thd->client_capabilities, thd->max_client_packet_length,
|
||||
thd->host_or_ip, thd->priv_user,
|
||||
passwd[0] ? "yes": "no",
|
||||
thd->master_access, thd->db ? thd->db : "*none*"));
|
||||
@ -516,7 +511,7 @@ check_connections(THD *thd)
|
||||
#endif
|
||||
if (connect_errors)
|
||||
reset_host_errors(&thd->remote.sin_addr);
|
||||
if (thd->packet.alloc(net_buffer_length))
|
||||
if (thd->packet.alloc(thd->variables.net_buffer_length))
|
||||
return(ER_OUT_OF_RESOURCES);
|
||||
|
||||
thd->client_capabilities=uint2korr(net->read_pos);
|
||||
@ -528,7 +523,7 @@ check_connections(THD *thd)
|
||||
{
|
||||
/* Do the SSL layering. */
|
||||
DBUG_PRINT("info", ("IO layer change in progress..."));
|
||||
sslaccept(ssl_acceptor_fd, net->vio, thd->inactive_timeout);
|
||||
sslaccept(ssl_acceptor_fd, net->vio, thd->variables.net_wait_timeout);
|
||||
DBUG_PRINT("info", ("Reading user information over SSL layer"));
|
||||
if ((pkt_len=my_net_read(net)) == packet_error ||
|
||||
pkt_len < NORMAL_HANDSHAKE_SIZE)
|
||||
@ -550,7 +545,7 @@ check_connections(THD *thd)
|
||||
}
|
||||
#endif
|
||||
|
||||
thd->max_packet_length=uint3korr(net->read_pos+2);
|
||||
thd->max_client_packet_length=uint3korr(net->read_pos+2);
|
||||
char *user= (char*) net->read_pos+5;
|
||||
char *passwd= strend(user)+1;
|
||||
char *db=0;
|
||||
@ -559,11 +554,11 @@ check_connections(THD *thd)
|
||||
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
|
||||
db=strend(passwd)+1;
|
||||
if (thd->client_capabilities & CLIENT_INTERACTIVE)
|
||||
thd->inactive_timeout= thd->variables.net_interactive_timeout;
|
||||
thd->variables.net_wait_timeout= thd->variables.net_interactive_timeout;
|
||||
if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
|
||||
opt_using_transactions)
|
||||
thd->net.return_status= &thd->server_status;
|
||||
net->timeout=(uint) net_read_timeout;
|
||||
net->read_timeout=(uint) thd->variables.net_read_timeout;
|
||||
if (check_user(thd,COM_CONNECT, user, passwd, db, 1))
|
||||
return (-1);
|
||||
thd->password=test(passwd[0]);
|
||||
@ -639,7 +634,7 @@ pthread_handler_decl(handle_one_connection,arg)
|
||||
goto end_thread;
|
||||
}
|
||||
|
||||
if (thd->max_join_size == HA_POS_ERROR)
|
||||
if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR)
|
||||
thd->options |= OPTION_BIG_SELECTS;
|
||||
if (thd->client_capabilities & CLIENT_COMPRESS)
|
||||
net->compress=1; // Use compression
|
||||
@ -661,7 +656,7 @@ pthread_handler_decl(handle_one_connection,arg)
|
||||
free_root(&thd->mem_root,MYF(0));
|
||||
if (net->error && net->vio != 0)
|
||||
{
|
||||
if (!thd->killed && thd->variables.opt_warnings)
|
||||
if (!thd->killed && thd->variables.log_warnings)
|
||||
sql_print_error(ER(ER_NEW_ABORTING_CONNECTION),
|
||||
thd->thread_id,(thd->db ? thd->db : "unconnected"),
|
||||
thd->user ? thd->user : "unauthenticated",
|
||||
@ -715,7 +710,7 @@ pthread_handler_decl(handle_bootstrap,arg)
|
||||
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
|
||||
#endif
|
||||
|
||||
if (thd->max_join_size == (ulong) ~0L)
|
||||
if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR)
|
||||
thd->options |= OPTION_BIG_SELECTS;
|
||||
|
||||
thd->proc_info=0;
|
||||
@ -833,8 +828,9 @@ bool do_command(THD *thd)
|
||||
thd->current_tablenr=0;
|
||||
|
||||
packet=0;
|
||||
old_timeout=net->timeout;
|
||||
net->timeout=(uint) thd->inactive_timeout; // Wait max for 8 hours
|
||||
old_timeout=net->read_timeout;
|
||||
// Wait max for 8 hours
|
||||
net->read_timeout=(uint) thd->variables.net_wait_timeout;
|
||||
net->last_error[0]=0; // Clear error message
|
||||
net->last_errno=0;
|
||||
|
||||
@ -853,7 +849,7 @@ bool do_command(THD *thd)
|
||||
vio_description(net->vio), command,
|
||||
command_name[command]));
|
||||
}
|
||||
net->timeout=old_timeout; // Timeout for writing
|
||||
net->read_timeout=old_timeout; // restore it
|
||||
DBUG_RETURN(dispatch_command(command,thd, packet+1, (uint) packet_length));
|
||||
}
|
||||
|
||||
@ -871,13 +867,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
DBUG_ENTER("dispatch_command");
|
||||
|
||||
thd->command=command;
|
||||
thd->set_time();
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_id=query_id;
|
||||
if (command != COM_STATISTICS && command != COM_PING)
|
||||
query_id++;
|
||||
thread_running++;
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
thd->set_time();
|
||||
|
||||
thd->lex.select_lex.options=0; // We store status here
|
||||
switch (command) {
|
||||
case COM_INIT_DB:
|
||||
@ -972,7 +969,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->db_length+2)))
|
||||
break;
|
||||
thd->query[packet_length]=0;
|
||||
thd->packet.shrink(net_buffer_length); // Reclaim some memory
|
||||
thd->packet.shrink(thd->variables.net_buffer_length);// Reclaim some memory
|
||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
|
||||
mysql_log.write(thd,command,"%s",thd->query);
|
||||
@ -1213,7 +1210,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->query=0;
|
||||
thread_running--;
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
thd->packet.shrink(net_buffer_length); // Reclaim some memory
|
||||
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
|
||||
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
@ -2042,11 +2039,11 @@ mysql_execute_command(void)
|
||||
break;
|
||||
case SQLCOM_SHOW_STATUS:
|
||||
res= mysqld_show(thd,(lex->wild ? lex->wild->ptr() : NullS),status_vars,
|
||||
(struct system_variables*) 0);
|
||||
OPT_GLOBAL);
|
||||
break;
|
||||
case SQLCOM_SHOW_VARIABLES:
|
||||
res= mysqld_show(thd, (lex->wild ? lex->wild->ptr() : NullS),
|
||||
init_vars, lex->variable_values);
|
||||
init_vars, lex->option_type);
|
||||
break;
|
||||
case SQLCOM_SHOW_LOGS:
|
||||
{
|
||||
@ -2153,7 +2150,7 @@ mysql_execute_command(void)
|
||||
else
|
||||
{
|
||||
if (!(thd->client_capabilities & CLIENT_LOCAL_FILES) ||
|
||||
! thd->variables.opt_local_infile)
|
||||
! opt_local_infile)
|
||||
{
|
||||
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND);
|
||||
goto error;
|
||||
@ -2167,39 +2164,11 @@ mysql_execute_command(void)
|
||||
break;
|
||||
}
|
||||
case SQLCOM_SET_OPTION:
|
||||
{
|
||||
ulong org_options=thd->options;
|
||||
thd->options=select_lex->options;
|
||||
thd->update_lock_default= ((thd->options & OPTION_LOW_PRIORITY_UPDATES) ?
|
||||
TL_WRITE_LOW_PRIORITY : TL_WRITE);
|
||||
thd->default_select_limit=select_lex->select_limit;
|
||||
thd->tx_isolation=lex->tx_isolation;
|
||||
DBUG_PRINT("info",("options: %ld limit: %ld",
|
||||
thd->options,(long) thd->default_select_limit));
|
||||
|
||||
/* Check if auto_commit mode changed */
|
||||
if ((org_options ^ select_lex->options) & OPTION_NOT_AUTO_COMMIT)
|
||||
{
|
||||
if ((org_options & OPTION_NOT_AUTO_COMMIT))
|
||||
{
|
||||
/* We changed to auto_commit mode */
|
||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
||||
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
|
||||
if (ha_commit(thd))
|
||||
{
|
||||
res= -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
thd->options&= ~(ulong) (OPTION_STATUS_NO_TRANS_UPDATE);
|
||||
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
|
||||
}
|
||||
}
|
||||
send_ok(&thd->net);
|
||||
if (sql_set_variables(thd, &lex->var_list))
|
||||
res= -1;
|
||||
else
|
||||
send_ok(&thd->net);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_UNLOCK_TABLES:
|
||||
if (thd->locked_tables)
|
||||
{
|
||||
@ -2726,7 +2695,7 @@ mysql_init_select(LEX *lex)
|
||||
{
|
||||
SELECT_LEX *select_lex = lex->select;
|
||||
select_lex->where=select_lex->having=0;
|
||||
select_lex->select_limit=lex->thd->default_select_limit;
|
||||
select_lex->select_limit= lex->thd->variables.select_limit;
|
||||
select_lex->offset_limit=0;
|
||||
select_lex->options=0;
|
||||
select_lex->linkage=UNSPECIFIED_TYPE;
|
||||
|
Reference in New Issue
Block a user