diff options
author | unknown <monty@hundin.mysql.fi> | 2002-08-08 20:49:06 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-08-08 20:49:06 +0300 |
commit | 33dab613c7ede7c9d3b7d39252ab29c5ff3b4165 (patch) | |
tree | 3a864bb27bc717c690f6d83d2aa5afbc850401a4 | |
parent | 028cfaba9ba0fcbba30511e6951daab6a1829f20 (diff) | |
download | mariadb-git-33dab613c7ede7c9d3b7d39252ab29c5ff3b4165.tar.gz |
Added nety_retry_count as a changeable variable
Make safe_mysqld a symlink to mysqld_safe in binary distribution
Fixed problem with CTRL-C when using mysqld --bootstrap
Docs/manual.texi:
Added nety_retry_count as a changeable variables
include/mysql_com.h:
Added nety_retry_count as a changeable variables
libmysql/libmysql.c:
Added nety_retry_count as a changeable variables
mysql-test/r/olap.result:
Fixed wrong error message
mysql-test/r/variables.result:
Update for freebsd
mysql-test/t/variables.test:
Update for freebsd
scripts/make_binary_distribution.sh:
Make safe_mysqld a symlink to mysqld_safe in binary distribution.
sql/item_func.cc:
Cleaned up tmp_table_field() handling.
sql/item_func.h:
Cleaned up tmp_table_field() handling.
sql/item_strfunc.h:
Cleaned up tmp_table_field() handling.
sql/item_timefunc.h:
Cleaned up tmp_table_field() handling.
sql/mysql_priv.h:
Added nety_retry_count as a changeable variables
sql/mysqld.cc:
Added nety_retry_count as a changeable variables
Allow one to specify a defaults file to be read when installing MySQL as a service.
sql/net_pkg.cc:
Added nety_retry_count as a changeable variables
sql/net_serv.cc:
Added nety_retry_count as a changeable variables
sql/set_var.cc:
Added nety_retry_count as a changeable variables
sql/share/czech/errmsg.txt:
Fixed wrong error message
sql/share/danish/errmsg.txt:
Fixed wrong error message
sql/share/english/errmsg.txt:
Fixed wrong error message
sql/share/estonian/errmsg.txt:
Fixed wrong error message
sql/share/french/errmsg.txt:
Fixed wrong error message
sql/share/german/errmsg.txt:
Fixed wrong error message
sql/share/greek/errmsg.txt:
Fixed wrong error message
sql/share/hungarian/errmsg.txt:
Fixed wrong error message
sql/share/italian/errmsg.txt:
Fixed wrong error message
sql/share/japanese/errmsg.txt:
Fixed wrong error message
sql/share/korean/errmsg.txt:
Fixed wrong error message
sql/share/norwegian-ny/errmsg.txt:
Fixed wrong error message
sql/share/norwegian/errmsg.txt:
Fixed wrong error message
sql/share/polish/errmsg.txt:
Fixed wrong error message
sql/share/portuguese/errmsg.txt:
Fixed wrong error message
sql/share/romanian/errmsg.txt:
Fixed wrong error message
sql/share/russian/errmsg.txt:
Fixed wrong error message
sql/share/slovak/errmsg.txt:
Fixed wrong error message
sql/share/spanish/errmsg.txt:
Fixed wrong error message
sql/share/swedish/errmsg.txt:
Fixed wrong error message
sql/share/ukrainian/errmsg.txt:
Fixed wrong error message
sql/sql_class.cc:
Indentaion cleanup
sql/sql_class.h:
Fixed wrong error message
sql/sql_parse.cc:
Fixed problem with CTRL-C when using mysqld --bootstrap
sql/sql_select.cc:
Ensure that select terminates if create_myisam_from_heap() fails.
sql/sql_yacc.yy:
Portability fix
42 files changed, 191 insertions, 135 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index b5bd24575ba..ea54ed1a5f0 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -8220,7 +8220,9 @@ In 3.23, @code{INSERT INTO ... SELECT} always had @code{IGNORE} enabled. In 4.0.1, MySQL will stop (and possibly roll back) in case of an error if you don't specify @code{IGNORE}. @item -@file{safe_mysqld} is renamed to @file{mysqld_safe}. +@file{safe_mysqld} is renamed to @file{mysqld_safe}. For some time we +will in our binary distributions include @code{safe_mysqld} as a symlink to +@code{mysqld_safe}. @item The old C API functions @code{mysql_drop_db}, @code{mysql_create_db}, and @code{mysql_connect} are not supported anymore, unless you compile @@ -28663,6 +28665,7 @@ and if you can use @code{GLOBAL} or @code{SESSION} with them. @item myisam_sort_buffer_size @tab num @tab GLOBAL | SESSION @item net_buffer_length @tab num @tab GLOBAL | SESSION @item net_read_timeout @tab num @tab GLOBAL | SESSION +@item net_retry_count @tab num @tab GLOBAL | SESSION @item net_write_timeout @tab num @tab GLOBAL | SESSION @item query_cache_limit @tab num @tab GLOBAL @item query_cache_size @tab num @tab GLOBAL @@ -50222,6 +50225,8 @@ each individual 4.0.x release. @itemize @bullet @item +Made @code{safe_mysqld} a symlink to @code{mysqld_safe} in binary distribution. +@item mysqld now has the option @code{--temp-pool} enabled by default as this gives better performance with some OS. @item diff --git a/include/mysql_com.h b/include/mysql_com.h index 641c4b95f24..a7e73405ac0 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -116,7 +116,7 @@ typedef struct st_net { my_socket fd; /* For Perl DBI/dbd */ unsigned long max_packet,max_packet_size; unsigned int last_errno,pkt_nr,compress_pkt_nr; - unsigned int write_timeout,read_timeout; + unsigned int write_timeout, read_timeout, retry_count; int fcntl; char last_error[MYSQL_ERRMSG_SIZE]; unsigned char error; diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 458e5db24d5..7cd607b702e 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2902,6 +2902,7 @@ void my_net_local_init(NET *net) net->max_packet= (uint) net_buffer_length; net->read_timeout= (uint) net_read_timeout; net->write_timeout=(uint) net_write_timeout; + net->retry_count= 1; net->max_packet_size= max(net_buffer_length, max_allowed_packet); } diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index fa6008e99f7..52bd83df5ed 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -15,13 +15,13 @@ insert into sales values ( 'Computer', 'India',2000, 1200), ( 'Computer', 'United States', 2000,1500), ( 'Calculator', 'United States', 2000,75); select product, country , year, sum(profit) from sales group by product, country, year with cube; -This version of MySQL doesn't yet support 'CUBE', +This version of MySQL doesn't yet support 'CUBE' explain select product, country , year, sum(profit) from sales group by product, country, year with cube; -This version of MySQL doesn't yet support 'CUBE', +This version of MySQL doesn't yet support 'CUBE' select product, country , year, sum(profit) from sales group by product, country, year with rollup; -This version of MySQL doesn't yet support 'ROLLUP', +This version of MySQL doesn't yet support 'ROLLUP' explain select product, country , year, sum(profit) from sales group by product, country, year with rollup; -This version of MySQL doesn't yet support 'ROLLUP', +This version of MySQL doesn't yet support 'ROLLUP' select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup; -This version of MySQL doesn't yet support 'CUBE', +This version of MySQL doesn't yet support 'CUBE' drop table sales; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 4227ecfdadb..2896636a37c 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -120,6 +120,7 @@ set myisam_max_sort_file_size=default; show variables like 'myisam_max_sort_file_size'; Variable_name Value myisam_max_sort_file_size 20000 +set global net_retry_count=10, session net_retry_count=10; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600; show global variables like 'net_%'; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 967c21f7eab..ecc4a0cbcdc 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -73,6 +73,7 @@ show global variables like 'myisam_max_sort_file_size'; set myisam_max_sort_file_size=default; show variables like 'myisam_max_sort_file_size'; +set global net_retry_count=10, session net_retry_count=10; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600; show global variables like 'net_%'; diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 44dc9d44322..6e66a0b977c 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -123,6 +123,10 @@ $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin $BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data < $SOURCE/support-files/mysql.server.sh > $BASE/support-files/mysql.server $BASE/bin/replace /my/gnu/bin/hostname /bin/hostname -- $BASE/bin/mysqld_safe +# Make safe_mysqld a symlink to mysqld_safe for backwards portability +# To be removed in MySQL 4.1 +(cd $BASE/bin ; ln -s mysqld_safe safe_mysqld ) + mv $BASE/support-files/binary-configure $BASE/configure chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/configure $CP -r sql-bench/* $BASE/sql-bench diff --git a/sql/item_func.cc b/sql/item_func.cc index 3e5c082033b..8b05109b289 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -166,6 +166,36 @@ bool Item_func::eq(const Item *item, bool binary_cmp) const } +Field *Item_func::tmp_table_field(TABLE *t_arg) +{ + Field *res; + LINT_INIT(res); + + if (!t_arg) + return result_field; + switch (args[0]->result_type()) { + case INT_RESULT: + if (max_length > 11) + res= new Field_longlong(max_length, maybe_null, name, t_arg, + unsigned_flag); + else + res= new Field_long(max_length, maybe_null, name, t_arg, + unsigned_flag); + break; + case REAL_RESULT: + res= new Field_double(max_length, maybe_null, name, t_arg, decimals); + break; + case STRING_RESULT: + if (max_length > 255) + res= new Field_blob(max_length, maybe_null, name, t_arg, binary); + else + res= new Field_string(max_length, maybe_null, name, t_arg, binary); + break; + } + return res; +} + + String *Item_real_func::val_str(String *str) { double nr=val(); diff --git a/sql/item_func.h b/sql/item_func.h index 77b78495214..736616b016a 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -122,6 +122,7 @@ public: bool is_null() { (void) val_int(); return null_value; } friend class udf_handler; unsigned int size_of() { return sizeof(*this);} + Field *tmp_table_field(TABLE *t_arg); }; @@ -136,14 +137,10 @@ public: longlong val_int() { return (longlong) val(); } enum Item_result result_type () const { return REAL_RESULT; } void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); } - Field *tmp_table_field(TABLE *t_arg) - { - if (!t_arg) return result_field; - return new Field_double(max_length, maybe_null, name,t_arg,decimals); - } unsigned int size_of() { return sizeof(*this);} }; + class Item_num_func :public Item_func { protected: @@ -172,24 +169,6 @@ class Item_num_op :public Item_func void fix_length_and_dec() { fix_num_length_and_dec(); find_num_type(); } void find_num_type(void); bool is_null() { (void) val(); return null_value; } - Field *tmp_table_field(TABLE *t_arg) - { - Field *res; - if (!t_arg) - return result_field; - if (args[0]->result_type() == INT_RESULT) - { - if (max_length > 11) - res= new Field_longlong(max_length, maybe_null, name, t_arg, - unsigned_flag); - else - res= new Field_long(max_length, maybe_null, name, t_arg, - unsigned_flag); - } - else - res= new Field_double(max_length, maybe_null, name, t_arg, decimals); - return res; - } unsigned int size_of() { return sizeof(*this);} }; @@ -206,18 +185,9 @@ public: String *val_str(String*str); enum Item_result result_type () const { return INT_RESULT; } void fix_length_and_dec() {} - Field *tmp_table_field(TABLE *t_arg) - { - if (!t_arg) - return result_field; - return ((max_length > 11) ? - (Field *)new Field_longlong(max_length, maybe_null, name, t_arg, - unsigned_flag) : - (Field *)new Field_long(max_length, maybe_null, name, t_arg, - unsigned_flag)); - } }; + class Item_func_signed :public Item_int_func { public: @@ -228,6 +198,7 @@ public: { max_length=args[0]->max_length; unsigned_flag=0; } }; + class Item_func_unsigned :public Item_int_func { public: diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 835b1c7547d..618a6f56bcf 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -35,16 +35,6 @@ public: double val(); enum Item_result result_type () const { return STRING_RESULT; } void left_right_max_length(); - Field *tmp_table_field(TABLE *t_arg) - { - if (!t_arg) - return result_field; - return ((max_length > 255) ? - (Field *) new Field_blob(max_length, maybe_null, name, t_arg, - binary) : - (Field *) new Field_string(max_length, maybe_null, name, t_arg, - binary)); - } unsigned int size_of() { return sizeof(*this);} }; @@ -60,6 +50,7 @@ public: unsigned int size_of() { return sizeof(*this);} }; + class Item_func_sha :public Item_str_func { public: diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 4478c3df266..0fe487b7983 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -71,13 +71,9 @@ public: const char *func_name() const { return "month"; } enum Item_result result_type () const { return INT_RESULT; } void fix_length_and_dec() { decimals=0; max_length=2; maybe_null=1; } - Field *tmp_table_field(TABLE *t_arg) - { - if (!t_arg) return result_field; - return (Field *) new Field_string(max_length,maybe_null, name,t_arg, binary); - } }; + class Item_func_monthname :public Item_func_month { public: diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index a7c37059ecc..18a006b5a16 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -622,7 +622,7 @@ extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count; extern ulong ha_read_key_count, ha_read_next_count, ha_read_prev_count; extern ulong ha_read_first_count, ha_read_last_count; extern ulong ha_read_rnd_count, ha_read_rnd_next_count; -extern ulong ha_commit_count, ha_rollback_count, mysqld_net_retry_count; +extern ulong ha_commit_count, ha_rollback_count; extern ulong keybuff_size,table_cache_size; extern ulong max_connections,max_connect_errors, connect_timeout; extern ulong max_insert_delayed_threads, max_user_connections; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 829614fdb2c..0172ec68836 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -184,7 +184,9 @@ static uint handler_count; static bool opt_enable_named_pipe = 0; #endif #ifdef __WIN__ -static bool opt_console=0,start_mode=0; +static bool opt_console=0, start_mode=0, use_opt_args; +static int opt_argc; +static char **opt_argv; #endif /* Set prefix for windows binary */ @@ -316,7 +318,7 @@ struct system_variables max_system_variables; ulong keybuff_size,table_cache_size, thread_stack, thread_stack_min,what_to_log= ~ (1L << (uint) COM_TIME), - query_buff_size, mysqld_net_retry_count, + query_buff_size, slow_launch_time = 2L, slave_open_temp_tables=0, open_files_limit=0, max_binlog_size; @@ -1151,7 +1153,7 @@ sig_handler end_thread_signal(int sig __attribute__((unused))) { THD *thd=current_thd; DBUG_ENTER("end_thread_signal"); - if (thd) + if (thd && ! thd->bootstrap) end_thread(thd,0); DBUG_VOID_RETURN; /* purecov: deadcode */ } @@ -2218,10 +2220,52 @@ The server will not act as a slave."); #if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) int mysql_service(void *p) { - win_main(Service.my_argc, Service.my_argv); + if (use_opt_args) + win_main(opt_argc, opt_argv); + else + win_main(Service.my_argc, Service.my_argv); return 0; } +/* + Handle basic handling of services, like installation and removal + + SYNOPSIS + default_service_handling() + argv Pointer to argument list + servicename Internal name of service + displayname Display name of service (in taskbar ?) + file_path Path to this program + + RETURN VALUES + 0 option handled + 1 Could not handle option + */ + +bool default_service_handling(char **argv, + const char *servicename, + const char *displayname, + const char *file_path) +{ + if (Service.got_service_option(argv, "install")) + { + Service.Install(1, servicename, displayname, file_path); + return 0; + } + if (Service.got_service_option(argv, "install-manual")) + { + Service.Install(0, servicename, displayname, file_path); + return 0; + } + if (Service.got_service_option(argv, "remove")) + { + Service.Remove(servicename); + return 0; + } + return 1; +} + + int main(int argc, char **argv) { if (Service.GetOS()) /* true NT family */ @@ -2232,52 +2276,51 @@ int main(int argc, char **argv) if (argc == 2) { - if (Service.got_service_option(argv, "install")) - { - Service.Install(1, MYSQL_SERVICENAME, MYSQL_SERVICENAME, file_path); - return 0; - } - else if (Service.got_service_option(argv, "install-manual")) - { - Service.Install(0, MYSQL_SERVICENAME, MYSQL_SERVICENAME, file_path); - return 0; - } - else if (Service.got_service_option(argv, "remove")) - { - Service.Remove(MYSQL_SERVICENAME); - return 0; - } - else if (Service.IsService(argv[1])) + if (!default_service_handling(argv,MYSQL_SERVICENAME, MYSQL_SERVICENAME, + file_path)) + return 0; + if (Service.IsService(argv[1])) { /* start an optional service */ - load_default_groups[0]= argv[1]; - event_name= argv[1]; + event_name = load_default_groups[0]= argv[1]; start_mode= 1; - Service.Init(event_name, mysql_service ); + Service.Init(event_name, mysql_service); return 0; } } else if (argc == 3) /* install or remove any optional service */ { + /* Add service name after filename */ uint length=strlen(file_path); - file_path[sizeof(file_path)-1]=0; - strxnmov(file_path + length, sizeof(file_path)-2, " ", argv[2], NullS); - if (Service.got_service_option(argv, "install")) - { - Service.Install(1, argv[2], argv[2], file_path); - return 0; - } - else if (Service.got_service_option(argv, "install-manual")) - { - Service.Install(0, argv[2], argv[2], file_path); - return 0; - } - else if (Service.got_service_option(argv, "remove")) + strxnmov(file_path + length, sizeof(file_path)-length-2, " ", + argv[2], NullS)= '\0'; + + if (!default_service_handling(argv, argv[2], argv[2], file_path)) + return 0; + if (Service.IsService(argv[2])) { - Service.Remove(argv[2]); - return 0; + /* start an optional service */ + use_opt_args=1; + opt_argc=argc; + opt_argv=argv; + event_name= argv[2]; + start_mode= 1; + Service.Init(event_name, mysql_service); + return 0; } } + else if (argc == 4) + { + /* + Install an optional service with optional config file + mysqld --install-manual mysqldopt --defaults-file=c:\miguel\my.ini + */ + uint length=strlen(file_path); + strxnmov(file_path + length, sizeof(file_path)-length-2, " ", + argv[3], " ", argv[2], NullS)= '\0'; + if (!default_service_handling(argv, argv[2], argv[2], file_path)) + return 0; + } else if (argc == 1 && Service.IsService(MYSQL_SERVICENAME)) { /* start the default service */ @@ -2305,6 +2348,7 @@ static int bootstrap(FILE *file) { THD *thd= new THD; int error; + DBUG_ENTER("bootstrap"); thd->bootstrap=1; thd->client_capabilities=0; @@ -2319,7 +2363,7 @@ static int bootstrap(FILE *file) (void*) thd)) { sql_print_error("Warning: Can't create thread to handle bootstrap"); - return -1; + DBUG_RETURN(-1); } /* Wait for thread to die */ (void) pthread_mutex_lock(&LOCK_thread_count); @@ -2333,7 +2377,7 @@ static int bootstrap(FILE *file) net_end(&thd->net); thd->cleanup(); delete thd; - return error; + DBUG_RETURN(error); } static bool read_init_file(char *file_name) @@ -3511,7 +3555,8 @@ struct my_option my_long_options[] = REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0}, {"net_retry_count", OPT_NET_RETRY_COUNT, "If a read on a communication port is interrupted, retry this many times before giving up.", - (gptr*) &mysqld_net_retry_count, (gptr*) &mysqld_net_retry_count, 0, + (gptr*) &global_system_variables.net_retry_count, + (gptr*) &max_system_variables.net_retry_count,0, GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ~0L, 0, 1, 0}, {"net_read_timeout", OPT_NET_READ_TIMEOUT, "Number of seconds to wait for more data from a connection before aborting the read.", diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc index a8beecd5fb4..52400e02d06 100644 --- a/sql/net_pkg.cc +++ b/sql/net_pkg.cc @@ -381,6 +381,7 @@ void my_net_local_init(NET *net) net->max_packet= (uint) global_system_variables.net_buffer_length; net->read_timeout= (uint) global_system_variables.net_read_timeout; net->write_timeout=(uint) global_system_variables.net_write_timeout; + net->retry_count= (uint) global_system_variables.net_retry_count; net->max_packet_size= max(global_system_variables.net_buffer_length, global_system_variables.max_allowed_packet); } diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 0eb3e1d6a75..8c1792a6c8b 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -62,15 +62,12 @@ extern void query_cache_insert(NET *net, const char *packet, ulong length); #ifndef NO_ALARM #include "my_pthread.h" void sql_print_error(const char *format,...); -#define RETRY_COUNT mysqld_net_retry_count -extern ulong mysqld_net_retry_count; extern ulong bytes_sent, bytes_received; extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; #else #undef statistic_add #define statistic_add(A,B,C) #define DONT_USE_THR_ALARM -#define RETRY_COUNT 1 #endif /* NO_ALARM */ #include "thr_alarm.h" @@ -85,11 +82,12 @@ static int net_write_buff(NET *net,const char *packet,ulong len); int my_net_init(NET *net, Vio* vio) { + DBUG_ENTER("my_net_init"); my_net_local_init(net); /* Set some limits */ if (!(net->buff=(uchar*) my_malloc((uint32) net->max_packet+ NET_HEADER_SIZE + COMP_HEADER_SIZE, MYF(MY_WME)))) - return 1; + DBUG_RETURN(1); net->buff_end=net->buff+net->max_packet; net->vio = vio; net->no_send_ok = 0; @@ -114,14 +112,16 @@ int my_net_init(NET *net, Vio* vio) #endif vio_fastsend(vio); } - return 0; + DBUG_RETURN(0); } void net_end(NET *net) { + DBUG_ENTER("net_end"); my_free((gptr) net->buff,MYF(MY_ALLOW_ZERO_PTR)); net->buff=0; + DBUG_VOID_RETURN; } @@ -385,7 +385,7 @@ net_real_write(NET *net,const char *packet,ulong len) my_bool old_mode; while (vio_blocking(net->vio, TRUE, &old_mode) < 0) { - if (vio_should_retry(net->vio) && retry_count++ < RETRY_COUNT) + if (vio_should_retry(net->vio) && retry_count++ < net->retry_count) continue; #ifdef EXTRA_DEBUG fprintf(stderr, @@ -404,7 +404,7 @@ net_real_write(NET *net,const char *packet,ulong len) if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) && interrupted) { - if (retry_count++ < RETRY_COUNT) + if (retry_count++ < net->retry_count) continue; #ifdef EXTRA_DEBUG fprintf(stderr, "%s: write looped, aborting thread\n", @@ -476,7 +476,7 @@ static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed) my_bool interrupted = vio_should_retry(net->vio); if (!thr_got_alarm(&alarmed) && interrupted) { /* Probably in MIT threads */ - if (retry_count++ < RETRY_COUNT) + if (retry_count++ < net->retry_count) continue; } return; @@ -543,7 +543,7 @@ my_real_read(NET *net, ulong *complen) while (vio_blocking(net->vio, TRUE, &old_mode) < 0) { if (vio_should_retry(net->vio) && - retry_count++ < RETRY_COUNT) + retry_count++ < net->retry_count) continue; DBUG_PRINT("error", ("fcntl returned error %d, aborting thread", @@ -568,7 +568,7 @@ my_real_read(NET *net, ulong *complen) if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) && interrupted) { /* Probably in MIT threads */ - if (retry_count++ < RETRY_COUNT) + if (retry_count++ < net->retry_count) continue; #ifdef EXTRA_DEBUG fprintf(stderr, "%s: read looped with error %d, aborting thread\n", diff --git a/sql/set_var.cc b/sql/set_var.cc index 6aa5450d094..d471c0b18ba 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -72,6 +72,7 @@ static void fix_low_priority_updates(THD *thd, enum_var_type type); static void fix_tx_isolation(THD *thd, enum_var_type type); static void fix_net_read_timeout(THD *thd, enum_var_type type); static void fix_net_write_timeout(THD *thd, enum_var_type type); +static void fix_net_retry_count(THD *thd, enum_var_type type); static void fix_max_join_size(THD *thd, enum_var_type type); static void fix_query_cache_size(THD *thd, enum_var_type type); static void fix_key_buffer_size(THD *thd, enum_var_type type); @@ -167,6 +168,9 @@ sys_var_thd_ulong sys_net_read_timeout("net_read_timeout", sys_var_thd_ulong sys_net_write_timeout("net_write_timeout", &SV::net_write_timeout, fix_net_write_timeout); +sys_var_thd_ulong sys_net_retry_count("net_retry_count", + &SV::net_retry_count, + fix_net_retry_count); sys_var_thd_ulong sys_read_buff_size("read_buffer_size", &SV::read_buff_size); sys_var_thd_ulong sys_read_rnd_buff_size("read_rnd_buffer_size", @@ -332,6 +336,7 @@ sys_var *sys_variables[]= &sys_myisam_sort_buffer_size, &sys_net_buffer_length, &sys_net_read_timeout, + &sys_net_retry_count, &sys_net_wait_timeout, &sys_net_write_timeout, &sys_query_cache_size, @@ -472,7 +477,7 @@ struct show_var_st init_vars[]= { #endif {sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS}, {sys_net_read_timeout.name, (char*) &sys_net_read_timeout, SHOW_SYS}, - {"net_retry_count", (char*) &mysqld_net_retry_count, SHOW_LONG}, + {sys_net_retry_count.name, (char*) &sys_net_retry_count, SHOW_SYS}, {sys_net_write_timeout.name,(char*) &sys_net_write_timeout, SHOW_SYS}, {"open_files_limit", (char*) &open_files_limit, SHOW_LONG}, {"pid_file", (char*) pidfile_name, SHOW_CHAR}, @@ -599,6 +604,12 @@ static void fix_net_write_timeout(THD *thd, enum_var_type type) thd->net.write_timeout=thd->variables.net_write_timeout; } +static void fix_net_retry_count(THD *thd, enum_var_type type) +{ + if (type != OPT_GLOBAL) + thd->net.retry_count=thd->variables.net_retry_count; +} + static void fix_query_cache_size(THD *thd, enum_var_type type) { diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 18b4c3ad2a8..4acb152a22b 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -245,4 +245,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 7d409e3133f..e017b0337c8 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -239,4 +239,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 04150b67084..8a10d0351f5 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -236,4 +236,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 2a0233ca949..161310f05c9 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -241,4 +241,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 42f83e6eed2..893a65747b8 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -236,4 +236,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 0cd3f8cd902..5e886f9a2c9 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -239,4 +239,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index bed0afe8286..4f49e1b4e08 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -236,4 +236,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index a3c4f945351..8cd486b5f63 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -238,4 +238,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 39c9635cc91..5cd026db0ab 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -236,4 +236,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index f146f03e687..70e4ca55c4c 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -238,4 +238,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index c3ab3d5d680..1e659227e0a 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -236,4 +236,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index a0191ba86d7..3b4efe7602b 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -238,4 +238,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 8d87c00e1b3..535087320c6 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -238,4 +238,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index def94b8795a..7aed210f6e4 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -240,4 +240,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 9c3bf3b32a1..2a635558055 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -236,4 +236,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index fd12a1f3a64..59b913c0a1a 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -240,4 +240,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index dfe3b4a2f92..4e8e9508b73 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -239,4 +239,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 8e9433396fc..12b32da0f64 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -244,4 +244,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 57314579c63..c8c33152cc0 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -237,4 +237,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 7a4d17cfdfa..8c24be8f819 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -236,4 +236,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index d8d9349b56a..2b54d1f6098 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -241,4 +241,4 @@ "Wrong argument type to variable '%-.64s'", "Variable '%-.64s' can only be set, not read", "Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'," +"This version of MySQL doesn't yet support '%s'", diff --git a/sql/sql_class.cc b/sql/sql_class.cc index cc2c9fdc6ef..aff9c9c6c2a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -208,7 +208,6 @@ THD::~THD() hash_free(&user_vars); DBUG_PRINT("info", ("freeing host")); - if (host != localhost) // If not pointer to constant safeFree(host); if (user != delayed_user) diff --git a/sql/sql_class.h b/sql/sql_class.h index 6a3daae6274..042d4868bf5 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -296,6 +296,7 @@ struct system_variables ulong net_read_timeout; ulong net_wait_timeout; ulong net_write_timeout; + ulong net_retry_count; ulong query_cache_type; ulong read_buff_size; ulong read_rnd_buff_size; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 14ed24ad3f7..fa6384d93a6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -721,7 +721,7 @@ pthread_handler_decl(handle_bootstrap,arg) thd->proc_info=0; thd->version=refresh_version; - thd->priv_user=thd->user=(char*)"boot"; + thd->priv_user=thd->user=(char*) my_strdup("boot", MYF(MY_WME)); buff= (char*) thd->net.buff; init_sql_alloc(&thd->mem_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC); @@ -752,7 +752,6 @@ pthread_handler_decl(handle_bootstrap,arg) free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC)); } - thd->priv_user=thd->user=0; /* thd->fatal_error should be set in case something went wrong */ end: diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 169f95cc66b..fa229f05dac 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5086,7 +5086,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), error == HA_ERR_FOUND_DUPP_UNIQUE) goto end; if (create_myisam_from_heap(table, &join->tmp_table_param, error,1)) - DBUG_RETURN(1); // Not a table_is_full error + DBUG_RETURN(-1); // Not a table_is_full error table->uniques=0; // To ensure rows are the same } if (++join->send_records >= join->tmp_table_param.end_write_records && @@ -5258,7 +5258,7 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), { if (create_myisam_from_heap(table, &join->tmp_table_param, error, 0)) - DBUG_RETURN(1); // Not a table_is_full error + DBUG_RETURN(-1); // Not a table_is_full error } else join->send_records++; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 97a4c5308ba..9374b81b45a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3449,7 +3449,7 @@ revoke: lex->columns.empty(); lex->grant= lex->grant_tot_col=0; lex->select->db=0; - bzero(&(lex->mqh),sizeof(lex->mqh)); + bzero((char*) &lex->mqh, sizeof(lex->mqh)); } grant_privileges ON opt_table FROM user_list; |