From 904153de280427c4756f4482adc129f8d2c3a58e Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 13 Apr 2002 13:44:08 +0300 Subject: libwrap bug fix for Linux only BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/mysqld.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1d108b3f4c2..fa5f6ae395e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2415,6 +2415,7 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) struct request_info req; signal(SIGCHLD, SIG_DFL); request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL); +#ifndef __linux__ fromhost(&req); if (!hosts_access(&req)) { @@ -2422,6 +2423,12 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) // which we surely don't want... // clean_exit() - same stupid thing ... syslog(deny_severity, "refused connect from %s", eval_client(&req)); +#else + fromhost(); + if (!hosts_access()) + { + syslog(deny_severity, "refused connect from %s", eval_client()); +#endif if (req.sink) ((void (*)(int))req.sink)(req.fd); -- cgit v1.2.1 From ca7f6a8bf89d74980678f5c1f25cd830d703e5a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 Apr 2002 16:00:05 +0300 Subject: query cache code can be excluded from server sql/mysqld.cc: fake query_cache_size parameter if query cache code excluded from server --- sql/mysqld.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 99f0a463a42..3fd58d6a03a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -291,8 +291,9 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size, ulong com_stat[(uint) SQLCOM_END], com_other; ulong slave_net_timeout; ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0; +ulong query_cache_size=0; #ifdef HAVE_QUERY_CACHE -ulong query_cache_size=0, query_cache_limit=0, query_cache_startup_type=1; +ulong query_cache_limit=0, query_cache_startup_type=1; Query_cache query_cache; #endif @@ -3048,8 +3049,10 @@ CHANGEABLE_VAR changeable_vars[] = { #ifdef HAVE_QUERY_CACHE { "query_cache_limit", (long*) &query_cache_limit, 1024*1024L, 0, ULONG_MAX, 0, 1}, +#endif /*HAVE_QUERY_CACHE*/ { "query_cache_size", (long*) &query_cache_size, 0, 0, ULONG_MAX, 0, 1}, +#ifdef HAVE_QUERY_CACHE { "query_cache_startup_type",(long*) &query_cache_startup_type, 1, 0, 2, 0, 1}, #endif /*HAVE_QUERY_CACHE*/ -- cgit v1.2.1 From d90d3bcafc220ca9d2cb2c80ff2db62247bf3e69 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 Apr 2002 17:09:30 -0600 Subject: reckless slave option bison 1.34 yacc rule compliance more robust handling of relay log corruption mysql-test/r/rpl000014.result: updated result mysql-test/r/rpl_log.result: updated result sql/mysqld.cc: reckless slave option sql/slave.cc: reckless slave + more robust handling of relay log corruption sql/slave.h: reckless slave sql/sql_yacc.yy: brought the rules into compliance with bison 1.34 by adding ';' at the end of each rule --- sql/mysqld.cc | 11 ++ sql/slave.cc | 32 +++- sql/slave.h | 2 +- sql/sql_yacc.yy | 553 ++++++++++++++++++++++++++++---------------------------- 4 files changed, 318 insertions(+), 280 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 99f0a463a42..00563575698 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -227,6 +227,11 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO; #endif bool opt_skip_slave_start = 0; // If set, slave is not autostarted + +/* if set, some standard measures to enforce + slave data intergity will not be performed + */ +bool opt_reckless_slave = 0; static bool opt_do_pstack = 0; static ulong opt_specialflag=SPECIAL_ENGLISH; static ulong back_log,connect_timeout,concurrency; @@ -2740,6 +2745,7 @@ enum options { OPT_RPL_RECOVERY_RANK,OPT_INIT_RPL_ROLE, OPT_RELAY_LOG, OPT_RELAY_LOG_INDEX, OPT_RELAY_LOG_INFO_FILE, OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE, + OPT_RECKLESS_SLAVE, OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_CIPHER }; @@ -2850,6 +2856,7 @@ static struct option long_options[] = { #endif {"pid-file", required_argument, 0, (int) OPT_PID_FILE}, {"port", required_argument, 0, 'P'}, + {"reckless-slave", no_argument, 0, (int) OPT_RECKLESS_SLAVE}, {"replicate-do-db", required_argument, 0, (int) OPT_REPLICATE_DO_DB}, {"replicate-do-table", required_argument, 0, (int) OPT_REPLICATE_DO_TABLE}, @@ -3938,6 +3945,10 @@ static void get_options(int argc,char **argv) opt_slow_log=1; opt_slow_logname=optarg; break; + case (int)OPT_RECKLESS_SLAVE: + opt_reckless_slave = 1; + init_slave_skip_errors("all"); + break; case (int)OPT_SKIP_SLAVE_START: opt_skip_slave_start = 1; break; diff --git a/sql/slave.cc b/sql/slave.cc index 25b29732000..045ba57d8c7 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -191,11 +191,22 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log, pos = rli->relay_log_pos; // already inited else rli->relay_log_pos = pos; - if (rli->relay_log.find_first_log(&rli->linfo,log)) + + // test to see if the previous run was with the skip of purging + // if yes, we do not purge when we restart + if (rli->relay_log.find_first_log(&rli->linfo,"")) { *errmsg="Could not find first log during relay log initialization"; goto err; } + if (strcmp(log,rli->linfo.log_file_name)) + rli->skip_log_purge=1; + + if (rli->relay_log.find_first_log(&rli->linfo,log)) + { + *errmsg="Could not find target log during relay log initialization"; + goto err; + } strnmov(rli->relay_log_name,rli->linfo.log_file_name, sizeof(rli->relay_log_name)); // to make end_io_cache(&rli->cache_buf) safe in all cases @@ -2497,6 +2508,15 @@ Log_event* next_event(RELAY_LOG_INFO* rli) return ev; } DBUG_ASSERT(thd==rli->sql_thd); + if (opt_reckless_slave) + cur_log->error = 0; + if ( cur_log->error < 0) + { + errmsg = "slave SQL thread aborted because of I/O error"; + goto err; + } + + if (!cur_log->error) /* EOF */ { /* @@ -2605,12 +2625,12 @@ event(errno=%d,cur_log->error=%d)", my_errno,cur_log->error); // set read position to the beginning of the event my_b_seek(cur_log,rli->relay_log_pos+rli->pending); - // no need to hog the mutex while we sleep - pthread_mutex_unlock(&rli->data_lock); - safe_sleep(rli->sql_thd,1,(CHECK_KILLED_FUNC)sql_slave_killed, - (void*)rli); - pthread_mutex_lock(&rli->data_lock); + /* otherwise, we have had a partial read */ + /* TODO; see if there is a way to do this without this goto */ + errmsg = "Aborting slave SQL thread because of partial event read"; + goto err; } + } if (!errmsg && was_killed) errmsg = "slave SQL thread was killed"; diff --git a/sql/slave.h b/sql/slave.h index 354fc46e99d..b70ca6f6d00 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -30,7 +30,7 @@ extern bool use_slave_mask; extern char* slave_load_tmpdir; extern my_string master_info_file,relay_log_info_file; extern my_string opt_relay_logname, opt_relaylog_index_name; -extern bool opt_skip_slave_start; +extern bool opt_skip_slave_start, opt_reckless_slave; extern ulong relay_log_space_limit; struct st_master_info; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8012768e508..63bfb217b52 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -613,7 +613,7 @@ query: thd->lex.sql_command = SQLCOM_EMPTY_QUERY; } } - | verb_clause END_OF_INPUT {} + | verb_clause END_OF_INPUT {}; verb_clause: alter @@ -651,7 +651,7 @@ verb_clause: | handler | unlock | update - | use + | use; /* change master */ @@ -661,12 +661,12 @@ change: LEX *lex = Lex; lex->sql_command = SQLCOM_CHANGE_MASTER; memset(&lex->mi, 0, sizeof(lex->mi)); - } master_defs + } master_defs; master_defs: master_def | - master_defs ',' master_def + master_defs ',' master_def; master_def: MASTER_HOST_SYM EQ TEXT_STRING @@ -712,7 +712,7 @@ master_def: RELAY_LOG_POS_SYM EQ ULONG_NUM { Lex->mi.relay_log_pos = $3; - } + }; /* create a table */ @@ -773,11 +773,11 @@ create: LEX *lex=Lex; lex->udf.returns=(Item_result) $7; lex->udf.dl=$9.str; - } + }; create2: '(' field_list ')' opt_create_table_options create3 {} - | opt_create_table_options create3 {} + | opt_create_table_options create3 {}; create3: /* empty */ {} @@ -787,34 +787,34 @@ create3: lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; mysql_init_select(lex); } - select_options select_item_list opt_select_from union {} + select_options select_item_list opt_select_from union {}; opt_as: /* empty */ {} - | AS {} + | AS {}; opt_table_options: /* empty */ { $$= 0; } - | table_options { $$= $1;} + | table_options { $$= $1;}; table_options: table_option { $$=$1; } - | table_option table_options { $$= $1 | $2; } + | table_option table_options { $$= $1 | $2; }; table_option: - TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; } + TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; }; opt_if_not_exists: /* empty */ { $$= 0; } - | IF NOT EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; } + | IF NOT EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; }; opt_create_table_options: /* empty */ - | create_table_options + | create_table_options; create_table_options: create_table_option - | create_table_option create_table_options + | create_table_option create_table_options; create_table_option: TYPE_SYM EQ table_types { Lex->create_info.db_type= $3; } @@ -847,7 +847,7 @@ create_table_option: } | INSERT_METHOD EQ merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;} | DATA_SYM DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.data_file_name= $4.str; } - | INDEX DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.index_file_name= $4.str; } + | INDEX DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.index_file_name= $4.str; }; table_types: ISAM_SYM { $$= DB_TYPE_ISAM; } @@ -855,40 +855,40 @@ table_types: | MERGE_SYM { $$= DB_TYPE_MRG_MYISAM; } | HEAP_SYM { $$= DB_TYPE_HEAP; } | BERKELEY_DB_SYM { $$= DB_TYPE_BERKELEY_DB; } - | INNOBASE_SYM { $$= DB_TYPE_INNODB; } + | INNOBASE_SYM { $$= DB_TYPE_INNODB; }; row_types: DEFAULT { $$= ROW_TYPE_DEFAULT; } | FIXED_SYM { $$= ROW_TYPE_FIXED; } | DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; } - | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; } + | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; }; raid_types: RAID_STRIPED_SYM { $$= RAID_TYPE_0; } | RAID_0_SYM { $$= RAID_TYPE_0; } - | ULONG_NUM { $$=$1;} + | ULONG_NUM { $$=$1;}; merge_insert_types: NO_SYM { $$= MERGE_INSERT_DISABLED; } | FIRST_SYM { $$= MERGE_INSERT_TO_FIRST; } - | LAST_SYM { $$= MERGE_INSERT_TO_LAST; } + | LAST_SYM { $$= MERGE_INSERT_TO_LAST; }; opt_select_from: /* empty */ - | select_from select_lock_type + | select_from select_lock_type; udf_func_type: /* empty */ { $$ = UDFTYPE_FUNCTION; } - | AGGREGATE_SYM { $$ = UDFTYPE_AGGREGATE; } + | AGGREGATE_SYM { $$ = UDFTYPE_AGGREGATE; }; udf_type: STRING_SYM {$$ = (int) STRING_RESULT; } | REAL {$$ = (int) REAL_RESULT; } - | INT_SYM {$$ = (int) INT_RESULT; } + | INT_SYM {$$ = (int) INT_RESULT; }; field_list: field_list_item - | field_list ',' field_list_item + | field_list ',' field_list_item; field_list_item: @@ -910,11 +910,11 @@ field_list_item: | opt_constraint CHECK_SYM '(' expr ')' { Lex->col_list.empty(); /* Alloced by sql_alloc */ - } + }; opt_constraint: /* empty */ - | CONSTRAINT opt_ident + | CONSTRAINT opt_ident; field_spec: field_ident @@ -932,7 +932,7 @@ field_spec: lex->default_value,lex->change, lex->interval)) YYABORT; - } + }; type: int_type opt_len field_options { Lex->length=$2; $$=$1; } @@ -991,73 +991,73 @@ type: LEX *lex=Lex; lex->interval=typelib(lex->interval_list); $$=FIELD_TYPE_SET; - } + }; char: CHAR_SYM {} | NCHAR_SYM {} - | NATIONAL_SYM CHAR_SYM {} + | NATIONAL_SYM CHAR_SYM {}; varchar: char VARYING {} | VARCHAR {} | NATIONAL_SYM VARCHAR {} - | NCHAR_SYM VARCHAR {} + | NCHAR_SYM VARCHAR {}; int_type: INT_SYM { $$=FIELD_TYPE_LONG; } | TINYINT { $$=FIELD_TYPE_TINY; } | SMALLINT { $$=FIELD_TYPE_SHORT; } | MEDIUMINT { $$=FIELD_TYPE_INT24; } - | BIGINT { $$=FIELD_TYPE_LONGLONG; } + | BIGINT { $$=FIELD_TYPE_LONGLONG; }; real_type: REAL { $$= current_thd->sql_mode & MODE_REAL_AS_FLOAT ? FIELD_TYPE_FLOAT : FIELD_TYPE_DOUBLE; } | DOUBLE_SYM { $$=FIELD_TYPE_DOUBLE; } - | DOUBLE_SYM PRECISION { $$=FIELD_TYPE_DOUBLE; } + | DOUBLE_SYM PRECISION { $$=FIELD_TYPE_DOUBLE; }; float_options: /* empty */ {} | '(' NUM ')' { Lex->length=$2.str; } - | precision {} + | precision {}; precision: '(' NUM ',' NUM ')' { LEX *lex=Lex; lex->length=$2.str; lex->dec=$4.str; - } + }; field_options: /* empty */ {} - | field_opt_list {} + | field_opt_list {}; field_opt_list: field_opt_list field_option {} - | field_option {} + | field_option {}; field_option: SIGNED_SYM {} | UNSIGNED { Lex->type|= UNSIGNED_FLAG;} - | ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; } + | ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; }; opt_len: /* empty */ { $$=(char*) 0; } /* use default length */ - | '(' NUM ')' { $$=$2.str; } + | '(' NUM ')' { $$=$2.str; }; opt_precision: /* empty */ {} - | precision {} + | precision {}; opt_attribute: /* empty */ {} - | opt_attribute_list {} + | opt_attribute_list {}; opt_attribute_list: opt_attribute_list attribute {} - | attribute + | attribute; attribute: NULL_SYM { Lex->type&= ~ NOT_NULL_FLAG; } @@ -1066,40 +1066,40 @@ attribute: | AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; } | PRIMARY_SYM KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; } | UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; } - | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; } + | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }; opt_binary: /* empty */ {} - | BINARY { Lex->type|=BINARY_FLAG; } + | BINARY { Lex->type|=BINARY_FLAG; }; references: REFERENCES table_ident opt_on_delete {} | REFERENCES table_ident '(' key_list ')' opt_on_delete { Lex->col_list.empty(); /* Alloced by sql_alloc */ - } + }; opt_on_delete: /* empty */ {} - | opt_on_delete_list {} + | opt_on_delete_list {}; opt_on_delete_list: opt_on_delete_list opt_on_delete_item {} - | opt_on_delete_item {} + | opt_on_delete_item {}; opt_on_delete_item: ON DELETE_SYM delete_option {} | ON UPDATE_SYM delete_option {} | MATCH FULL {} - | MATCH PARTIAL {} + | MATCH PARTIAL {}; delete_option: RESTRICT {} | CASCADE {} | SET NULL_SYM {} | NO_SYM ACTION {} - | SET DEFAULT {} + | SET DEFAULT {}; key_type: opt_constraint PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; } @@ -1107,37 +1107,37 @@ key_type: | FULLTEXT_SYM { $$= Key::FULLTEXT; } | FULLTEXT_SYM key_or_index { $$= Key::FULLTEXT; } | opt_constraint UNIQUE_SYM { $$= Key::UNIQUE; } - | opt_constraint UNIQUE_SYM key_or_index { $$= Key::UNIQUE; } + | opt_constraint UNIQUE_SYM key_or_index { $$= Key::UNIQUE; }; key_or_index: KEY_SYM {} - | INDEX {} + | INDEX {}; keys_or_index: KEYS {} | INDEX {} - | INDEXES {} + | INDEXES {}; opt_unique_or_fulltext: /* empty */ { $$= Key::MULTIPLE; } | UNIQUE_SYM { $$= Key::UNIQUE; } - | FULLTEXT_SYM { $$= Key::FULLTEXT; } + | FULLTEXT_SYM { $$= Key::FULLTEXT; }; key_list: key_list ',' key_part order_dir { Lex->col_list.push_back($3); } - | key_part order_dir { Lex->col_list.push_back($1); } + | key_part order_dir { Lex->col_list.push_back($1); }; key_part: ident { $$=new key_part_spec($1.str); } - | ident '(' NUM ')' { $$=new key_part_spec($1.str,(uint) atoi($3.str)); } + | ident '(' NUM ')' { $$=new key_part_spec($1.str,(uint) atoi($3.str)); }; opt_ident: /* empty */ { $$=(char*) 0; } /* Defaultlength */ - | field_ident { $$=$1.str; } + | field_ident { $$=$1.str; }; string_list: text_string { Lex->interval_list.push_back($1); } - | string_list ',' text_string { Lex->interval_list.push_back($3); } + | string_list ',' text_string { Lex->interval_list.push_back($3); }; /* ** Alter table @@ -1167,14 +1167,14 @@ alter: lex->alter_keys_onoff=LEAVE_AS_IS; lex->simple_alter=1; } - alter_list + alter_list; alter_list: | alter_list_item - | alter_list ',' alter_list_item + | alter_list ',' alter_list_item; add_column: - ADD opt_column { Lex->change=0; } + ADD opt_column { Lex->change=0; }; alter_list_item: add_column field_list_item opt_place { Lex->simple_alter=0; } @@ -1245,30 +1245,30 @@ alter_list_item: lex->simple_alter=0; } | create_table_options { Lex->simple_alter=0; } - | order_clause { Lex->simple_alter=0; } + | order_clause { Lex->simple_alter=0; }; opt_column: /* empty */ {} - | COLUMN_SYM {} + | COLUMN_SYM {}; opt_ignore: /* empty */ { Lex->duplicates=DUP_ERROR; } - | IGNORE_SYM { Lex->duplicates=DUP_IGNORE; } + | IGNORE_SYM { Lex->duplicates=DUP_IGNORE; }; opt_restrict: /* empty */ {} | RESTRICT {} - | CASCADE {} + | CASCADE {}; opt_place: /* empty */ {} | AFTER_SYM ident { store_position_for_column($2.str); } - | FIRST_SYM { store_position_for_column(first_keyword); } + | FIRST_SYM { store_position_for_column(first_keyword); }; opt_to: /* empty */ {} | TO_SYM {} - | AS {} + | AS {}; slave: SLAVE START_SYM slave_thread_opts @@ -1286,7 +1286,7 @@ slave: }; slave_thread_opts: slave_thread_opt - | slave_thread_opts ',' slave_thread_opt + | slave_thread_opts ',' slave_thread_opt; slave_thread_opt: /*empty*/ {} @@ -1297,7 +1297,7 @@ slave_thread_opt: | IO_THREAD { Lex->slave_thd_opt|=SLAVE_IO; - } + }; restore: RESTORE_SYM table_or_tables @@ -1307,7 +1307,7 @@ restore: table_list FROM TEXT_STRING { Lex->backup_dir = $6.str; - } + }; backup: BACKUP_SYM table_or_tables { @@ -1316,7 +1316,7 @@ backup: table_list TO_SYM TEXT_STRING { Lex->backup_dir = $6.str; - } + }; repair: REPAIR table_or_tables @@ -1325,20 +1325,20 @@ repair: lex->sql_command = SQLCOM_REPAIR; lex->check_opt.init(); } - table_list opt_mi_repair_type + table_list opt_mi_repair_type; opt_mi_repair_type: /* empty */ { Lex->check_opt.flags = T_MEDIUM; } - | mi_repair_types {} + | mi_repair_types {}; mi_repair_types: mi_repair_type {} - | mi_repair_type mi_repair_types {} + | mi_repair_type mi_repair_types {}; mi_repair_type: QUICK { Lex->check_opt.flags|= T_QUICK; } | EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } - | USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; } + | USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; }; analyze: ANALYZE_SYM table_or_tables @@ -1347,7 +1347,7 @@ analyze: lex->sql_command = SQLCOM_ANALYZE; lex->check_opt.init(); } - table_list opt_mi_check_type + table_list opt_mi_check_type; check: CHECK_SYM table_or_tables @@ -1356,22 +1356,22 @@ check: lex->sql_command = SQLCOM_CHECK; lex->check_opt.init(); } - table_list opt_mi_check_type + table_list opt_mi_check_type; opt_mi_check_type: /* empty */ { Lex->check_opt.flags = T_MEDIUM; } - | mi_check_types {} + | mi_check_types {}; mi_check_types: mi_check_type {} - | mi_check_type mi_check_types {} + | mi_check_type mi_check_types {}; mi_check_type: QUICK { Lex->check_opt.flags|= T_QUICK; } | FAST_SYM { Lex->check_opt.flags|= T_FAST; } | MEDIUM_SYM { Lex->check_opt.flags|= T_MEDIUM; } | EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } - | CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; } + | CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; }; optimize: OPTIMIZE table_or_tables @@ -1380,25 +1380,25 @@ optimize: lex->sql_command = SQLCOM_OPTIMIZE; lex->check_opt.init(); } - table_list opt_mi_check_type + table_list opt_mi_check_type; rename: RENAME table_or_tables { Lex->sql_command=SQLCOM_RENAME_TABLE; } - table_to_table_list + table_to_table_list; table_to_table_list: table_to_table - | table_to_table_list ',' table_to_table + | table_to_table_list ',' table_to_table; table_to_table: table_ident TO_SYM table_ident { if (!add_table_to_list($1,NULL,1,TL_IGNORE) || !add_table_to_list($3,NULL,1,TL_IGNORE)) YYABORT; - } + }; /* Select : retrieve data from table @@ -1406,12 +1406,12 @@ table_to_table: select: - select_init { Lex->sql_command=SQLCOM_SELECT; } + select_init { Lex->sql_command=SQLCOM_SELECT; }; select_init: SELECT_SYM select_part2 { Select->braces=false; } union | - '(' SELECT_SYM select_part2 ')' { Select->braces=true;} union_opt + '(' SELECT_SYM select_part2 ')' { Select->braces=true;} union_opt; select_part2: @@ -1420,25 +1420,25 @@ select_part2: lex->lock_option=TL_READ; mysql_init_select(lex); } - select_options select_item_list select_into select_lock_type + select_options select_item_list select_into select_lock_type; select_into: limit_clause {} | select_from | opt_into select_from - | select_from opt_into + | select_from opt_into; select_from: - FROM join_table_list where_clause group_clause having_clause opt_order_clause limit_clause procedure_clause + FROM join_table_list where_clause group_clause having_clause opt_order_clause limit_clause procedure_clause; select_options: /* empty*/ - | select_option_list + | select_option_list; select_option_list: select_option_list select_option - | select_option + | select_option; select_option: STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; } @@ -1450,14 +1450,14 @@ select_option: | SQL_CALC_FOUND_ROWS { if (Select != &Lex->select_lex) YYABORT; Select->options|= OPTION_FOUND_ROWS; } | SQL_NO_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; current_thd->safe_to_cache_query=0; } | SQL_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; Select->options |= OPTION_TO_QUERY_CACHE; } - | ALL {} + | ALL {}; select_lock_type: /* empty */ | FOR_SYM UPDATE_SYM { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_WRITE; current_thd->safe_to_cache_query=0; } | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM - { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; } + { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; }; select_item_list: select_item_list ',' select_item @@ -1466,7 +1466,7 @@ select_item_list: { if (add_item_to_list(new Item_field(NULL,NULL,"*"))) YYABORT; - } + }; select_item: @@ -1478,32 +1478,32 @@ select_item: $2->set_name($4.str); else if (!$2->name) $2->set_name($1,(uint) ($3 - $1)); - } + }; remember_name: - { $$=(char*) Lex->tok_start; } + { $$=(char*) Lex->tok_start; }; remember_end: - { $$=(char*) Lex->tok_end; } + { $$=(char*) Lex->tok_end; }; select_item2: table_wild { $$=$1; } /* table.* */ - | expr { $$=$1; } + | expr { $$=$1; }; select_alias: { $$.str=0;} | AS ident { $$=$2; } | AS TEXT_STRING { $$=$2; } | ident { $$=$1; } - | TEXT_STRING { $$=$1; } + | TEXT_STRING { $$=$1; }; optional_braces: /* empty */ {} - | '(' ')' {} + | '(' ')' {}; /* all possible expressions */ expr: expr_expr {$$ = $1; } - | simple_expr {$$ = $1; } + | simple_expr {$$ = $1; }; /* expressions that begin with 'expr' */ expr_expr: @@ -1543,7 +1543,7 @@ expr_expr: | expr '+' INTERVAL_SYM expr interval { $$= new Item_date_add_interval($1,$4,$5,0); } | expr '-' INTERVAL_SYM expr interval - { $$= new Item_date_add_interval($1,$4,$5,1); } + { $$= new Item_date_add_interval($1,$4,$5,1); }; /* expressions that begin with 'expr' that do NOT follow IN_SYM */ no_in_expr: @@ -1580,7 +1580,7 @@ no_in_expr: { $$= new Item_date_add_interval($1,$4,$5,0); } | no_in_expr '-' INTERVAL_SYM expr interval { $$= new Item_date_add_interval($1,$4,$5,1); } - | simple_expr + | simple_expr; /* expressions that begin with 'expr' that does NOT follow AND */ no_and_expr: @@ -1620,7 +1620,7 @@ no_and_expr: { $$= new Item_date_add_interval($1,$4,$5,0); } | no_and_expr '-' INTERVAL_SYM expr interval { $$= new Item_date_add_interval($1,$4,$5,1); } - | simple_expr + | simple_expr; simple_expr: simple_ident @@ -1888,11 +1888,11 @@ simple_expr: current_thd->safe_to_cache_query=0; } | EXTRACT_SYM '(' interval FROM expr ')' - { $$=new Item_extract( $3, $5); } + { $$=new Item_extract( $3, $5); }; udf_expr_list: /* empty */ { $$= NULL; } - | expr_list { $$= $1;} + | expr_list { $$= $1;}; sum_expr: AVG_SYM '(' in_sum_expr ')' @@ -1916,7 +1916,7 @@ sum_expr: | STD_SYM '(' in_sum_expr ')' { $$=new Item_sum_std($3); } | SUM_SYM '(' in_sum_expr ')' - { $$=new Item_sum_sum($3); } + { $$=new Item_sum_sum($3); }; in_sum_expr: { Select->in_sum_expr++; } @@ -1924,7 +1924,7 @@ in_sum_expr: { Select->in_sum_expr--; $$=$2; - } + }; cast_type: BINARY { $$=ITEM_CAST_BINARY; } @@ -1934,42 +1934,42 @@ cast_type: | UNSIGNED INT_SYM { $$=ITEM_CAST_UNSIGNED_INT; } | DATE_SYM { $$=ITEM_CAST_DATE; } | TIME_SYM { $$=ITEM_CAST_TIME; } - | DATETIME { $$=ITEM_CAST_DATETIME; } + | DATETIME { $$=ITEM_CAST_DATETIME; }; expr_list: { Select->expr_list.push_front(new List); } expr_list2 - { $$= Select->expr_list.pop(); } + { $$= Select->expr_list.pop(); }; expr_list2: expr { Select->expr_list.head()->push_back($1); } - | expr_list2 ',' expr { Select->expr_list.head()->push_back($3); } + | expr_list2 ',' expr { Select->expr_list.head()->push_back($3); }; ident_list_arg: ident_list { $$= $1; } - | '(' ident_list ')' { $$= $2; } + | '(' ident_list ')' { $$= $2; }; ident_list: { Select->expr_list.push_front(new List); } ident_list2 - { $$= Select->expr_list.pop(); } + { $$= Select->expr_list.pop(); }; ident_list2: simple_ident { Select->expr_list.head()->push_back($1); } - | ident_list2 ',' simple_ident { Select->expr_list.head()->push_back($3); } + | ident_list2 ',' simple_ident { Select->expr_list.head()->push_back($3); }; opt_expr: /* empty */ { $$= NULL; } - | expr { $$= $1; } + | expr { $$= $1; }; opt_else: /* empty */ { $$= NULL; } - | ELSE expr { $$= $2; } + | ELSE expr { $$= $2; }; when_list: { Select->when_list.push_front(new List); } when_list2 - { $$= Select->when_list.pop(); } + { $$= Select->when_list.pop(); }; when_list2: expr THEN_SYM expr @@ -1983,11 +1983,11 @@ when_list2: SELECT_LEX *sel=Select; sel->when_list.head()->push_back($3); sel->when_list.head()->push_back($5); - } + }; opt_pad: /* empty */ { $$=new Item_string(" ",1); } - | expr { $$=$1; } + | expr { $$=$1; }; join_table_list: '(' join_table_list ')' { $$=$2; } @@ -2029,12 +2029,12 @@ join_table_list: | join_table_list NATURAL RIGHT opt_outer JOIN_SYM join_table { add_join_natural($6,$1); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$1; } | join_table_list NATURAL JOIN_SYM join_table - { add_join_natural($1,$4); $$=$4; } + { add_join_natural($1,$4); $$=$4; }; normal_join: ',' {} | JOIN_SYM {} - | CROSS JOIN_SYM {} + | CROSS JOIN_SYM {}; join_table: { @@ -2048,11 +2048,11 @@ join_table: sel->ignore_index_ptr))) YYABORT; } | '{' ident join_table LEFT OUTER JOIN_SYM join_table ON expr '}' - { add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; } + { add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; }; opt_outer: /* empty */ {} - | OUTER {} + | OUTER {}; opt_key_definition: /* empty */ {} @@ -2067,11 +2067,11 @@ opt_key_definition: SELECT_LEX *sel=Select; sel->ignore_index= *$2; sel->ignore_index_ptr= &sel->ignore_index; - } + }; key_usage_list: key_or_index { Select->interval_list.empty(); } '(' key_usage_list2 ')' - { $$= &Select->interval_list; } + { $$= &Select->interval_list; }; key_usage_list2: key_usage_list2 ',' ident @@ -2079,7 +2079,7 @@ key_usage_list2: | ident { Select->interval_list.push_back(new String((const char*) $1.str,$1.length)); } | PRIMARY_SYM - { Select->interval_list.push_back(new String("PRIMARY",7)); } + { Select->interval_list.push_back(new String("PRIMARY",7)); }; using_list: ident @@ -2093,7 +2093,7 @@ using_list: SELECT_LEX *sel=Select; if (!($$= new Item_cond_and(new Item_func_eq(new Item_field(sel->db1,sel->table1,$3.str), new Item_field(sel->db2,sel->table2,$3.str)), $1))) YYABORT; - } + }; interval: DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; } @@ -2108,22 +2108,22 @@ interval: | MONTH_SYM { $$=INTERVAL_MONTH; } | SECOND_SYM { $$=INTERVAL_SECOND; } | YEAR_MONTH_SYM { $$=INTERVAL_YEAR_MONTH; } - | YEAR_SYM { $$=INTERVAL_YEAR; } + | YEAR_SYM { $$=INTERVAL_YEAR; }; table_alias: /* empty */ | AS - | EQ + | EQ; opt_table_alias: /* empty */ { $$=0; } | table_alias ident - { $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); } + { $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); }; where_clause: /* empty */ { Select->where= 0; } - | WHERE expr { Select->where= $2; } + | WHERE expr { Select->where= $2; }; having_clause: /* empty */ @@ -2131,11 +2131,11 @@ having_clause: { SELECT_LEX *sel=Select; sel->having= $3; sel->create_refs=0; - } + }; opt_escape: ESCAPE_SYM TEXT_STRING { $$= $2.str; } - | /* empty */ { $$= (char*) "\\"; } + | /* empty */ { $$= (char*) "\\"; }; /* @@ -2144,13 +2144,13 @@ opt_escape: group_clause: /* empty */ - | GROUP BY group_list + | GROUP BY group_list; group_list: group_list ',' order_ident order_dir { if (add_group_to_list($3,(bool) $4)) YYABORT; } | order_ident order_dir - { if (add_group_to_list($1,(bool) $2)) YYABORT; } + { if (add_group_to_list($1,(bool) $2)) YYABORT; }; /* Order by statement in select @@ -2158,7 +2158,7 @@ group_list: opt_order_clause: /* empty */ - | order_clause + | order_clause; order_clause: ORDER_SYM BY @@ -2167,18 +2167,18 @@ order_clause: if (lex->sql_command == SQLCOM_MULTI_UPDATE) YYABORT; lex->select->sort_default=1; - } order_list + } order_list; order_list: order_list ',' order_ident order_dir { if (add_order_to_list($3,(bool) $4)) YYABORT; } | order_ident order_dir - { if (add_order_to_list($1,(bool) $2)) YYABORT; } + { if (add_order_to_list($1,(bool) $2)) YYABORT; }; order_dir: /* empty */ { $$ = 1; } | ASC { $$ =1; } - | DESC { $$ =0; } + | DESC { $$ =0; }; limit_clause: @@ -2193,7 +2193,7 @@ limit_clause: { SELECT_LEX *sel=Select; sel->select_limit= $4; sel->offset_limit=$2; - } + }; delete_limit_clause: /* empty */ @@ -2204,20 +2204,20 @@ delete_limit_clause: lex->select->select_limit= HA_POS_ERROR; } | LIMIT ulonglong_num - { Select->select_limit= (ha_rows) $2; } + { Select->select_limit= (ha_rows) $2; }; ULONG_NUM: NUM { $$= strtoul($1.str,NULL,10); } | ULONGLONG_NUM { $$= (ulong) strtoull($1.str,NULL,10); } | REAL_NUM { $$= strtoul($1.str,NULL,10); } - | FLOAT_NUM { $$= strtoul($1.str,NULL,10); } + | FLOAT_NUM { $$= strtoul($1.str,NULL,10); }; ulonglong_num: NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } | ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); } | LONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } | REAL_NUM { $$= strtoull($1.str,NULL,10); } - | FLOAT_NUM { $$= strtoull($1.str,NULL,10); } + | FLOAT_NUM { $$= strtoull($1.str,NULL,10); }; procedure_clause: /* empty */ @@ -2231,16 +2231,16 @@ procedure_clause: YYABORT; current_thd->safe_to_cache_query=0; } - '(' procedure_list ')' + '(' procedure_list ')'; procedure_list: /* empty */ {} - | procedure_list2 {} + | procedure_list2 {}; procedure_list2: procedure_list2 ',' procedure_item - | procedure_item + | procedure_item; procedure_item: remember_name expr @@ -2249,7 +2249,7 @@ procedure_item: YYABORT; if (!$2->name) $2->set_name($1,(uint) ((char*) Lex->tok_end - $1)); - } + }; opt_into: INTO OUTFILE TEXT_STRING @@ -2262,7 +2262,7 @@ opt_into: { if (!(Lex->exchange= new sql_exchange($3.str,1))) YYABORT; - } + }; /* DO statement @@ -2275,7 +2275,7 @@ do: DO_SYM if (!(lex->insert_list = new List_item)) YYABORT; } - values + values; /* Drop : delete tables or index */ @@ -2309,27 +2309,27 @@ drop: LEX *lex=Lex; lex->sql_command = SQLCOM_DROP_FUNCTION; lex->udf.name=$3.str; - } + }; table_list: table_name - | table_list ',' table_name + | table_list ',' table_name; table_name: table_ident - { if (!add_table_to_list($1,NULL,1)) YYABORT; } + { if (!add_table_to_list($1,NULL,1)) YYABORT; }; if_exists: /* empty */ { $$=0; } - | IF EXISTS { $$= 1; } + | IF EXISTS { $$= 1; }; /* ** Insert : add new data to table */ insert: - INSERT { Lex->sql_command = SQLCOM_INSERT; } insert_lock_option opt_ignore insert2 insert_field_spec + INSERT { Lex->sql_command = SQLCOM_INSERT; } insert_lock_option opt_ignore insert2 insert_field_spec; replace: REPLACE @@ -2338,21 +2338,21 @@ replace: lex->sql_command = SQLCOM_REPLACE; lex->duplicates= DUP_REPLACE; } - replace_lock_option insert2 insert_field_spec + replace_lock_option insert2 insert_field_spec; insert_lock_option: /* empty */ { Lex->lock_option= TL_WRITE_CONCURRENT_INSERT; } | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } | DELAYED_SYM { Lex->lock_option= TL_WRITE_DELAYED; } - | HIGH_PRIORITY { Lex->lock_option= TL_WRITE; } + | HIGH_PRIORITY { Lex->lock_option= TL_WRITE; }; replace_lock_option: opt_low_priority {} - | DELAYED_SYM { Lex->lock_option= TL_WRITE_DELAYED; } + | DELAYED_SYM { Lex->lock_option= TL_WRITE_DELAYED; }; insert2: INTO insert_table {} - | insert_table {} + | insert_table {}; insert_table: table_name @@ -2361,7 +2361,7 @@ insert_table: lex->field_list.empty(); lex->many_values.empty(); lex->insert_list=0; - } + }; insert_field_spec: opt_field_spec insert_values {} @@ -2372,16 +2372,16 @@ insert_field_spec: lex->many_values.push_back(lex->insert_list)) YYABORT; } - ident_eq_list + ident_eq_list; opt_field_spec: /* empty */ { } | '(' fields ')' { } - | '(' ')' { } + | '(' ')' { }; fields: fields ',' insert_ident { Lex->field_list.push_back($3); } - | insert_ident { Lex->field_list.push_back($1); } + | insert_ident { Lex->field_list.push_back($1); }; insert_values: VALUES values_list {} @@ -2393,16 +2393,17 @@ insert_values: lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; mysql_init_select(lex); } - select_options select_item_list select_from select_lock_type union {} + select_options select_item_list select_from select_lock_type + union {}; values_list: values_list ',' no_braces - | no_braces + | no_braces; ident_eq_list: ident_eq_list ',' ident_eq_value | - ident_eq_value + ident_eq_value; ident_eq_value: simple_ident equal expr @@ -2411,10 +2412,10 @@ ident_eq_value: if (lex->field_list.push_back($1) || lex->insert_list->push_back($3)) YYABORT; - } + }; equal: EQ {} - | SET_VAR {} + | SET_VAR {}; no_braces: '(' @@ -2427,11 +2428,11 @@ no_braces: LEX *lex=Lex; if (lex->many_values.push_back(lex->insert_list)) YYABORT; - } + }; opt_values: /* empty */ {} - | values + | values; values: values ',' expr @@ -2443,7 +2444,7 @@ values: { if (Lex->insert_list->push_back($1)) YYABORT; - } + }; /* Update rows in a table */ @@ -2456,7 +2457,7 @@ update: lex->select->order_list.first=0; lex->select->order_list.next= (byte**) &lex->select->order_list.first; } - opt_low_priority opt_ignore join_table_list SET update_list where_clause opt_order_clause delete_limit_clause + opt_low_priority opt_ignore join_table_list SET update_list where_clause opt_order_clause delete_limit_clause; update_list: update_list ',' simple_ident equal expr @@ -2468,11 +2469,11 @@ update_list: { if (add_item_to_list($1) || add_value_to_list($3)) YYABORT; - } + }; opt_low_priority: /* empty */ { Lex->lock_option= current_thd->update_lock_default; } - | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } + | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; }; /* Delete rows from a table */ @@ -2486,7 +2487,7 @@ delete: lex->select->order_list.first=0; lex->select->order_list.next= (byte**) &lex->select->order_list.first; } - opt_delete_options single_multi {} + opt_delete_options single_multi {}; single_multi: FROM table_name where_clause opt_order_clause delete_limit_clause {} @@ -2495,11 +2496,11 @@ single_multi: FROM join_table_list where_clause | FROM table_wild_list { mysql_init_multi_delete(Lex); } - USING join_table_list where_clause + USING join_table_list where_clause; table_wild_list: table_wild_one {} - | table_wild_list ',' table_wild_one {} + | table_wild_list ',' table_wild_one {}; table_wild_one: ident opt_wild @@ -2511,20 +2512,20 @@ table_wild_one: { if (!add_table_to_list(new Table_ident($1,$3,0),NULL,1,TL_WRITE)) YYABORT; - } + }; opt_wild: /* empty */ {} - | '.' '*' {} + | '.' '*' {}; opt_delete_options: /* empty */ {} - | opt_delete_option opt_delete_options {} + | opt_delete_option opt_delete_options {}; opt_delete_option: QUICK { Select->options|= OPTION_QUICK; } - | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } + | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; }; truncate: TRUNCATE_SYM opt_table_sym table_name @@ -2535,15 +2536,15 @@ truncate: lex->select->order_list.elements=0; lex->select->order_list.first=0; lex->select->order_list.next= (byte**) &lex->select->order_list.first; - lex->lock_option= current_thd->update_lock_default; } + lex->lock_option= current_thd->update_lock_default; }; opt_table_sym: /* empty */ - | TABLE_SYM + | TABLE_SYM; /* Show things */ -show: SHOW { Lex->wild=0;} show_param +show: SHOW { Lex->wild=0;} show_param; show_param: DATABASES wild @@ -2637,31 +2638,31 @@ show_param: | SLAVE STATUS_SYM { Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; - } + }; opt_db: /* empty */ { $$= 0; } - | from_or_in ident { $$= $2.str; } + | from_or_in ident { $$= $2.str; }; wild: /* empty */ - | LIKE text_string { Lex->wild= $2; } + | LIKE text_string { Lex->wild= $2; }; opt_full: /* empty */ { Lex->verbose=0; } - | FULL { Lex->verbose=1; } + | FULL { Lex->verbose=1; }; from_or_in: FROM - | IN_SYM + | IN_SYM; binlog_in: /* empty */ { Lex->mi.log_file_name = 0; } - | IN_SYM TEXT_STRING { Lex->mi.log_file_name = $2.str; } + | IN_SYM TEXT_STRING { Lex->mi.log_file_name = $2.str; }; binlog_from: /* empty */ { Lex->mi.pos = 4; /* skip magic number */ } - | FROM ulonglong_num { Lex->mi.pos = $2; } + | FROM ulonglong_num { Lex->mi.pos = $2; }; /* A Oracle compatible synonym for show */ @@ -2676,17 +2677,19 @@ describe: YYABORT; } opt_describe_column - | describe_command select { Lex->select_lex.options|= SELECT_DESCRIBE; } + | describe_command select + { Lex->select_lex.options|= SELECT_DESCRIBE; }; describe_command: DESC - | DESCRIBE + | DESCRIBE; opt_describe_column: /* empty */ {} | text_string { Lex->wild= $1; } - | ident { Lex->wild= new String((const char*) $1.str,$1.length); } + | ident + { Lex->wild= new String((const char*) $1.str,$1.length); }; /* flush things */ @@ -2697,11 +2700,11 @@ flush: LEX *lex=Lex; lex->sql_command= SQLCOM_FLUSH; lex->type=0; } - flush_options + flush_options; flush_options: flush_options ',' flush_option - | flush_option + | flush_option; flush_option: table_or_tables { Lex->type|= REFRESH_TABLES; } opt_table_list @@ -2713,26 +2716,26 @@ flush_option: | STATUS_SYM { Lex->type|= REFRESH_STATUS; } | SLAVE { Lex->type|= REFRESH_SLAVE; } | MASTER_SYM { Lex->type|= REFRESH_MASTER; } - | DES_KEY_FILE { Lex->type|= REFRESH_DES_KEY_FILE; } + | DES_KEY_FILE { Lex->type|= REFRESH_DES_KEY_FILE; }; opt_table_list: /* empty */ {} - | table_list {} + | table_list {}; reset: RESET_SYM { LEX *lex=Lex; lex->sql_command= SQLCOM_RESET; lex->type=0; - } reset_options + } reset_options; reset_options: reset_options ',' reset_option - | reset_option + | reset_option; reset_option: SLAVE { Lex->type|= REFRESH_SLAVE; } | MASTER_SYM { Lex->type|= REFRESH_MASTER; } - | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;} + | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;}; purge: PURGE @@ -2744,7 +2747,7 @@ purge: MASTER_SYM LOGS_SYM TO_SYM TEXT_STRING { Lex->to_log = $6.str; - } + } ; /* kill threads */ @@ -2759,7 +2762,7 @@ kill: } lex->sql_command=SQLCOM_KILL; lex->thread_id= (ulong) $2->val_int(); - } + }; /* change database */ @@ -2767,7 +2770,7 @@ use: USE_SYM ident { LEX *lex=Lex; lex->sql_command=SQLCOM_CHANGE_DB; lex->select->db= $2.str; - } + }; /* import, export of files */ @@ -2798,30 +2801,30 @@ load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING LOAD DATA_SYM FROM MASTER_SYM { Lex->sql_command = SQLCOM_LOAD_MASTER_DATA; - } + }; opt_local: /* empty */ { $$=0;} - | LOCAL_SYM { $$=1;} + | LOCAL_SYM { $$=1;}; load_data_lock: /* empty */ { Lex->lock_option= current_thd->update_lock_default; } | CONCURRENT { Lex->lock_option= TL_WRITE_CONCURRENT_INSERT ; } - | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } + | LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; }; opt_duplicate: /* empty */ { Lex->duplicates=DUP_ERROR; } | REPLACE { Lex->duplicates=DUP_REPLACE; } - | IGNORE_SYM { Lex->duplicates=DUP_IGNORE; } + | IGNORE_SYM { Lex->duplicates=DUP_IGNORE; }; opt_field_term: /* empty */ - | COLUMNS field_term_list + | COLUMNS field_term_list; field_term_list: field_term_list field_term - | field_term + | field_term; field_term: TERMINATED BY text_string { Lex->exchange->field_term= $3;} @@ -2832,31 +2835,31 @@ field_term: lex->exchange->opt_enclosed=1; } | ENCLOSED BY text_string { Lex->exchange->enclosed= $3;} - | ESCAPED BY text_string { Lex->exchange->escaped= $3;} + | ESCAPED BY text_string { Lex->exchange->escaped= $3;}; opt_line_term: /* empty */ - | LINES line_term_list + | LINES line_term_list; line_term_list: line_term_list line_term - | line_term + | line_term; line_term: TERMINATED BY text_string { Lex->exchange->line_term= $3;} - | STARTING BY text_string { Lex->exchange->line_start= $3;} + | STARTING BY text_string { Lex->exchange->line_start= $3;}; opt_ignore_lines: /* empty */ | IGNORE_SYM NUM LINES - { Lex->exchange->skip_lines=atol($2.str); } + { Lex->exchange->skip_lines=atol($2.str); }; /* Common definitions */ text_literal: TEXT_STRING { $$ = new Item_string($1.str,$1.length); } | text_literal TEXT_STRING - { ((Item_string*) $1)->append($2.str,$2.length); } + { ((Item_string*) $1)->append($2.str,$2.length); }; text_string: TEXT_STRING { $$= new String($1.str,$1.length); } @@ -2864,7 +2867,7 @@ text_string: { Item *tmp = new Item_varbinary($1.str,$1.length); $$= tmp ? tmp->val_str((String*) 0) : (String*) 0; - } + }; literal: text_literal { $$ = $1; } @@ -2878,7 +2881,7 @@ literal: | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);} | DATE_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; } - | TIMESTAMP text_literal { $$ = $2; } + | TIMESTAMP text_literal { $$ = $2; }; /********************************************************************** ** Createing different items. @@ -2886,15 +2889,16 @@ literal: insert_ident: simple_ident { $$=$1; } - | table_wild { $$=$1; } + | table_wild { $$=$1; }; table_wild: ident '.' '*' { $$ = new Item_field(NullS,$1.str,"*"); } | ident '.' ident '.' '*' - { $$ = new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS : $1.str),$3.str,"*"); } + { $$ = new Item_field((current_thd->client_capabilities & + CLIENT_NO_SCHEMA ? NullS : $1.str),$3.str,"*"); }; order_ident: - expr { $$=$1; } + expr { $$=$1; }; simple_ident: ident @@ -2916,18 +2920,19 @@ simple_ident: { SELECT_LEX *sel=Select; $$ = !sel->create_refs || sel->in_sum_expr > 0 ? (Item*) new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str) : (Item*) new Item_ref((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str); - } + }; field_ident: ident { $$=$1;} | ident '.' ident { $$=$3;} /* Skipp schema name in create*/ - | '.' ident { $$=$2;} /* For Delphi */ + | '.' ident { $$=$2;} /* For Delphi */; table_ident: ident { $$=new Table_ident($1); } | ident '.' ident { $$=new Table_ident($1,$3,0);} - | '.' ident { $$=new Table_ident($2);} /* For Delphi */ + | '.' ident { $$=new Table_ident($2);} + /* For Delphi */; ident: IDENT { $$=$1; } @@ -2938,12 +2943,12 @@ ident: $$.length=$1.length; if ((lex=Lex)->next_state != STATE_END) lex->next_state=STATE_OPERATOR_OR_IDENT; - } + }; ident_or_text: ident { $$=$1;} | TEXT_STRING { $$=$1;} - | LEX_HOSTNAME { $$=$1;} + | LEX_HOSTNAME { $$=$1;}; user: ident_or_text @@ -2957,7 +2962,7 @@ user: if (!($$=(LEX_USER*) sql_alloc(sizeof(st_lex_user)))) YYABORT; $$->user = $1; $$->host=$3; - } + }; /* Keyword that we allow for identifiers */ @@ -3107,7 +3112,7 @@ keyword: | USE_FRM {} | VARIABLES {} | WORK_SYM {} - | YEAR_SYM {} + | YEAR_SYM {}; /* Option functions */ @@ -3122,17 +3127,17 @@ set: lex->option_type=0; lex->option_list.empty(); } - option_value_list + option_value_list; opt_option: /* empty */ {} - | OPTION {} + | OPTION {}; option_value_list: option_value | GLOBAL_SYM { Lex->option_type=1; } option_value | LOCAL_SYM { Lex->option_type=0; } option_value - | option_value_list ',' option_value + | option_value_list ',' option_value; option_value: set_option equal NUM @@ -3258,13 +3263,13 @@ option_value: push_back(new Set_option(thd->lex.option_type, $1.str,$1.length, item)); - } + }; query_cache_type: NUM { current_thd->query_cache_type = set_zone(atoi($1.str),0,3); } | OFF { current_thd->query_cache_type = 0; } | ON { current_thd->query_cache_type = 1; } - | DEMAND_SYM { current_thd->query_cache_type = 2; } + | DEMAND_SYM { current_thd->query_cache_type = 2; }; text_or_password: TEXT_STRING { $$=$1.str;} @@ -3278,7 +3283,7 @@ text_or_password: make_scrambled_password(buff,$3.str); $$=buff; } - } + }; set_option: SQL_BIG_TABLES { $$= OPTION_BIG_TABLES; } @@ -3301,7 +3306,7 @@ set_option: | SQL_AUTO_IS_NULL { $$= OPTION_AUTO_IS_NULL; } | SQL_SAFE_UPDATES { $$= OPTION_SAFE_UPDATES; } | SQL_BUFFER_RESULT { $$= OPTION_BUFFER_RESULT; } - | SQL_QUOTE_SHOW_CREATE { $$= OPTION_QUOTE_SHOW_CREATE; } + | SQL_QUOTE_SHOW_CREATE { $$= OPTION_QUOTE_SHOW_CREATE; }; set_isolation: @@ -3318,16 +3323,16 @@ set_isolation: lex->thd->session_tx_isolation= lex->tx_isolation= $2; } | tx_isolation - { Lex->tx_isolation= $1; } + { Lex->tx_isolation= $1; }; tx_isolation: - TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types { $$=$4; } + TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types { $$=$4; }; isolation_types: READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; } | READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; } | REPEATABLE_SYM READ_SYM { $$= ISO_REPEATABLE_READ; } - | SERIALIZABLE_SYM { $$= ISO_SERIALIZABLE; } + | SERIALIZABLE_SYM { $$= ISO_SERIALIZABLE; }; /* Lock function */ @@ -3336,28 +3341,28 @@ lock: { Lex->sql_command=SQLCOM_LOCK_TABLES; } - table_lock_list + table_lock_list; table_or_tables: TABLE_SYM - | TABLES + | TABLES; table_lock_list: table_lock - | table_lock_list ',' table_lock + | table_lock_list ',' table_lock; table_lock: table_ident opt_table_alias lock_option - { if (!add_table_to_list($1,$2,0,(thr_lock_type) $3)) YYABORT; } + { if (!add_table_to_list($1,$2,0,(thr_lock_type) $3)) YYABORT; }; lock_option: READ_SYM { $$=TL_READ_NO_INSERT; } | WRITE_SYM { $$=current_thd->update_lock_default; } | LOW_PRIORITY WRITE_SYM { $$=TL_WRITE_LOW_PRIORITY; } - | READ_SYM LOCAL_SYM { $$= TL_READ; } + | READ_SYM LOCAL_SYM { $$= TL_READ; }; unlock: - UNLOCK_SYM table_or_tables { Lex->sql_command=SQLCOM_UNLOCK_TABLES; } + UNLOCK_SYM table_or_tables { Lex->sql_command=SQLCOM_UNLOCK_TABLES; }; /* @@ -3387,15 +3392,15 @@ handler: if (!add_table_to_list($2,0,0)) YYABORT; } - handler_read_or_scan where_clause limit_clause { } + handler_read_or_scan where_clause limit_clause { }; handler_read_or_scan: handler_scan_function { Lex->backup_dir= 0; } - | ident handler_rkey_function { Lex->backup_dir= $1.str; } + | ident handler_rkey_function { Lex->backup_dir= $1.str; }; handler_scan_function: FIRST_SYM { Lex->ha_read_mode = RFIRST; } - | NEXT_SYM { Lex->ha_read_mode = RNEXT; } + | NEXT_SYM { Lex->ha_read_mode = RNEXT; }; handler_rkey_function: FIRST_SYM { Lex->ha_read_mode = RFIRST; } @@ -3409,14 +3414,14 @@ handler_rkey_function: lex->ha_rkey_mode=$1; if (!(lex->insert_list = new List_item)) YYABORT; - } '(' values ')' { } + } '(' values ')' { }; handler_rkey_mode: EQ { $$=HA_READ_KEY_EXACT; } | GE { $$=HA_READ_KEY_OR_NEXT; } | LE { $$=HA_READ_KEY_OR_PREV; } | GT_SYM { $$=HA_READ_AFTER_KEY; } - | LT { $$=HA_READ_BEFORE_KEY; } + | LT { $$=HA_READ_BEFORE_KEY; }; /* GRANT / REVOKE */ @@ -3430,7 +3435,7 @@ revoke: lex->grant= lex->grant_tot_col=0; lex->select->db=0; } - grant_privileges ON opt_table FROM user_list + grant_privileges ON opt_table FROM user_list; grant: GRANT @@ -3446,16 +3451,16 @@ grant: lex->mqh=0; } grant_privileges ON opt_table TO_SYM user_list - require_clause grant_options + require_clause grant_options; grant_privileges: grant_privilege_list {} | ALL PRIVILEGES { Lex->grant = UINT_MAX;} - | ALL { Lex->grant = UINT_MAX;} + | ALL { Lex->grant = UINT_MAX;}; grant_privilege_list: grant_privilege - | grant_privilege_list ',' grant_privilege + | grant_privilege_list ',' grant_privilege; grant_privilege: SELECT_SYM @@ -3478,10 +3483,10 @@ grant_privilege: | SHUTDOWN { Lex->grant |= SHUTDOWN_ACL;} | PROCESS { Lex->grant |= PROCESS_ACL;} | FILE_SYM { Lex->grant |= FILE_ACL;} - | GRANT OPTION { Lex->grant |= GRANT_ACL;} + | GRANT OPTION { Lex->grant |= GRANT_ACL;}; require_list: require_list_element AND require_list -| require_list_element +| require_list_element ; require_list_element: SUBJECT_SYM TEXT_STRING { @@ -3512,7 +3517,7 @@ require_list_element: SUBJECT_SYM TEXT_STRING YYABORT; } lex->ssl_cipher=$2.str; - } + }; opt_table: '*' @@ -3558,12 +3563,12 @@ opt_table: YYABORT; if (lex->grant == UINT_MAX) lex->grant = TABLE_ACLS & ~GRANT_ACL; - } + }; user_list: grant_user { if (Lex->users_list.push_back($1)) YYABORT;} - | user_list ',' grant_user { if (Lex->users_list.push_back($3)) YYABORT;} + | user_list ',' grant_user { if (Lex->users_list.push_back($3)) YYABORT;}; grant_user: @@ -3584,7 +3589,7 @@ grant_user: | user IDENTIFIED_SYM BY PASSWORD TEXT_STRING { $$=$1; $1->password=$5 ; } | user - { $$=$1; $1->password.str=NullS; } + { $$=$1; $1->password.str=NullS; }; opt_column_list: @@ -3593,11 +3598,11 @@ opt_column_list: LEX *lex=Lex; lex->grant |= lex->which_columns; } - | '(' column_list ')' + | '(' column_list ')'; column_list: column_list ',' column_list_id - | column_list_id + | column_list_id; column_list_id: ident @@ -3616,7 +3621,7 @@ column_list_id: point->rights |= lex->which_columns; else lex->columns.push_back(new LEX_COLUMN (*new_str,lex->which_columns)); - } + }; require_clause: /* empty */ @@ -3631,35 +3636,35 @@ require_clause: /* empty */ | REQUIRE_SYM X509_SYM { Lex->ssl_type=SSL_TYPE_X509; - } + }; grant_options: /* empty */ {} - | WITH grant_option_list + | WITH grant_option_list; grant_option_list: grant_option_list grant_option {} - | grant_option {} + | grant_option {}; grant_option: GRANT OPTION { Lex->grant |= GRANT_ACL;} | MAX_QUERIES_PER_HOUR EQ NUM { Lex->mqh=atoi($3.str); - } + }; begin: - BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN;} opt_work + BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN;} opt_work; opt_work: /* empty */ {} - | WORK_SYM {} + | WORK_SYM {}; commit: - COMMIT_SYM { Lex->sql_command = SQLCOM_COMMIT;} + COMMIT_SYM { Lex->sql_command = SQLCOM_COMMIT;}; rollback: - ROLLBACK_SYM { Lex->sql_command = SQLCOM_ROLLBACK;} + ROLLBACK_SYM { Lex->sql_command = SQLCOM_ROLLBACK;}; /* @@ -3669,7 +3674,7 @@ rollback: union: /* empty */ {} - | union_list + | union_list; union_list: UNION_SYM union_option @@ -3685,14 +3690,14 @@ union_list: YYABORT; lex->select->linkage=UNION_TYPE; } - select_init + select_init; union_opt: union {} - | optional_order_or_limit {} + | optional_order_or_limit {}; optional_order_or_limit: - /* emty */ {} + /* empty */ {} | { LEX *lex=Lex; @@ -3702,8 +3707,10 @@ optional_order_or_limit: lex->select->linkage=NOT_A_SELECT; lex->select->select_limit=lex->thd->default_select_limit; } - opt_order_clause limit_clause + opt_order_clause limit_clause; union_option: /* empty */ {} - | ALL {Lex->union_option=1;} + | ALL {Lex->union_option=1;}; + + -- cgit v1.2.1 From 6762b4c0672478680c2bc26088d2d6ea4ce167a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Apr 2002 16:29:14 +0300 Subject: Fixed pthread_cond_timedwait() for HPUX and DCE threads Cleanup of LIBWRAP handling Docs/manual.texi: Changelog include/my_pthread.h: Fixed pthread_cond_timedwait() for HPUX and DCE threads mysys/my_pthread.c: Fixed pthread_cond_timedwait() for HPUX and DCE threads sql/item_func.cc: Fixed the GET_LOCK() works with HPUX and DCE threads sql/mysqld.cc: Cleanup of LIBWRAP handling sql/sql_parse.cc: Safety fix --- sql/item_func.cc | 2 +- sql/mysqld.cc | 51 +++++++++++++++++++++++++++++---------------------- sql/sql_parse.cc | 2 +- 3 files changed, 31 insertions(+), 24 deletions(-) (limited to 'sql') diff --git a/sql/item_func.cc b/sql/item_func.cc index 023b79b3ff7..2e54aa56b4b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1514,7 +1514,7 @@ longlong Item_func_get_lock::val_int() while (!thd->killed && (error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime)) - != ETIME && error != ETIMEDOUT && ull->locked) ; + != ETIME && error != ETIMEDOUT && error != EINVAL && ull->locked) ; if (thd->killed) error=EINTR; // Return NULL if (ull->locked) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index fa5f6ae395e..16eace54978 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -89,6 +89,16 @@ extern "C" { // Because of SCO 3.2V4.2 #endif /* NEED_SYS_SYSLOG_H */ int allow_severity = LOG_INFO; int deny_severity = LOG_WARNING; + +#ifdef __linux__ +#define my_fromhost(A) fromhost() +#define my_hosts_access(A) hosts_access() +#define my_eval_client(A) eval_client() +#else +#define my_fromhost(A) fromhost(A) +#define my_hosts_access(A) hosts_access(A) +#define my_eval_client(A) eval_client(A) +#endif #endif /* HAVE_LIBWRAP */ #ifdef HAVE_SYS_MMAN_H @@ -2258,7 +2268,6 @@ static void create_new_thread(THD *thd) if (cached_thread_count > wake_thread) { start_cached_thread(thd); - (void) pthread_mutex_unlock(&LOCK_thread_count); } else { @@ -2285,9 +2294,9 @@ static void create_new_thread(THD *thd) (void) pthread_mutex_unlock(&LOCK_thread_count); DBUG_VOID_RETURN; } - - (void) pthread_mutex_unlock(&LOCK_thread_count); } + (void) pthread_mutex_unlock(&LOCK_thread_count); + } DBUG_PRINT("info",("Thread created")); DBUG_VOID_RETURN; @@ -2415,29 +2424,27 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) struct request_info req; signal(SIGCHLD, SIG_DFL); request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL); -#ifndef __linux__ - fromhost(&req); - if (!hosts_access(&req)) - { - // This may be stupid but refuse() includes an exit(0) - // which we surely don't want... - // clean_exit() - same stupid thing ... - syslog(deny_severity, "refused connect from %s", eval_client(&req)); -#else - fromhost(); - if (!hosts_access()) + my_fromhost(&req); + if (!my_hosts_access(&req)) { - syslog(deny_severity, "refused connect from %s", eval_client()); -#endif + /* + This may be stupid but refuse() includes an exit(0) + which we surely don't want... + clean_exit() - same stupid thing ... + */ + syslog(deny_severity, "refused connect from %s", + my_eval_client(&req)); + + /* + C++ sucks (the gibberish in front just translates the supplied + sink function pointer in the req structure from a void (*sink)(); + to a void(*sink)(int) if you omit the cast, the C++ compiler + will cry... + */ if (req.sink) ((void (*)(int))req.sink)(req.fd); - // C++ sucks (the gibberish in front just translates the supplied - // sink function pointer in the req structure from a void (*sink)(); - // to a void(*sink)(int) if you omit the cast, the C++ compiler - // will cry... - - (void) shutdown(new_sock,2); // This looks fine to me... + (void) shutdown(new_sock,2); (void) closesocket(new_sock); continue; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index fa4a4fd4f3b..4f9140cc3f2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -530,7 +530,7 @@ pthread_handler_decl(handle_one_connection,arg) if ((error=check_connections(thd))) { // Wrong permissions if (error > 0) - net_printf(net,error,thd->host ? thd->host : thd->ip); + net_printf(net,error,thd->host ? thd->host : (thd->ip ? thd->ip : "")); #ifdef __NT__ if (vio_type(net->vio) == VIO_TYPE_NAMEDPIPE) sleep(1); /* must wait after eof() */ -- cgit v1.2.1 From daa1c86d49cedb77ca58c5bb8dd8419dbff046fa Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Apr 2002 11:45:26 +0300 Subject: Abort if 'listen()' on TCP/IP fails. --- sql/mysqld.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 16eace54978..ebb7592820b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -917,21 +917,22 @@ static void server_init(void) IPaddr.sin_addr.s_addr = my_bind_addr; IPaddr.sin_port = (unsigned short) htons((unsigned short) mysql_port); (void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg)); - for(;;) + if (bind(ip_sock, my_reinterpret_cast(struct sockaddr *) (&IPaddr), + sizeof(IPaddr)) < 0) { - if (bind(ip_sock, my_reinterpret_cast(struct sockaddr *) (&IPaddr), - sizeof(IPaddr)) >= 0) - break; DBUG_PRINT("error",("Got error: %d from bind",socket_errno)); - sql_perror("Can't start server: Bind on TCP/IP port");/* Had a loop here */ + sql_perror("Can't start server: Bind on TCP/IP port"); sql_print_error("Do you already have another mysqld server running on port: %d ?",mysql_port); unireg_abort(1); } if (listen(ip_sock,(int) back_log) < 0) + { + sql_perror("Can't start server: listen() on TCP/IP port"); sql_print_error("Warning: listen() on TCP/IP failed with error %d", socket_errno); + unireg_abort(1); + } } - if (mysqld_chroot) set_root(mysqld_chroot); -- cgit v1.2.1 From 485c06e39f43811b54ed4c94379c8a3a9f0a049b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Apr 2002 16:06:19 +0300 Subject: Fixed typo Removed some files from the bitkeeper delete tree. (To fix problem with duplicate filenames on MacOS X) BitKeeper/deleted/.del-ha_hash.h~27e36916116beb3e: Delete: sql/ha_hash.h Docs/manual.texi: Fixed typo --- sql/ha_hash.h | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 sql/ha_hash.h (limited to 'sql') diff --git a/sql/ha_hash.h b/sql/ha_hash.h deleted file mode 100644 index 80416611406..00000000000 --- a/sql/ha_hash.h +++ /dev/null @@ -1,31 +0,0 @@ - -int ha_hash::create(my_string name, register TABLE *form, - ulonglong auto_increment_value) -{ - register uint i,j; - char buff[FN_REFLEN]; - KEY *pos; - H_KEYDEF keydef[MAX_KEY]; - DBUG_ENTER("cre_hash"); - - pos=form->key_info; - for (i=0; i < form->keys ; i++, pos++) - { - keydef[i].hk_flag= pos->flags & HA_NOSAME; - for (j=0 ; (int7) j < pos->key_parts ; j++) - { - uint flag=pos->key_part[j].key_type; - if (!f_is_packed(flag) && f_packtype(flag) == (int) FIELD_TYPE_DECIMAL && - !(flag & FIELDFLAG_BINARY)) - keydef[i].hk_keyseg[j].key_type= (int) HA_KEYTYPE_TEXT; - else - keydef[i].hk_keyseg[j].key_type= (int) HA_KEYTYPE_BINARY; - keydef[i].hk_keyseg[j].start= pos->key_part[j].offset; - keydef[i].hk_keyseg[j].length= pos->key_part[j].length; - } - keydef[i].hk_keyseg[j].key_type= 0; - } - DBUG_RETURN(h_create(fn_format(buff,name,"","",2+4+16),i, - keydef,form->reclength,form->max_rows,form->min_rows, - 0)); -} /* cre_hash */ -- cgit v1.2.1 From 2b4595b861e5258fa466ae80e88718ecb3865f0c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Apr 2002 18:24:14 +0300 Subject: SHOW VARIABLES LIKE ... are now case insensitive Fixed stack overflow checking with crash-me with gcc 3.0.4 Using @@unknown_variable doesn't hang client anymore Added @@VERSION variable Docs/manual.texi: Changelog libmysql/libmysql.c: Fixed typo myisam/myisampack.c: Removed not used argument mysql-test/r/show_check.result: Added test of case insensitive SHOW VARIABLES LIKE mysql-test/r/variables.result: test of system variables mysql-test/t/show_check.test: Added test of case insensitive SHOW VARIABLES LIKE mysql-test/t/variables.test: test of system variables sql/item_func.cc: Fixed stack overflow checking with crash-me with gcc 3.0.4 Using @@unknown_variable doesn't hang client anymore Added @@VERSION variable sql/mysql_priv.h: Fixed stack overflow checking with crash-me with gcc 3.0.4 sql/share/czech/errmsg.txt: Fixed wrong error message sql/share/danish/errmsg.txt: Fixed wrong error message sql/share/dutch/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 BitKeeper/deleted/.del-identity.result~e41453a364242503: not used file BitKeeper/deleted/.del-identity.test~326f469b59105404: not used file 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_show.cc: SHOW VARIABLES LIKE ... are now case insensitive --- sql/item_func.cc | 11 +++++++---- sql/mysql_priv.h | 24 ++++++++++++++++-------- sql/share/czech/errmsg.txt | 2 +- sql/share/danish/errmsg.txt | 2 +- sql/share/dutch/errmsg.txt | 2 +- sql/share/english/errmsg.txt | 2 +- sql/share/estonian/errmsg.txt | 2 +- sql/share/french/errmsg.txt | 2 +- sql/share/german/errmsg.txt | 2 +- sql/share/greek/errmsg.txt | 2 +- sql/share/hungarian/errmsg.txt | 2 +- sql/share/italian/errmsg.txt | 2 +- sql/share/japanese/errmsg.txt | 2 +- sql/share/korean/errmsg.txt | 2 +- sql/share/norwegian-ny/errmsg.txt | 2 +- sql/share/norwegian/errmsg.txt | 2 +- sql/share/polish/errmsg.txt | 2 +- sql/share/portuguese/errmsg.txt | 2 +- sql/share/romanian/errmsg.txt | 2 +- sql/share/russian/errmsg.txt | 2 +- sql/share/slovak/errmsg.txt | 2 +- sql/share/spanish/errmsg.txt | 2 +- sql/share/swedish/errmsg.txt | 2 +- sql/share/ukrainian/errmsg.txt | 2 +- sql/sql_show.cc | 27 ++++++++++++++++++--------- 25 files changed, 63 insertions(+), 43 deletions(-) (limited to 'sql') diff --git a/sql/item_func.cc b/sql/item_func.cc index 2e54aa56b4b..6579825690f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -59,7 +59,7 @@ bool Item_func::fix_fields(THD *thd,TABLE_LIST *tables) { Item **arg,**arg_end; - char buff[sizeof(double)]; // Max argument in function + char buff[STACK_BUFF_ALLOC]; // Max argument in function binary=0; used_tables_cache=0; const_item_cache=1; @@ -1058,7 +1058,7 @@ bool udf_handler::fix_fields(THD *thd,TABLE_LIST *tables,Item_result_field *func, uint arg_count, Item **arguments) { - char buff[sizeof(double)]; // Max argument in function + char buff[STACK_BUFF_ALLOC]; // Max argument in function DBUG_ENTER("Item_udf_func::fix_fields"); if (thd) @@ -2161,9 +2161,12 @@ bool Item_func_match::eq(const Item *item, bool binary_cmp) const Item *get_system_var(LEX_STRING name) { - if (!strcmp(name.str,"IDENTITY")) + if (!my_strcasecmp(name.str,"IDENTITY")) return new Item_int((char*) "@@IDENTITY", current_thd->insert_id(),21); - my_error(ER_UNKNOWN_SYSTEM_VARIABLE,MYF(0),name); + if (!my_strcasecmp(name.str,"VERSION")) + return new Item_string("@@VERSION",server_version, + (uint) strlen(server_version)); + net_printf(¤t_thd->net, ER_UNKNOWN_SYSTEM_VARIABLE, name); return 0; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 657ca3274cd..4cee7d04ef0 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -73,22 +73,30 @@ void kill_one_thread(THD *thd, ulong id); #define MAX_FIELDS_BEFORE_HASH 32 #define USER_VARS_HASH_SIZE 16 #define STACK_MIN_SIZE 8192 // Abort if less stack during eval. +#define STACK_BUFF_ALLOC 32 // For stack overrun checks #ifndef MYSQLD_NET_RETRY_COUNT #define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int. #endif #define TEMP_POOL_SIZE 128 -/* The following parameters is to decide when to use an extra cache to - optimise seeks when reading a big table in sorted order */ +/* + The following parameters is to decide when to use an extra cache to + optimise seeks when reading a big table in sorted order +*/ #define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (16L*1024*1024) #define MIN_ROWS_TO_USE_TABLE_CACHE 100 -// The following is used to decide if MySQL should use table scanning -// instead of reading with keys. The number says how many evaluation of the -// WHERE clause is comparable to reading one extra row from a table. +/* + The following is used to decide if MySQL should use table scanning + instead of reading with keys. The number says how many evaluation of the + WHERE clause is comparable to reading one extra row from a table. +*/ #define TIME_FOR_COMPARE 5 // 5 compares == one read -// Number of rows in a reference table when refereed through a not unique key. -// This value is only used when we don't know anything about the key -// distribution. + +/* + Number of rows in a reference table when refereed through a not unique key. + This value is only used when we don't know anything about the key + distribution. +*/ #define MATCHING_ROWS_IN_OTHER_TABLE 10 /* Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used) */ diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index d1638bee16e..093954c202b 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -203,7 +203,7 @@ "S-Bí»ová chyba pøi zápisu na master",-A "-B®ádný sloupec nemá vytvoøen fulltextový index",-A "Nemohu prov-Bést zadaný pøíkaz, proto¾e existují aktivní zamèené tabulky nebo aktivní transakce",-A -"Nezn-Bámá systémová promìnná '%-.64'",-A +"Nezn-Bámá systémová promìnná '%-.64s'",-A "Tabulka '%-.64s' je ozna-Bèena jako poru¹ená a mìla by být opravena",-A "Tabulka '%-.64s' je ozna-Bèena jako poru¹ená a poslední (automatická?) oprava se nezdaøila",-A "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 6585f717a78..6ee6e23a18e 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -197,7 +197,7 @@ "Netværksfejl ved skrivning til master", "Kan ikke finde en FULLTEXT nøgle som svarer til kolonne listen", "Kan ikke udføre den givne kommando fordi der findes aktive, låste tabeller eller fordi der udføres en transaktion", -"Ukendt systemvariabel '%-.64'", +"Ukendt systemvariabel '%-.64s'", "Tabellen '%-.64s' er markeret med fejl og bør repareres", "Tabellen '%-.64s' er markeret med fejl og sidste (automatiske?) REPAIR fejlede", "Advarsel: Visse data i tabeller der ikke understøtter transaktioner kunne ikke tilbagestilles", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index d14400edc69..b857eb3104d 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -200,7 +200,7 @@ "Net fout tijdens schrijven naar master", "Kan geen FULLTEXT index vinden passend bij de kolom lijst", "Kan het gegeven commando niet uitvoeren, want u heeft actieve gelockte tabellen of een actieve transactie", -"Onbekende systeem variabele '%-.64'", +"Onbekende systeem variabele '%-.64s'", "Tabel '%-.64s' staat als gecrashed gemarkeerd en dient te worden gerepareerd", "Tabel '%-.64s' staat als gecrashed gemarkeerd en de laatste (automatische?) reparatie poging mislukte", "Waarschuwing: Roll back mislukt voor sommige buiten transacties gewijzigde tabellen", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 384d2c846c2..b67c1e1a0df 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -194,7 +194,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 20891c7b001..d57f6871e12 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -198,7 +198,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Tundmatu süsteemne muutja '%-.64'", +"Tundmatu süsteemne muutja '%-.64s'", "Tabel '%-.64s' on märgitud vigaseks ja tuleb parandada", "Tabel '%-.64s' on märgitud vigaseks ja viimane (automaatne?) parandamiskatse ebaõnnestus", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 104e561d642..4848a3266bc 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -194,7 +194,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index d0a08a1e7a8..fe76c757d11 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -197,7 +197,7 @@ "Netzfehler beim Schreiben zum Master", "Kann keinen FULLTEXT-Index finden der der Spaltenliste entspricht", "Kann das aktuelle Kommando wegen aktiver Tabellensperre oder aktiver Transaktion nicht ausführen", -"Unbekannte System-Variabel '%-.64'", +"Unbekannte System-Variabel '%-.64s'", "Tabelle '%-.64s' ist als defekt makiert und sollte repariert werden", "Tabelle '%-.64s' ist als defekt makiert und der letzte (automatische) Reparaturversuch schlug fehl.", "Warnung: Das Rollback konnte bei einigen Tabellen, die nicht mittels Transaktionen geändert wurden, nicht ausgeführt werden.", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index f778cb857d7..b491b0ef1f9 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -194,7 +194,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 6ff12c8b49e..fc6a9ba0643 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -196,7 +196,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 7a3daca9a59..3da78e82d99 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -194,7 +194,7 @@ "Errore di rete durante l'invio al master", "Impossibile trovare un indice FULLTEXT che corrisponda all'elenco delle colonne", "Impossibile eseguire il comando richiesto: tabelle sotto lock o transazione in atto", -"Variabile di sistema '%-.64' sconosciuta", +"Variabile di sistema '%-.64s' sconosciuta", "La tabella '%-.64s' e` segnalata come corrotta e deve essere riparata", "La tabella '%-.64s' e` segnalata come corrotta e l'ultima ricostruzione (automatica?) e` fallita", "Attenzione: Alcune delle modifiche alle tabelle non transazionali non possono essere ripristinate (roll back impossibile)", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index fab60948943..dc2299e4336 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -196,7 +196,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 0dac448e2b2..79bf767a3c8 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -194,7 +194,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 78075c3990c..a583a541b71 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -196,7 +196,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 997d667f812..85fa1f04f63 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -196,7 +196,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index f317d99d48f..af484b4c850 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -198,7 +198,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index a3ae06d193f..7737fe6b1fd 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -194,7 +194,7 @@ "Erro de rede na gravação do 'master'", "Não pode encontrar índice FULLTEXT que combine com a lista de colunas", "Não pode executar o comando dado porque você tem tabelas ativas travadas ou uma 'transaction' ativa", -"Variável de sistema '%-.64' desconhecida", +"Variável de sistema '%-.64s' desconhecida", "Tabela '%-.64s' está marcada como danificada e deve ser reparada", "Tabela '%-.64s' está marcada como danificada e a última reparação (automática?) falhou", "Aviso: Algumas tabelas não-transacionais alteradas não puderam ser reconstituídas ('rolled back')", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 26d9f34528a..e8927777b8a 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -198,7 +198,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index c02c47696b0..5c94f2ee31b 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -197,7 +197,7 @@ "óÅÔÅ×ÁÑ ÏÛÉÂËÁ ÐÒÉ ÐÉÓÁÎÉÉ ÍÁÓÔÅÒÕ", "FULLTEXT ÉÎÄÅËÓ, ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÉÊ ÚÁÄÁÎÎÏÍÕ ÓÐÉÓËÕ ÓÔÏÌÂÃÏ×, ÎÅ ÎÁÊÄÅÎ", "îÅ ÍÏÇÕ ×ÙÐÏÌÎÉÔØ ËÏÍÍÁÎÄÕ ÉÚ-ÚÁ ÁËÔÉ×ÎÙÈ locked ÔÁÂÌÉà ÉÌÉ ÁËÔÉ×ÎÏÊ ÔÒÁÎÚÁËÃÉÉ", -"îÅÉÚ×ÅÓÔÎÁÑ ÓÉÓÔÅÍÎÁÑ ÐÅÒÅÍÅÎÎÁÑ '%-.64'", +"îÅÉÚ×ÅÓÔÎÁÑ ÓÉÓÔÅÍÎÁÑ ÐÅÒÅÍÅÎÎÁÑ '%-.64s'", "ôÁÂÌÉÃÁ '%-.64s' ÐÏÍÅÞÅÎÁ ËÁË ÉÓÐÏÒÞÅÎÎÁÑ É ÄÏÌÖÎÁ ÂÙÔØ ÉÓÐÒÁ×ÌÅÎÁ", "ôÁÂÌÉÃÁ '%-.64s' ÐÏÍÅÞÅÎÁ ËÁË ÉÓÐÏÒÞÅÎÎÁÑ É ÐÏÓÌÅÄÎÑÑ ÐÏÐÙÔËÁ ÉÓÐÒÁ×ÌÅÎÉÑ (Á×ÔÏÍÁÔÉÞÅÓËÁÑ?) ÎÅ ÕÄÁÌÁÓØ", "ðÒÅÄÕÐÒÅÖÄÅÎÉÅ: ÎÅËÏÔÏÒÙÅ ÎÅÔÒÁÎÚÁËÃÉÏÎÎÙÅ ÔÁÂÌÉÃÙ ÎÅ ÐÏÄÞÉÎÑÀÔÓÑ ROLLBACK", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 189db8a66f8..3f96880bda1 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -202,7 +202,7 @@ "Net error writing to master", "Can't find FULLTEXT index matching the column list", "Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64'", +"Unknown system variable '%-.64s'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 57d4ac9646a..c718ac93fc4 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -195,7 +195,7 @@ "Error de red escribiendo para el master", "No puedo encontrar índice FULLTEXT correspondiendo a la lista de columnas", "No puedo ejecutar el comando dado porque tienes tablas bloqueadas o una transición activa", -"Desconocida variable de sistema '%-.64'", +"Desconocida variable de sistema '%-.64s'", "Tabla '%-.64s' está marcada como crashed y debe ser reparada", "Tabla '%-.64s' está marcada como crashed y la última reparación (automactica?) falló", "Aviso: Algunas tablas no transancionales no pueden tener rolled back", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 1b7b6012a39..ce6bb0e80f0 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -194,7 +194,7 @@ "Fick nätverksfel vid skrivning till master", "Hittar inte ett FULLTEXT index i kolumnlistan", "Kan inte exekvera kommandot emedan du har en låst tabell eller an aktiv transaktion", -"Okänd system variabel '%-.64'", +"Okänd system variabel '%-.64s'", "Tabell '%-.64s' är crashad och bör repareras med REPAIR TABLE", "Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades", "Warning: Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 4508fc75c27..b167ebd5f3d 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -199,7 +199,7 @@ "íÅÒÅÖÅ×Á ÐÏÍÉÌËÁ ÚÁÐÉÓÕ ÄÏ ÇÏÌÏ×ÎÏÇÏ", "îÅ ÍÏÖÕ ÚÎÁÊÔÉ FULLTEXT ¦ÎÄÅËÓ, ÝÏ ×¦ÄÐÏצÄÁ¤ ÐÅÒÅ̦ËÕ ÓÔÏ×Âæ×", "îÅ ÍÏÖÕ ×ÉËÏÎÁÔÉ ÐÏÄÁÎÕ ËÏÍÁÎÄÕ ÔÏÍÕ, ÝÏ ÔÁÂÌÉÃÑ ÚÁÂÌÏËÏ×ÁÎÁ ÁÂÏ ×ÉËÏÎÕ¤ÔØÓÑ ÔÒÁÎÚÁËæÑ", -"îÅצÄÏÍÁ ÓÉÓÔÅÍÎÁ ÚͦÎÎÁ '%-.64'", +"îÅצÄÏÍÁ ÓÉÓÔÅÍÎÁ ÚͦÎÎÁ '%-.64s'", "ôÁÂÌÉÃÀ '%-.64s' ÍÁÒËÏ×ÁÎÏ ÑË Ú¦ÐÓÏ×ÁÎÕ ÔÁ §§ ÐÏÔÒ¦ÂÎÏ ×¦ÄÎÏ×ÉÔÉ", "ôÁÂÌÉÃÀ '%-.64s' ÍÁÒËÏ×ÁÎÏ ÑË Ú¦ÐÓÏ×ÁÎÕ ÔÁ ÏÓÔÁÎΤ (Á×ÔÏÍÁÔÉÞÎÅ?) צÄÎÏ×ÌÅÎÎÑ ÎÅ ×ÄÁÌÏÓÑ", "úÁÓÔÅÒÅÖÅÎÎÑ: äÅÑ˦ ÎÅÔÒÁÎÚÁËæÊΦ ÚͦÎÉ ÔÁÂÌÉÃØ ÎÅ ÍÏÖÎÁ ÂÕÄÅ ÐÏ×ÅÒÎÕÔÉ", diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 018b43b11c8..8cfac1675b0 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -567,21 +567,30 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) { packet->length(0); net_store_data(packet, table->table_name); - // a hack - we need to reserve some space for the length before - // we know what it is - let's assume that the length of create table - // statement will fit into 3 bytes ( 16 MB max :-) ) + /* + A hack - we need to reserve some space for the length before + we know what it is - let's assume that the length of create table + statement will fit into 3 bytes ( 16 MB max :-) ) + */ ulong store_len_offset = packet->length(); packet->length(store_len_offset + 4); if (store_create_info(thd, table, packet)) DBUG_RETURN(-1); ulong create_len = packet->length() - store_len_offset - 4; if (create_len > 0x00ffffff) // better readable in HEX ... - DBUG_RETURN(1); // just in case somebody manages to create a table - // with *that* much stuff in the definition + { + /* + Just in case somebody manages to create a table + with *that* much stuff in the definition + */ + DBUG_RETURN(1); + } - // now we have to store the length in three bytes, even if it would fit - // into fewer, so we cannot use net_store_data() anymore, - // and do it ourselves + /* + Now we have to store the length in three bytes, even if it would fit + into fewer bytes, so we cannot use net_store_data() anymore, + and do it ourselves + */ char* p = (char*)packet->ptr() + store_len_offset; *p++ = (char) 253; // The client the length is stored using 3-bytes int3store(p, create_len); @@ -1125,7 +1134,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables) pthread_mutex_lock(&LOCK_status); for (i=0; variables[i].name; i++) { - if (!(wild && wild[0] && wild_compare(variables[i].name,wild))) + if (!(wild && wild[0] && wild_case_compare(variables[i].name,wild))) { packet2.length(0); net_store_data(&packet2,variables[i].name); -- cgit v1.2.1 From ff924d239d2f849d11749f25c3df624f41a3937c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Apr 2002 18:41:45 -0600 Subject: fixed assertion failure on corrupted log in reckless slave mode --- sql/slave.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql') diff --git a/sql/slave.cc b/sql/slave.cc index 045ba57d8c7..930155206c2 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1115,6 +1115,7 @@ static inline int add_relay_log(RELAY_LOG_INFO* rli,LOG_INFO* linfo) static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli) { bool slave_killed; + LINT_INIT(slave_killed); MASTER_INFO* mi = rli->mi; const char* save_proc_info; THD* thd = mi->io_thd; @@ -2579,6 +2580,7 @@ Log_event* next_event(RELAY_LOG_INFO* rli) goto err; } rli->relay_log_pos = 4; + rli->pending=0; strnmov(rli->relay_log_name,rli->linfo.log_file_name, sizeof(rli->relay_log_name)); flush_relay_log_info(rli); -- cgit v1.2.1 From 19c6b6709d667578f942d2bf206f0aff6ec264c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Apr 2002 11:38:58 +0300 Subject: Fixed bug in @@unknown_variable --- sql/item_func.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/item_func.cc b/sql/item_func.cc index 6579825690f..9180cccabcf 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2167,6 +2167,6 @@ Item *get_system_var(LEX_STRING name) if (!my_strcasecmp(name.str,"VERSION")) return new Item_string("@@VERSION",server_version, (uint) strlen(server_version)); - net_printf(¤t_thd->net, ER_UNKNOWN_SYSTEM_VARIABLE, name); + net_printf(¤t_thd->net, ER_UNKNOWN_SYSTEM_VARIABLE, name.str); return 0; } -- cgit v1.2.1 From 2e1daaa219dc0364edac9829f17bcf37dc475465 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Apr 2002 10:34:46 +0300 Subject: Fixed that IF is case insensitive if 2 and 3 arguments are case insensitive. Added copyright messages to some files that was missing it. Docs/manual.texi: Changelog dbug/Makefile.am: Added missing dbug_analyze.c dbug/monty.doc: Added copyright message mysql-test/t/func_test.test: Moved test of IF to new file sql/item_cmpfunc.cc: Fixed that IF is case insensitive if 2 and 3 arguments are case insensitive. strings/bfill.c: Added copyright message strings/bmove.c: Added copyright message strings/ctype-ujis.c: Added copyright message strings/strend.c: Added copyright message strings/strstr.c: Added copyright message strings/strxmov.c: Added copyright message strings/strxnmov.c: Added copyright message --- sql/item_cmpfunc.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sql') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 373aede7b6b..2b7f4cb6c40 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -490,8 +490,12 @@ Item_func_if::fix_length_and_dec() decimals=max(args[1]->decimals,args[2]->decimals); enum Item_result arg1_type=args[1]->result_type(); enum Item_result arg2_type=args[2]->result_type(); + binary=1; if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT) + { cached_result_type = STRING_RESULT; + binary=args[1]->binary | args[2]->binary; + } else if (arg1_type == REAL_RESULT || arg2_type == REAL_RESULT) cached_result_type = REAL_RESULT; else -- cgit v1.2.1 From ff9bc9ba59d1beb061d27a136464153c20412241 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Apr 2002 11:58:38 +0300 Subject: ha_innodb.cc: Reduce ibdata1 default size to 10M:autoextend sql/ha_innodb.cc: Reduce ibdata1 default size to 10M:autoextend --- sql/ha_innodb.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index aa8ce0f3c18..c85d74ce432 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -102,13 +102,14 @@ my_bool innobase_use_native_aio = FALSE; my_bool innobase_fast_shutdown = TRUE; /* - Set default InnoDB size to 64M and let it be auto-extending. Thus users - can use InnoDB without having to specify any startup options. + Set default InnoDB data file size to 10 MB and let it be + auto-extending. Thus users can use InnoDB without having to + specify any startup options. */ /* innobase_data_file_path=ibdata:15,idata2:1,... */ -char *innobase_data_file_path= (char*) "ibdata1:64M:autoextend"; +char *innobase_data_file_path= (char*) "ibdata1:10M:autoextend"; static char *internal_innobase_data_file_path=0; /* The following counter is used to convey information to InnoDB -- cgit v1.2.1 From ce79a892abfbc3faa90c79d4b4261e31103e8e8c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Apr 2002 23:36:34 +0300 Subject: Removed some old Makefiles to avoid name conflict on Mac OS X Changed in client library character-set-dir -> character-sets-dir Docs/manual.texi: Snmall update to ALTER TABLE and MyISAM tables client/mysql.cc: Moved SSL info to 'status' libmysql/libmysql.c: Fixed character-set-dir -> character-sets-dir sql/sql_string.cc: Small optimization --- sql/sql_string.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'sql') diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 8fe84947ac2..b0ac378c861 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -40,19 +40,16 @@ extern void sql_element_free(void *ptr); bool String::real_alloc(uint32 arg_length) { arg_length=ALIGN_SIZE(arg_length+1); + str_length=0; if (Alloced_length < arg_length) { free(); if (!(Ptr=(char*) my_malloc(arg_length,MYF(MY_WME)))) - { - str_length=0; return TRUE; - } Alloced_length=arg_length; alloced=1; } Ptr[0]=0; - str_length=0; return FALSE; } -- cgit v1.2.1 From f96c4216601ed7b8a48ab48b4435d3b6fe134dea Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Apr 2002 07:33:02 -0600 Subject: replication bugfixes sql/slave.cc: removed buggy loop sql/slave.h: fixed uninited variable use --- sql/slave.cc | 21 ++++++--------------- sql/slave.h | 4 +++- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'sql') diff --git a/sql/slave.cc b/sql/slave.cc index 930155206c2..0af3823c1e0 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1568,9 +1568,6 @@ command"); static ulong read_event(MYSQL* mysql, MASTER_INFO *mi) { ulong len = packet_error; - // for convinience lets think we start by - // being in the interrupted state :-) - int read_errno = EINTR; // my_real_read() will time us out // we check if we were told to die, and if not, try reading again @@ -1579,27 +1576,21 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi) return packet_error; #endif - while (!abort_loop && !mi->abort_slave && len == packet_error && - read_errno == EINTR ) - { - len = mc_net_safe_read(mysql); - read_errno = errno; - } - if (abort_loop || mi->abort_slave) - return packet_error; + len = mc_net_safe_read(mysql); + if (len == packet_error || (long) len < 1) { - sql_print_error("Error reading packet from server: %s (read_errno %d,\ + sql_print_error("Error reading packet from server: %s (\ server_errno=%d)", - mc_mysql_error(mysql), read_errno, mc_mysql_errno(mysql)); + mc_mysql_error(mysql), mc_mysql_errno(mysql)); return packet_error; } if (len == 1) { sql_print_error("Slave: received 0 length packet from server, apparent\ - master shutdown: %s (%d)", - mc_mysql_error(mysql), read_errno); + master shutdown: %s", + mc_mysql_error(mysql)); return packet_error; } diff --git a/sql/slave.h b/sql/slave.h index b70ca6f6d00..75e3e81e57f 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -160,6 +160,7 @@ typedef struct st_relay_log_info st_relay_log_info():info_fd(-1),cur_log_fd(-1),inited(0), cur_log_init_count(0), + abort_slave(0),slave_running(0), log_pos_current(0),abort_pos_wait(0), skip_log_purge(0) { @@ -280,7 +281,8 @@ typedef struct st_master_info bool ignore_stop_event; - st_master_info():fd(-1), io_thd(0), inited(0), old_format(0) + st_master_info():fd(-1), io_thd(0), inited(0), old_format(0),abort_slave(0), + slave_running(0) { host[0] = 0; user[0] = 0; password[0] = 0; bzero(&file,sizeof(file)); -- cgit v1.2.1 From 7bfac8a581db95199b2ee3543ac4e77274e07519 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 26 Apr 2002 13:56:32 +0300 Subject: Don't change FLOAT(X+1,X) to FLOAT(X+2,X) Docs/manual.texi: ChangeLog mysql-test/r/show_check.result: Updated test for SHOW COLUMNS mysql-test/t/show_check.test: Updated test for SHOW COLUMNS --- sql/sql_parse.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4f9140cc3f2..06a121ea30c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2432,9 +2432,9 @@ bool add_field_to_list(char *field_name, enum_field_types type, uint sign_len=type_modifier & UNSIGNED_FLAG ? 0 : 1; if (new_field->length && new_field->decimals && - new_field->length < new_field->decimals+2 && + new_field->length < new_field->decimals+1 && new_field->decimals != NOT_FIXED_DEC) - new_field->length=new_field->decimals+2; /* purecov: inspected */ + new_field->length=new_field->decimals+1; /* purecov: inspected */ switch (type) { case FIELD_TYPE_TINY: -- cgit v1.2.1 From f508ec93b167eaec951d196d51c59baadbdfc55b Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 28 Apr 2002 21:22:37 +0000 Subject: init_dynamic_array MyODBC compatibility fix --- sql/log.cc | 4 ++-- sql/slave.cc | 2 +- sql/sql_acl.cc | 8 ++++---- sql/sql_select.cc | 2 +- sql/uniques.cc | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'sql') diff --git a/sql/log.cc b/sql/log.cc index 40cafeeaad1..f0012a94f5d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -531,14 +531,14 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log) error = LOG_INFO_MEM; goto err; } - if (init_dynamic_array(&logs_to_purge, sizeof(char*), 1024, 1024)) + if (my_init_dynamic_array(&logs_to_purge, sizeof(char*), 1024, 1024)) { error = LOG_INFO_MEM; goto err; } logs_to_purge_inited = 1; - if (init_dynamic_array(&logs_to_keep, sizeof(char*), 1024, 1024)) + if (my_init_dynamic_array(&logs_to_keep, sizeof(char*), 1024, 1024)) { error = LOG_INFO_MEM; goto err; diff --git a/sql/slave.cc b/sql/slave.cc index 930155206c2..6d61ad95475 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -514,7 +514,7 @@ void init_table_rule_hash(HASH* h, bool* h_inited) void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited) { - init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE, + my_init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE, TABLE_RULE_ARR_SIZE); *a_inited = 1; } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 104b431bdbb..1c9e269fde9 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -163,7 +163,7 @@ int acl_init(bool dont_read_acl_tables) init_sql_alloc(&mem,1024,0); init_read_record(&read_record_info,thd,table= tables[0].table,NULL,1,0); - VOID(init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50)); + VOID(my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50)); while (!(read_record_info.read_record(&read_record_info))) { ACL_HOST host; @@ -187,7 +187,7 @@ int acl_init(bool dont_read_acl_tables) freeze_size(&acl_hosts); init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0); - VOID(init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100)); + VOID(my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100)); if (table->field[2]->field_length == 8 && protocol_version == PROTOCOL_VERSION) { @@ -273,7 +273,7 @@ int acl_init(bool dont_read_acl_tables) freeze_size(&acl_users); init_read_record(&read_record_info,thd,table=tables[2].table,NULL,1,0); - VOID(init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100)); + VOID(my_init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100)); while (!(read_record_info.read_record(&read_record_info))) { ACL_DB db; @@ -846,7 +846,7 @@ int wild_case_compare(const char *str,const char *wildstr) static void init_check_host(void) { DBUG_ENTER("init_check_host"); - VOID(init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip), + VOID(my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip), acl_users.elements,1)); VOID(hash_init(&acl_check_hosts,acl_users.elements,0,0, (hash_get_key) check_get_key,0,HASH_CASE_INSENSITIVE)); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 18f256d9edb..d8dcb3a4ea7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1610,7 +1610,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, join_tab[i].table->map); } } - if (init_dynamic_array(keyuse,sizeof(KEYUSE),20,64)) + if (my_init_dynamic_array(keyuse,sizeof(KEYUSE),20,64)) return TRUE; /* fill keyuse with found key parts */ for (KEY_FIELD *field=key_fields ; field != end ; field++) diff --git a/sql/uniques.cc b/sql/uniques.cc index 6b05618bcc7..3a26f610dc5 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -55,7 +55,7 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg, my_b_clear(&file); init_tree(&tree, max_in_memory_size / 16, 0, size, comp_func, 0, NULL, comp_func_fixed_arg); /* If the following fail's the next add will also fail */ - init_dynamic_array(&file_ptrs, sizeof(BUFFPEK), 16, 16); + my_init_dynamic_array(&file_ptrs, sizeof(BUFFPEK), 16, 16); max_elements= max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+size); open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE, MYF(MY_WME)); -- cgit v1.2.1 From 743eb8c9e6a98a615df041cf5a934b934192bd2c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Apr 2002 00:33:52 +0300 Subject: invalidation moved before tables unlocking sql/sql_delete.cc: invalidation moved before tables unlocking invalidation on multidelete error (if something changed) sql/sql_parse.cc: invalidation moved to mysql_admin_table layout fixing sql/sql_table.cc: invalidation moved to mysql_admin_table sql/sql_update.cc: invalidation moved before tables unlocking invalidation on multiupdate error (if something changed) --- sql/sql_delete.cc | 7 +++++-- sql/sql_insert.cc | 6 ++++-- sql/sql_parse.cc | 7 +++---- sql/sql_table.cc | 4 ++++ sql/sql_update.cc | 8 ++++++-- 5 files changed, 22 insertions(+), 10 deletions(-) (limited to 'sql') diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index f5a5a684fc0..986e7599df6 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -176,13 +176,13 @@ cleanup: } if (using_transactions && ha_autocommit_or_rollback(thd,error >= 0)) error=1; + if (deleted) + query_cache_invalidate3(thd, table_list, 1); if (thd->lock) { mysql_unlock_tables(thd, thd->lock); thd->lock=0; } - if (deleted) - query_cache_invalidate3(thd, table_list, 1); delete select; if (error >= 0) // Fatal error send_error(&thd->net,thd->killed ? ER_SERVER_SHUTDOWN: 0); @@ -355,6 +355,9 @@ void multi_delete::send_error(uint errcode,const char *err) if (!deleted) DBUG_VOID_RETURN; + /* Somthing alredy deleted consequently we have to invalidate cache */ + query_cache_invalidate3(thd, delete_tables, 1); + /* Below can happen when thread is killed early ... */ if (!table_being_deleted) table_being_deleted=delete_tables; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 69fc7c00955..f0b9062f740 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -262,6 +262,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, info.copied=values_list.elements; end_delayed_insert(thd); } + if (info.copied || info.deleted) + query_cache_invalidate3(thd, table_list, 1); } else { @@ -303,6 +305,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, } if (using_transactions) error=ha_autocommit_or_rollback(thd,error); + if (info.copied || info.deleted) + query_cache_invalidate3(thd, table_list, 1); if (thd->lock) { mysql_unlock_tables(thd, thd->lock); @@ -310,8 +314,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, } } thd->proc_info="end"; - if (info.copied || info.deleted) - query_cache_invalidate3(thd, table_list, 1); table->time_stamp=save_time_stamp; // Restore auto timestamp ptr table->next_number_field=0; thd->count_cuted_fields=0; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index dc89888a1a5..055a99320de 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1669,7 +1669,6 @@ mysql_execute_command(void) check_table_access(thd,SELECT_ACL | INSERT_ACL, tables)) goto error; /* purecov: inspected */ res = mysql_repair_table(thd, tables, &lex->check_opt); - query_cache_invalidate3(thd, tables, 0); break; } case SQLCOM_CHECK: @@ -1678,7 +1677,6 @@ mysql_execute_command(void) check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables)) goto error; /* purecov: inspected */ res = mysql_check_table(thd, tables, &lex->check_opt); - query_cache_invalidate3(thd, tables, 0); break; } case SQLCOM_ANALYZE: @@ -1941,8 +1939,9 @@ mysql_execute_command(void) /* Fix tables-to-be-deleted-from list to point at opened tables */ for (auxi=(TABLE_LIST*) aux_tables ; auxi ; auxi=auxi->next) auxi->table= ((TABLE_LIST*) auxi->table)->table; - if (!thd->fatal_error && (result=new multi_delete(thd,aux_tables, - lex->lock_option,table_count))) + if (!thd->fatal_error && (result= new multi_delete(thd,aux_tables, + lex->lock_option, + table_count))) { res=mysql_select(thd,tables,select_lex->item_list, select_lex->where, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index dcbfd709f97..4a782d396c2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1120,8 +1120,12 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, if (fatal_error) table->table->version=0; // Force close of table else if (open_for_modify) + { remove_table_from_cache(thd, table->table->table_cache_key, table->table->real_name); + /* May be something modified consequently we have to invalidate cache */ + query_cache_invalidate3(thd, table->table, 0); + } close_thread_tables(thd); table->table=0; // For query cache if (my_net_write(&thd->net, (char*) packet->ptr(), diff --git a/sql/sql_update.cc b/sql/sql_update.cc index db520af61c1..eb81f315719 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -318,13 +318,13 @@ int mysql_update(THD *thd, } if (using_transactions && ha_autocommit_or_rollback(thd, error >= 0)) error=1; + if (updated) + query_cache_invalidate3(thd, table_list, 1); if (thd->lock) { mysql_unlock_tables(thd, thd->lock); thd->lock=0; } - if (updated) - query_cache_invalidate3(thd, table_list, 1); delete select; if (error >= 0) @@ -642,6 +642,10 @@ void multi_update::send_error(uint errcode,const char *err) /* If nothing updated return */ if (!updated) return; + + /* Somthing alredy updated consequently we have to invalidate cache */ + query_cache_invalidate3(thd, update_tables, 1); + /* Below can happen when thread is killed early ... */ if (!table_being_updated) table_being_updated=update_tables; -- cgit v1.2.1 From 7cec02a26e4c60626088bc0ebaf1372d246e71d1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Apr 2002 12:24:14 +0300 Subject: Fixed that enable-reads-from-master and repl-parse-query works in option files. Fixed slowdown problem on win98 Fixed syntax for ALTER TABLE .. RENAME Docs/manual.texi: changelog libmysql/libmysql.c: Fixed that enable-reads-from-master and repl-parse-query works in option files. myisam/ft_boolean_search.c: Portability fixes mysys/my_thr_init.c: cleanup sql/sql_base.cc: Fixed slowdown problem on win98 sql/sql_delete.cc: Removed compiler warnings sql/sql_insert.cc: Removed compiler warnings sql/sql_update.cc: Removed compiler warnings sql/sql_yacc.yy: Fixed syntax for ALTER TABLE .. RENAME vio/vio.c: Added test of OS2 vio/viosocket.c: cleanup --- sql/sql_base.cc | 7 ++++--- sql/sql_delete.cc | 6 +++++- sql/sql_insert.cc | 7 ++++++- sql/sql_update.cc | 5 ++++- sql/sql_yacc.yy | 7 ++++--- 5 files changed, 23 insertions(+), 9 deletions(-) (limited to 'sql') diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 88854396ae3..4d6c4ba1bb9 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -195,6 +195,7 @@ send_fields(THD *thd,List &list,uint flag) Item *item; char buff[80]; CONVERT *convert= (flag & 4) ? (CONVERT*) 0 : thd->convert_set; + DBUG_ENTER("send_fields"); String tmp((char*) buff,sizeof(buff)),*res,*packet= &thd->packet; @@ -255,11 +256,11 @@ send_fields(THD *thd,List &list,uint flag) if (my_net_write(&thd->net, (char*) packet->ptr(),packet->length())) break; /* purecov: inspected */ } - send_eof(&thd->net); - return 0; + send_eof(&thd->net,1); + DBUG_RETURN(0); err: send_error(&thd->net,ER_OUT_OF_RESOURCES); /* purecov: inspected */ - return 1; /* purecov: inspected */ + DBUG_RETURN(1); /* purecov: inspected */ } diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index f5a5a684fc0..9d1037a9dc7 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -182,7 +182,9 @@ cleanup: thd->lock=0; } if (deleted) - query_cache_invalidate3(thd, table_list, 1); + { + query_cache_invalidate3(thd, table_list, 1); + } delete select; if (error >= 0) // Fatal error send_error(&thd->net,thd->killed ? ER_SERVER_SHUTDOWN: 0); @@ -470,7 +472,9 @@ bool multi_delete::send_eof() VOID(ha_autocommit_or_rollback(thd,error > 0)); } if (deleted) + { query_cache_invalidate3(thd, delete_tables, 1); + } ::send_ok(&thd->net,deleted); return 0; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 69fc7c00955..6cc4f258c65 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -311,7 +311,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, } thd->proc_info="end"; if (info.copied || info.deleted) + { query_cache_invalidate3(thd, table_list, 1); + } table->time_stamp=save_time_stamp; // Restore auto timestamp ptr table->next_number_field=0; thd->count_cuted_fields=0; @@ -1330,7 +1332,9 @@ void select_insert::send_error(uint errcode,const char *err) table->file->activate_all_index(thd); ha_rollback_stmt(thd); if (info.copied || info.deleted) + { query_cache_invalidate3(thd, table, 1); + } } @@ -1343,8 +1347,9 @@ bool select_insert::send_eof() if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error) error=error2; if (info.copied || info.deleted) + { query_cache_invalidate3(thd, table, 1); - + } if (error) { table->file->print_error(error,MYF(0)); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index db520af61c1..f8a0d169d5a 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -324,7 +324,9 @@ int mysql_update(THD *thd, thd->lock=0; } if (updated) + { query_cache_invalidate3(thd, table_list, 1); + } delete select; if (error >= 0) @@ -788,8 +790,9 @@ bool multi_update::send_eof() sprintf(buff,ER(ER_UPDATE_INFO), (long) found, (long) updated, (long) thd->cuted_fields); if (updated) + { query_cache_invalidate3(thd, update_tables, 1); - + } ::send_ok(&thd->net, (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated, thd->insert_id_used ? thd->insert_id() : 0L,buff); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 63bfb217b52..79227bcc3f9 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1237,11 +1237,11 @@ alter_list_item: lex->alter_list.push_back(new Alter_column($3.str,(Item*) 0)); lex->simple_alter=0; } - | RENAME opt_to table_alias table_ident + | RENAME opt_to table_ident { LEX *lex=Lex; - lex->select->db=$4->db.str; - lex->name= $4->table.str; + lex->select->db=$3->db.str; + lex->name= $3->table.str; lex->simple_alter=0; } | create_table_options { Lex->simple_alter=0; } @@ -1268,6 +1268,7 @@ opt_place: opt_to: /* empty */ {} | TO_SYM {} + | EQ {} | AS {}; slave: -- cgit v1.2.1 From 4acaf126ac4b2489626577c92ab8cabd52f35986 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Apr 2002 16:40:46 +0300 Subject: Portability fix --- sql/slave.cc | 12 ++++++++---- sql/slave.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'sql') diff --git a/sql/slave.cc b/sql/slave.cc index 956f21593e5..b473d8ab1e3 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -246,9 +246,10 @@ err: } /* called from get_options() in mysqld.cc on start-up */ -void init_slave_skip_errors(char* arg) + +void init_slave_skip_errors(const char* arg) { - char* p; + const char *p; my_bool last_was_digit = 0; if (bitmap_init(&slave_error_mask,MAX_SLAVE_ERROR,0)) { @@ -275,8 +276,11 @@ void init_slave_skip_errors(char* arg) } } -// we assume we have a run lock on rli and that the both slave thread -// are not running +/* + We assume we have a run lock on rli and that the both slave thread + are not running +*/ + int purge_relay_logs(RELAY_LOG_INFO* rli, bool just_reset, const char** errmsg) { DBUG_ENTER("purge_relay_logs"); diff --git a/sql/slave.h b/sql/slave.h index 75e3e81e57f..34df17f2851 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -333,7 +333,7 @@ typedef struct st_table_rule_ent #define SLAVE_FORCE_ALL 4 int init_slave(); -void init_slave_skip_errors(char* arg); +void init_slave_skip_errors(const char* arg); int flush_master_info(MASTER_INFO* mi); int flush_relay_log_info(RELAY_LOG_INFO* rli); int register_slave_on_master(MYSQL* mysql); -- cgit v1.2.1 From 0502b8601f17967aac0b492683d7e53e7263b3ac Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 May 2002 18:04:21 +0300 Subject: Fixed problems with DECIMAL() type on overflow. Docs/manual.texi: Changlog configure.in: Change to version 3.23.51 Fix for OSF1 include/mysqld_error.h: Added copyright message isam/pack_isam.c: Added copyright message mysql-test/r/type_decimal.result: New test results mysql-test/t/type_decimal.test: New test results strings/Makefile.am: Added mising file --- sql/field.cc | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'sql') diff --git a/sql/field.cc b/sql/field.cc index c6a26a48c0c..246427cc2ac 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -63,8 +63,8 @@ const char field_separator=','; *****************************************************************************/ /* - ** Calculate length of number and it's parts - ** Increment cuted_fields if wrong number + Calculate length of number and it's parts + Increment cuted_fields if wrong number */ static bool @@ -380,13 +380,34 @@ Field_decimal::reset(void) void Field_decimal::overflow(bool negative) { uint len=field_length; - char *to=ptr; - if (negative && !unsigned_flag) + char *to=ptr, filler= '9'; + if (negative) { - *to++ = '-'; - len--; + if (!unsigned_flag) + { + /* Put - sign as a first digit so we'll have -999..999 or 999..999 */ + *to++ = '-'; + len--; + } + else + { + filler= '0'; // Fill up with 0 + if (!zerofill) + { + /* + Handle unsigned integer without zerofill, in which case + the number should be of format ' 0' or ' 0.000' + */ + uint whole_part=field_length- (dec ? dec+2 : 1); + // Fill with spaces up to the first digit + bfill(to, whole_part, ' '); + to+= whole_part; + len-= whole_part; + // The main code will also handle the 0 before the decimal point + } + } } - bfill(to,len,negative && unsigned_flag ? '0' : '9'); + bfill(to, len, filler); if (dec) ptr[field_length-dec-1]='.'; return; @@ -421,10 +442,15 @@ void Field_decimal::store(const char *from,uint len) from++; if (unsigned_flag) // No sign with zerofill { - if (!error) - current_thd->cuted_fields++; - Field_decimal::overflow(1); - return; + if (decstr.sign_char == '+') // just remove "+" + decstr.sign= 0; + else + { + if (!error) + current_thd->cuted_fields++; + Field_decimal::overflow(1); + return; + } } } /* -- cgit v1.2.1 From 1a1c4485a2e9512498709b6210375f9a3e8fedc9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 May 2002 18:55:38 -0700 Subject: Backport of Sasha's fix to 3.23 from 4.0 see dev-private email from sasha, subject: URGENT: rpl_sporadic_master BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/slave.cc | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'sql') diff --git a/sql/slave.cc b/sql/slave.cc index cff3af42ce1..cb3d375f476 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -837,9 +837,6 @@ command"); static uint read_event(MYSQL* mysql, MASTER_INFO *mi) { uint len = packet_error; - // for convinience lets think we start by - // being in the interrupted state :-) - int read_errno = EINTR; // my_real_read() will time us out // we check if we were told to die, and if not, try reading again @@ -848,27 +845,21 @@ static uint read_event(MYSQL* mysql, MASTER_INFO *mi) return packet_error; #endif - while (!abort_loop && !abort_slave && len == packet_error && - read_errno == EINTR ) - { - len = mc_net_safe_read(mysql); - read_errno = errno; - } - if (abort_loop || abort_slave) - return packet_error; - if (len == packet_error || (int) len < 1) + len = mc_net_safe_read(mysql); + + if (len == packet_error || (long) len < 1) { - sql_print_error("Error reading packet from server: %s (read_errno %d,\ + sql_print_error("Error reading packet from server: %s (\ server_errno=%d)", - mc_mysql_error(mysql), read_errno, mc_mysql_errno(mysql)); + mc_mysql_error(mysql), mc_mysql_errno(mysql)); return packet_error; } if (len == 1) { sql_print_error("Slave: received 0 length packet from server, apparent\ - master shutdown: %s (%d)", - mc_mysql_error(mysql), read_errno); + master shutdown: %s", + mc_mysql_error(mysql)); return packet_error; } -- cgit v1.2.1 From 2f790c9be5ae1324443bec899ef7f7ba5c0d81f1 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 May 2002 11:11:00 +0300 Subject: Fixed bug in ISNULL(not_null_expression) Docs/manual.texi: Changlelog --- sql/item_cmpfunc.cc | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'sql') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 2b7f4cb6c40..0c0eef37841 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -25,9 +25,9 @@ #include /* -** Test functions -** These returns 0LL if false and 1LL if true and null if some arg is null -** 'AND' and 'OR' never return null + Test functions + These returns 0LL if false and 1LL if true and null if some arg is null + 'AND' and 'OR' never return null */ longlong Item_func_not::val_int() @@ -59,8 +59,10 @@ void Item_bool_func2::fix_length_and_dec() { max_length=1; - /* As some compare functions are generated after sql_yacc, - we have to check for out of memory conditons here */ + /* + As some compare functions are generated after sql_yacc, + we have to check for out of memory conditons here + */ if (!args[0] || !args[1]) return; // Make a special case of compare with fields to get nicer DATE comparisons @@ -336,8 +338,10 @@ void Item_func_between::fix_length_and_dec() { max_length=1; - /* As some compare functions are generated after sql_yacc, - we have to check for out of memory conditons here */ + /* + As some compare functions are generated after sql_yacc, + we have to check for out of memory conditons here + */ if (!args[0] || !args[1] || !args[2]) return; cmp_type=args[0]->result_type(); @@ -389,7 +393,7 @@ longlong Item_func_between::val_int() { longlong value=args[0]->val_int(),a,b; if ((null_value=args[0]->null_value)) - return 0; /* purecov: inspected */ + return 0; /* purecov: inspected */ a=args[1]->val_int(); b=args[2]->val_int(); if (!args[1]->null_value && !args[2]->null_value) @@ -409,7 +413,7 @@ longlong Item_func_between::val_int() { double value=args[0]->val(),a,b; if ((null_value=args[0]->null_value)) - return 0; /* purecov: inspected */ + return 0; /* purecov: inspected */ a=args[1]->val(); b=args[2]->val(); if (!args[1]->null_value && !args[2]->null_value) @@ -594,11 +598,10 @@ Item_func_nullif::val_str(String *str) } /* -** CASE expression + CASE expression + Return the matching ITEM or NULL if all compares (including else) failed */ -/* Return the matching ITEM or NULL if all compares (including else) failed */ - Item *Item_func_case::find_item(String *str) { String *first_expr_str,*tmp; @@ -786,7 +789,7 @@ void Item_func_case::print(String *str) } /* -** Coalesce - return first not NULL argument. + Coalesce - return first not NULL argument. */ String *Item_func_coalesce::val_str(String *str) @@ -841,7 +844,7 @@ void Item_func_coalesce::fix_length_and_dec() } /**************************************************************************** -** classes and function for the IN operator + Classes and function for the IN operator ****************************************************************************/ static int cmp_longlong(longlong *a,longlong *b) @@ -914,7 +917,7 @@ byte *in_longlong::get_value(Item *item) { tmp=item->val_int(); if (item->null_value) - return 0; /* purecov: inspected */ + return 0; /* purecov: inspected */ return (byte*) &tmp; } @@ -932,7 +935,7 @@ byte *in_double::get_value(Item *item) { tmp=item->val(); if (item->null_value) - return 0; /* purecov: inspected */ + return 0; /* purecov: inspected */ return (byte*) &tmp; } @@ -1170,9 +1173,11 @@ longlong Item_cond_and::val_int() { if (item->val_int() == 0) { - /* TODO: In case of NULL, ANSI would require us to continue evaluation - until we get a FALSE value or run out of values; This would - require a lot of unnecessary evaluation, which we skip for now */ + /* + TODO: In case of NULL, ANSI would require us to continue evaluation + until we get a FALSE value or run out of values; This would + require a lot of unnecessary evaluation, which we skip for now + */ null_value=item->null_value; return 0; } @@ -1201,6 +1206,12 @@ longlong Item_cond_or::val_int() longlong Item_func_isnull::val_int() { + /* + Handle optimization if the argument can't be null + This has to be here because of the test in update_used_tables(). + */ + if (!used_tables_cache) + return 0; (void) args[0]->val(); return (args[0]->null_value) ? 1 : 0; } -- cgit v1.2.1 From 25623f6f3fa9fdc284bdbff1ec1e26a89bd68776 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 May 2002 11:43:25 +0000 Subject: bug with indexless boolean fts and master-slave optimization fixed --- sql/item_func.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/item_func.cc b/sql/item_func.cc index 09631b52cf6..cffa92919ba 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2039,6 +2039,9 @@ void Item_func_match::init_search(bool no_order) if (ft_handler) return; + if (key == NO_SUCH_KEY) + concat=new Item_func_concat_ws (new Item_string(" ",1), fields); + if (master) { join_key=master->join_key=join_key|master->join_key; @@ -2048,9 +2051,6 @@ void Item_func_match::init_search(bool no_order) return; } - if (key == NO_SUCH_KEY) - concat=new Item_func_concat_ws (new Item_string(" ",1), fields); - String *ft_tmp=0; char tmp1[FT_QUERY_MAXLEN]; String tmp2(tmp1,sizeof(tmp1)); -- cgit v1.2.1 From 9a6691965bfbbd3689d2d0355d12cd6a92ebb5ad Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 May 2002 19:08:56 +0300 Subject: Fix for ISNULL() Docs/manual.texi: Chagnelog mysql-test/r/join.result: New tests for IS NULL mysql-test/t/join.test: New tests for IS NULL --- sql/item_cmpfunc.cc | 2 +- sql/item_cmpfunc.h | 7 +++++++ sql/item_timefunc.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0c0eef37841..73821f8d826 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1211,7 +1211,7 @@ longlong Item_func_isnull::val_int() This has to be here because of the test in update_used_tables(). */ if (!used_tables_cache) - return 0; + return cached_value; (void) args[0]->val(); return (args[0]->null_value) ? 1 : 0; } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 5ee0687c064..e7c598808e8 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -429,6 +429,7 @@ class Item_func_in :public Item_int_func class Item_func_isnull :public Item_bool_func { + longlong cached_value; public: Item_func_isnull(Item *a) :Item_bool_func(a) {} longlong val_int(); @@ -449,6 +450,12 @@ public: args[0]->update_used_tables(); used_tables_cache=args[0]->used_tables(); } + if (!used_tables_cache) + { + /* Remember if the value is always NULL or never NULL */ + args[0]->val(); + cached_value= args[0]->null_value ? (longlong) 1 : (longlong) 0; + } } optimize_type select_optimize() const { return OPTIMIZE_NULL; } }; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 6913d4c6809..720f8ba2882 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -47,7 +47,7 @@ public: Item_func_to_days(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "to_days"; } - void fix_length_and_dec() { decimals=0; max_length=6; } + void fix_length_and_dec() { decimals=0; max_length=6; maybe_null=1; } }; -- cgit v1.2.1 From f7b201e11f52f06a4d2d8bff29ed405e342ff2c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 May 2002 20:35:06 +0300 Subject: Fixed some bugs in my_getopt.c, added functionality for new GET_* types, migrated mysqld.cc to use my_getopt. include/my_getopt.h: Added missing types; GET_INT, GET_UINT, GET_ULONG, GET_ULL mysys/my_getopt.c: - Fixed a bug in processing short options; variable value was set wrongly after processing it in get_one_option(), when it needed to be done before it. - Fixed a bug in setting variable values; if type was OPT_ARG, a call without argument destroyed the default value - Added functionality for new GET_* types. sql/mysqld.cc: Changed mysqld.cc to use my_getopt. --- sql/mysqld.cc | 2281 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 1215 insertions(+), 1066 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b660781162f..91388197dc4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -65,7 +65,7 @@ extern "C" { // Because of SCO 3.2V4.2 #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ // Skip warnings in getopt.h #endif -#include +#include #ifdef HAVE_SYSENT_H #include #endif @@ -250,6 +250,8 @@ static my_socket unix_sock= INVALID_SOCKET,ip_sock= INVALID_SOCKET; static my_string opt_logname=0,opt_update_logname=0, opt_binlog_index_name = 0,opt_slow_logname=0; static char mysql_home[FN_REFLEN],pidfile_name[FN_REFLEN]; +static char* mysql_home_ptr= mysql_home; +static char* pidfile_name_ptr= pidfile_name; static pthread_t select_thread; static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl, opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0, @@ -357,6 +359,8 @@ char mysql_real_data_home[FN_REFLEN], default_charset[LIBLEN],mysql_charsets_dir[FN_REFLEN], *charsets_list, blob_newline,f_fyllchar,max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file; +char *language_ptr= language; +char *default_charset_ptr= default_charset; #ifndef EMBEDDED_LIBRARY char mysql_data_home_buff[2], *mysql_data_home=mysql_data_home_buff; bool mysql_embedded=0; @@ -2703,7 +2707,7 @@ enum options { OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB, OPT_TABLE_TYPE, OPT_INIT_FILE, OPT_DELAY_KEY_WRITE, OPT_SLOW_QUERY_LOG, - OPT_SKIP_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, + OPT_USE_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, OPT_BDB_HOME, OPT_BDB_LOG, OPT_BDB_TMP, OPT_BDB_NOSYNC, OPT_BDB_LOCK, OPT_BDB_SKIP, @@ -2717,7 +2721,7 @@ enum options { OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB, OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES, OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB, - OPT_WANT_CORE, OPT_SKIP_CONCURRENT_INSERT, + OPT_WANT_CORE, OPT_CONCURRENT_INSERT, OPT_MEMLOCK, OPT_MYISAM_RECOVER, OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID, OPT_SKIP_SLAVE_START, OPT_SKIP_INNOBASE, @@ -2750,349 +2754,751 @@ enum options { OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE, OPT_RECKLESS_SLAVE, OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, - OPT_SSL_CAPATH, OPT_SSL_CIPHER + OPT_SSL_CAPATH, OPT_SSL_CIPHER, + OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE, + OPT_CONNECT_TIMEOUT, OPT_DELAYED_INSERT_TIMEOUT, + OPT_DELAYED_INSERT_LIMIT, OPT_DELAYED_QUEUE_SIZE, + OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN, + OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT, + OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE, + OPT_KEY_BUFFER_SIZE, OPT_LONG_QUERY_TIME, + OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET, + OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE, + OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS, + OPT_MAX_DELAYED_THREADS, OPT_MAX_HEP_TABLE_SIZE, + OPT_MAX_JOIN_SIZE, OPT_MAX_SORT_LENGTH, + OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS, + OPT_MAX_WRITE_LOCK_COUNT, OPT_MYISAM_BULK_INSERT_TREE_SIZE, + OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, + OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE, + OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT, + OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT, + OPT_OPEN_FILES_LIMIT, OPT_QUERY_BUFFER_SIZE, + OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_SIZE, + OPT_QUERY_CACHE_STARTUP_TYPE, OPT_RECORD_BUFFER, + OPT_RECORD_RND_BUFFER, OPT_RELAY_LOG_SPACE_LIMIT, + OPT_SLAVE_NET_TIMEOUT, OPT_SLOW_LAUNCH_TIME, + OPT_SORT_BUFFER, OPT_TABLE_CACHE, + OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, + OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, + OPT_WAIT_TIMEOUT }; -static struct option long_options[] = { - {"ansi", no_argument, 0, 'a'}, - {"basedir", required_argument, 0, 'b'}, + +#define LONG_TIMEOUT ((ulong) 3600L*24L*365L) + +static struct my_option my_long_options[] = +{ + {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"basedir", 'b', + "Path to installation directory. All paths are usually resolved relative to this.", + (gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, #ifdef HAVE_BERKELEY_DB - {"bdb-home", required_argument, 0, (int) OPT_BDB_HOME}, - {"bdb-lock-detect", required_argument, 0, (int) OPT_BDB_LOCK}, - {"bdb-logdir", required_argument, 0, (int) OPT_BDB_LOG}, - {"bdb-no-recover", no_argument, 0, (int) OPT_BDB_NO_RECOVER}, - {"bdb-no-sync", no_argument, 0, (int) OPT_BDB_NOSYNC}, - {"bdb-shared-data", no_argument, 0, (int) OPT_BDB_SHARED}, - {"bdb-tmpdir", required_argument, 0, (int) OPT_BDB_TMP}, -#endif - {"big-tables", no_argument, 0, (int) OPT_BIG_TABLES}, - {"binlog-do-db", required_argument, 0, (int) OPT_BINLOG_DO_DB}, - {"binlog-ignore-db", required_argument, 0, (int) OPT_BINLOG_IGNORE_DB}, - {"bind-address", required_argument, 0, (int) OPT_BIND_ADDRESS}, - {"bootstrap", no_argument, 0, (int) OPT_BOOTSTRAP}, + {"bdb-home", OPT_BDB_HOME, "Berkeley home directory", (gptr*) &berkeley_home, + (gptr*) &berkeley_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"bdb-lock-detect", OPT_BDB_LOCK, + "Berkeley lock detect (DEFAULT, OLDEST, RANDOM or YOUNGEST, # sec)", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"bdb-logdir", OPT_BDB_LOG, "Berkeley DB log file directory", + (gptr*) &berkeley_logdir, (gptr*) &berkeley_logdir, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"bdb-no-recover", OPT_BDB_NO_RECOVER, + "Don't try to recover Berkeley DB tables on start", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"bdb-no-sync", OPT_BDB_NOSYNC, "Don't synchronously flush logs", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"bdb-shared-data", OPT_BDB_SHARED, + "Start Berkeley DB in multi-process mode", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, + 0, 0, 0, 0, 0}, + {"bdb-tmpdir", OPT_BDB_TMP, "Berkeley DB tempfile name", + (gptr*) &berkeley_tmpdir, (gptr*) &berkeley_tmpdir, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#endif /* HAVE_BERKELEY_DB */ + {"skip-bdb", OPT_BDB_SKIP, "Don't use berkeley db (will save memory)", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"big-tables", OPT_BIG_TABLES, + "Allow big result sets by saving all temporary sets on file (Solves most 'table full' errors)", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"binlog-do-db", OPT_BINLOG_DO_DB, + "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"binlog-ignore-db", OPT_BINLOG_IGNORE_DB, + "Tells the master that updates to the given database should not be logged tothe binary log", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"bind-address", OPT_BIND_ADDRESS, "Ip address to bind to", + (gptr*) &my_bind_addr, (gptr*) &my_bind_addr, 0, GET_ULONG, REQUIRED_ARG, 0, + 0, 0, 0, 0, 0}, + {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef __WIN__ - {"console", no_argument, 0, (int) OPT_CONSOLE}, -#endif - {"core-file", no_argument, 0, (int) OPT_WANT_CORE}, - {"chroot", required_argument, 0, 'r'}, - {"character-sets-dir", required_argument, 0, (int) OPT_CHARSETS_DIR}, - {"datadir", required_argument, 0, 'h'}, - {"debug", optional_argument, 0, '#'}, - {"des-key-file", required_argument, 0, (int) OPT_DES_KEY_FILE}, - {"default-character-set", required_argument, 0, 'C'}, - {"default-table-type", required_argument, 0, (int) OPT_TABLE_TYPE}, - {"delay-key-write-for-all-tables", - no_argument, 0, (int) OPT_DELAY_KEY_WRITE}, - {"enable-locking", no_argument, 0, (int) OPT_ENABLE_LOCK}, - {"enable-named-pipe", no_argument, 0, (int) OPT_HAVE_NAMED_PIPE}, - {"enable-pstack", no_argument, 0, (int) OPT_DO_PSTACK}, - {"exit-info", optional_argument, 0, 'T'}, - {"flush", no_argument, 0, (int) OPT_FLUSH}, - {"init-rpl-role", required_argument, 0, (int) OPT_INIT_RPL_ROLE}, - /* We must always support this option to make scripts like mysqltest easier - to do */ - {"innodb_data_file_path", required_argument, 0, - OPT_INNODB_DATA_FILE_PATH}, + {"console", OPT_CONSOLE, "Don't remove the console window", + (gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, + {"standalone", OPT_STANDALONE, + "Dummy option to start as a standalone program (NT)", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif + {"core-file", OPT_WANT_CORE, "Write core on errors", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"chroot", 'r', "Chroot mysqld daemon during startup.", + (gptr*) &mysqld_chroot, (gptr*) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"character-sets-dir", OPT_CHARSETS_DIR, + "Directory where character sets are", (gptr*) &charsets_dir, + (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"datadir", 'h', "Path to the database root", (gptr*) &mysql_data_home, + (gptr*) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#ifndef DBUG_OFF + {"debug", '#', "Debug log.", (gptr*) &default_dbug_option, + (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef SAFEMALLOC + {"skip-safemalloc", OPT_SKIP_SAFEMALLOC, + "Don't use the memory allocation checking", 0, 0, 0, GET_NO_ARG, NO_ARG, + 0, 0, 0, 0, 0, 0}, +#endif +#endif +#ifdef HAVE_OPENSSL + {"des-key-file", OPT_DES_KEY_FILE, + "Load keys for des_encrypt() and des_encrypt from given file", + (gptr*) &des_key_file, (gptr*) &des_key_file, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, +#endif /* HAVE_OPENSSL */ + {"default-character-set", 'C', "Set the default character set", + (gptr*) &default_charset_ptr, (gptr*) &default_charset_ptr, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"default-table-type", OPT_TABLE_TYPE, + "Set the default table type for tables", (gptr*) &default_table_type_name, + (gptr*) &default_table_type_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, + 0}, + {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE, + "Don't flush key buffers between writes for any MyISAM table", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"enable-locking", OPT_ENABLE_LOCK, "Enable system locking", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef __NT__ + {"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT)", + (gptr*) &opt_enable_named_pipe, (gptr*) &opt_enable_named_pipe, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif + {"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure", + (gptr*) &opt_do_pstack, (gptr*) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0, + 0, 0, 0, 0}, + {"exit-info", 'T', "Used for debugging; Use at your own risk!", 0, 0, 0, + GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"flush", OPT_FLUSH, "Flush tables to disk between SQL commands", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + /* We must always support the next option to make scripts like mysqltest + easier to do */ + {"init-rpl-role", OPT_INIT_RPL_ROLE, "Set the replication role", 0, 0, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH, + "Path to individual files and their sizes", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_INNOBASE_DB - {"innodb_data_home_dir", required_argument, 0, - OPT_INNODB_DATA_HOME_DIR}, - {"innodb_log_group_home_dir", required_argument, 0, - OPT_INNODB_LOG_GROUP_HOME_DIR}, - {"innodb_log_arch_dir", required_argument, 0, - OPT_INNODB_LOG_ARCH_DIR}, - {"innodb_log_archive", optional_argument, 0, - OPT_INNODB_LOG_ARCHIVE}, - {"innodb_flush_log_at_trx_commit", optional_argument, 0, - OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT}, - {"innodb_fast_shutdown", optional_argument, 0, - OPT_INNODB_FAST_SHUTDOWN}, - {"innodb_flush_method", required_argument, 0, - OPT_INNODB_FLUSH_METHOD}, -#endif - {"help", no_argument, 0, '?'}, - {"init-file", required_argument, 0, (int) OPT_INIT_FILE}, - {"log", optional_argument, 0, 'l'}, - {"language", required_argument, 0, 'L'}, - {"local-infile", optional_argument, 0, (int) OPT_LOCAL_INFILE}, - {"log-bin", optional_argument, 0, (int) OPT_BIN_LOG}, - {"log-bin-index", required_argument, 0, (int) OPT_BIN_LOG_INDEX}, - {"log-isam", optional_argument, 0, (int) OPT_ISAM_LOG}, - {"log-update", optional_argument, 0, (int) OPT_UPDATE_LOG}, - {"log-slow-queries", optional_argument, 0, (int) OPT_SLOW_QUERY_LOG}, - {"log-long-format", no_argument, 0, (int) OPT_LONG_FORMAT}, - {"log-slave-updates", no_argument, 0, (int) OPT_LOG_SLAVE_UPDATES}, - {"low-priority-updates", no_argument, 0, (int) OPT_LOW_PRIORITY_UPDATES}, - {"master-host", required_argument, 0, (int) OPT_MASTER_HOST}, - {"master-user", required_argument, 0, (int) OPT_MASTER_USER}, - {"master-password", required_argument, 0, (int) OPT_MASTER_PASSWORD}, - {"master-port", required_argument, 0, (int) OPT_MASTER_PORT}, - {"master-connect-retry", required_argument, 0, (int) OPT_MASTER_CONNECT_RETRY}, - {"master-retry-count", required_argument, 0, (int) OPT_MASTER_RETRY_COUNT}, - {"master-info-file", required_argument, 0, (int) OPT_MASTER_INFO_FILE}, - {"master-ssl", optional_argument, 0, (int) OPT_MASTER_SSL}, - {"master-ssl-key", optional_argument, 0, (int) OPT_MASTER_SSL_KEY}, - {"master-ssl-cert", optional_argument, 0, (int) OPT_MASTER_SSL_CERT}, - {"myisam-recover", optional_argument, 0, (int) OPT_MYISAM_RECOVER}, - {"memlock", no_argument, 0, (int) OPT_MEMLOCK}, + {"innodb_data_home_dir", OPT_INNODB_DATA_HOME_DIR, + "The common part for Innodb table spaces", (gptr*) &innobase_data_home_dir, + (gptr*) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, + 0}, + {"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR, + "Path to innodb log files.", (gptr*) &innobase_log_group_home_dir, + (gptr*) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, + 0, 0}, + {"innodb_log_arch_dir", OPT_INNODB_LOG_ARCH_DIR, + "Where full logs should be archived", (gptr*) &innobase_log_arch_dir, + (gptr*) &innobase_log_arch_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"innodb_log_archive", OPT_INNODB_LOG_ARCHIVE, + "Set to 1 if you want to have logs archived", 0, 0, 0, GET_LONG, OPT_ARG, + 0, 0, 0, 0, 0, 0}, + {"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT, + "Set to 0 if you don't want to flush logs", 0, 0, 0, GET_LONG, OPT_ARG, + 0, 0, 0, 0, 0, 0}, + {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD, + "With which method to flush data", (gptr*) &innobase_unix_file_flush_method, + (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, + {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN, + "Speeds up server shutdown process", (gptr*) &innobase_fast_shutdown, + (gptr*) &innobase_fast_shutdown, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, +#endif /* End HAVE_INNOBASE_DB */ + {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, + 0, 0, 0, 0, 0}, + {"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup", + (gptr*) &opt_init_file, (gptr*) &opt_init_file, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"log", 'l', "Log connections and queries to file", (gptr*) &opt_logname, + (gptr*) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"language", 'L', + "Client error messages in given language. May be given as a full path", + (gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"local-infile", OPT_LOCAL_INFILE, + "Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0)", + (gptr*) &opt_local_infile, (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, + 0, 0, 0, 0, 0, 0}, + {"log-bin", OPT_BIN_LOG, + "Log queries in new binary format (for replication)", + (gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STR, OPT_ARG, 0, + 0, 0, 0, 0, 0}, + {"log-bin-index", OPT_BIN_LOG_INDEX, + "File that holds the names for last binary log files", + (gptr*) &opt_binlog_index_name, (gptr*) &opt_binlog_index_name, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file", + (gptr*) &myisam_log_filename, (gptr*) &myisam_log_filename, 0, GET_STR, + OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"log-update", OPT_UPDATE_LOG, + "Log updates to file.# where # is a unique number if not given.", + (gptr*) &opt_update_logname, (gptr*) &opt_update_logname, 0, GET_STR, + OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"log-slow-queries", OPT_SLOW_QUERY_LOG, + "Log slow queries to this log file. Defaults logging to hostname-slow.log", + (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG, + 0, 0, 0, 0, 0, 0}, + {"log-long-format", OPT_LONG_FORMAT, + "Log some extra information to update log", 0, 0, 0, GET_NO_ARG, NO_ARG, + 0, 0, 0, 0, 0, 0}, + {"log-slave-updates", OPT_LOG_SLAVE_UPDATES, + "Tells the slave to log the updates from the slave thread to the binary log. Off by default. You will need to turn it on if you plan to daisy-chain the slaves.", + (gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"low-priority-updates", OPT_LOW_PRIORITY_UPDATES, + "INSERT/DELETE/UPDATE has lower priority than selects", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"master-host", OPT_MASTER_HOST, + "Master hostname or IP address for replication. If not set, the slave thread will not be started. Note that the setting of master-host will be ignored if there exists a valid master.info file.", + (gptr*) &master_host, (gptr*) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + {"master-user", OPT_MASTER_USER, + "The username the slave thread will use for authentication when connecting to the master. The user must have FILE privilege. If the master user is not set, user test is assumed. The value in master.info will take precedence if it can be read.", + (gptr*) &master_user, (gptr*) &master_user, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + {"master-password", OPT_MASTER_PASSWORD, + "The password the slave thread will authenticate with when connecting to the master. If not set, an empty password is assumed.The value in master.info will take precedence if it can be read.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"master-port", OPT_MASTER_PORT, + "The port the master is listening on. If not set, the compiled setting of MYSQL_PORT is assumed. If you have not tinkered with configure options, this should be 3306. The value in master.info will take precedence if it can be read", + (gptr*) &master_port, (gptr*) &master_port, 0, GET_UINT, REQUIRED_ARG, + MYSQL_PORT, 0, 0, 0, 0, 0}, + {"master-connect-retry", OPT_MASTER_CONNECT_RETRY, + "The number of seconds the slave thread will sleep before retrying to connect to the master in case the master goes down or the connection is lost.", + (gptr*) &master_connect_retry, (gptr*) &master_connect_retry, 0, GET_UINT, + REQUIRED_ARG, 60, 0, 0, 0, 0, 0}, + {"master-retry-count", OPT_MASTER_RETRY_COUNT, + "The number of tries the slave will make to connect to the master before giving up.", + (gptr*) &master_retry_count, (gptr*) &master_retry_count, 0, GET_ULONG, + REQUIRED_ARG, 60, 0, 0, 0, 0, 0}, + {"master-info-file", OPT_MASTER_INFO_FILE, + "The location of the file that remembers where we left off on the master during the replication process. The default is `master.info' in the data directory. You should not need to change this.", + (gptr*) &master_info_file, (gptr*) &master_info_file, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"master-ssl", OPT_MASTER_SSL, + "Turn SSL on for replication. Be warned that is this is a relatively new feature.", + (gptr*) &master_ssl, (gptr*) &master_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, + 0, 0}, + {"master-ssl-key", OPT_MASTER_SSL_KEY, + "Master SSL keyfile name. Only applies if you have enabled master-ssl.", + (gptr*) &master_ssl_key, (gptr*) &master_ssl_key, 0, GET_STR, OPT_ARG, + 0, 0, 0, 0, 0, 0}, + {"master-ssl-cert", OPT_MASTER_SSL_CERT, + "Master SSL certificate file name. Only applies if you have enabled master-ssl.", + (gptr*) &master_ssl_cert, (gptr*) &master_ssl_cert, 0, GET_STR, OPT_ARG, + 0, 0, 0, 0, 0, 0}, + {"myisam-recover", OPT_MYISAM_RECOVER, + "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP or FORCE.", + (gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0, + GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, /* Option needs to be available for the test case to pass in non-debugging mode. is a no-op. */ - {"disconnect-slave-event-count", required_argument, 0, - (int) OPT_DISCONNECT_SLAVE_EVENT_COUNT}, - {"abort-slave-event-count", required_argument, 0, - (int) OPT_ABORT_SLAVE_EVENT_COUNT}, - {"max-binlog-dump-events", required_argument, 0, - (int) OPT_MAX_BINLOG_DUMP_EVENTS}, - {"sporadic-binlog-dump-fail", no_argument, 0, - (int) OPT_SPORADIC_BINLOG_DUMP_FAIL}, - {"safemalloc-mem-limit", required_argument, 0, (int) - OPT_SAFEMALLOC_MEM_LIMIT}, - {"new", no_argument, 0, 'n'}, + {"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory, + (gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT, + "Undocumented: Meant for debugging and testing of replication", + (gptr*) &disconnect_slave_event_count, + (gptr*) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, + {"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT, + "Undocumented: Meant for debugging and testing of replication", + (gptr*) &abort_slave_event_count, (gptr*) &abort_slave_event_count, + 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS, "Undocumented", + (gptr*) &max_binlog_dump_events, (gptr*) &max_binlog_dump_events, 0, + GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"sporadic-binlog-dump-fail", OPT_SPORADIC_BINLOG_DUMP_FAIL, "Undocumented", + (gptr*) &opt_sporadic_binlog_dump_fail, + (gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, + 0}, + {"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT, + "Simulate memory shortage when compiled with the --with-debug=full option", + 0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"new", 'n', "Use very new possible 'unsafe' functions", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef NOT_YET - {"no-mix-table-types", no_argument, 0, (int) OPT_NO_MIX_TYPE}, -#endif - {"old-protocol", no_argument, 0, 'o'}, - {"old-rpl-compat", no_argument, 0, (int) OPT_OLD_RPL_COMPAT}, + {"no-mix-table-types", OPT_NO_MIX_TYPE, "Undocumented", + (gptr*) &opt_no_mix_types, (gptr*) &opt_no_mix_types, 0, GET_BOOL, NO_ARG, + 0, 0, 0, 0, 0, 0}, +#endif + {"old-protocol", 'o', "Use the old (3.20) protocol", + (gptr*) &protocol_version, (gptr*) &protocol_version, 0, GET_UINT, NO_ARG, + PROTOCOL_VERSION, 0, 0, 0, 0, 0}, + {"old-rpl-compat", OPT_OLD_RPL_COMPAT, "Undocumented", + (gptr*) &opt_old_rpl_compat, (gptr*) &opt_old_rpl_compat, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef ONE_THREAD - {"one-thread", no_argument, 0, (int) OPT_ONE_THREAD}, -#endif - {"pid-file", required_argument, 0, (int) OPT_PID_FILE}, - {"port", required_argument, 0, 'P'}, - {"reckless-slave", no_argument, 0, (int) OPT_RECKLESS_SLAVE}, - {"replicate-do-db", required_argument, 0, (int) OPT_REPLICATE_DO_DB}, - {"replicate-do-table", required_argument, 0, - (int) OPT_REPLICATE_DO_TABLE}, - {"replicate-wild-do-table", required_argument, 0, - (int) OPT_REPLICATE_WILD_DO_TABLE}, - {"replicate-ignore-db", required_argument, 0, - (int) OPT_REPLICATE_IGNORE_DB}, - {"replicate-ignore-table", required_argument, 0, - (int) OPT_REPLICATE_IGNORE_TABLE}, - {"replicate-wild-ignore-table", required_argument, 0, - (int) OPT_REPLICATE_WILD_IGNORE_TABLE}, - {"replicate-rewrite-db", required_argument, 0, - (int) OPT_REPLICATE_REWRITE_DB}, + {"one-thread", OPT_ONE_THREAD, + "Only use one thread (for debugging under Linux)", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif + {"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld", + (gptr*) &pidfile_name_ptr, (gptr*) &pidfile_name_ptr, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"port", 'P', "Port number to use for connection.", (gptr*) &mysql_port, + (gptr*) &mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"reckless-slave", OPT_RECKLESS_SLAVE, "Undocumented", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"replicate-do-db", OPT_REPLICATE_DO_DB, + "Tells the slave thread to restrict replication to the specified database. To specify more than one database, use the directive multiple times, once for each database. Note that this will only work if you do not use cross-database queries such as UPDATE some_db.some_table SET foo='bar' while having selected a different or no database. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-do-table=db_name.%.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"replicate-do-table", OPT_REPLICATE_DO_TABLE, + "Tells the slave thread to restrict replication to the specified table. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates, in contrast to replicate-do-db.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE, + "Tells the slave thread to restrict replication to the tables that match the specified wildcard pattern. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-do-table=foo%.bar% will replicate only updates to tables in all databases that start with foo and whose table names start with bar", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"replicate-ignore-db", OPT_REPLICATE_IGNORE_DB, + "Tells the slave thread to not replicate to the specified database. To specify more than one database to ignore, use the directive multiple times, once for each database. This option will not work if you use cross database updates. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-ignore-table=db_name.%. ", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"replicate-ignore-table", OPT_REPLICATE_IGNORE_TABLE, + "Tells the slave thread to not replicate to the specified table. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-datbase updates, in contrast to replicate-ignore-db.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"replicate-wild-ignore-table", OPT_REPLICATE_WILD_IGNORE_TABLE, + "Tells the slave thread to not replicate to the tables that match the given wildcard pattern. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% will not do updates to tables in databases that start with foo and whose table names start with bar.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB, + "Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, // In replication, we may need to tell the other servers how to connect - {"report-host", required_argument, 0, (int) OPT_REPORT_HOST}, - {"report-user", required_argument, 0, (int) OPT_REPORT_USER}, - {"report-password", required_argument, 0, (int) OPT_REPORT_PASSWORD}, - {"report-port", required_argument, 0, (int) OPT_REPORT_PORT}, - {"rpl-recovery-rank", required_argument, 0, (int) OPT_RPL_RECOVERY_RANK}, - {"relay-log", required_argument, 0, (int) OPT_RELAY_LOG}, - {"relay-log-index", required_argument, 0, (int) OPT_RELAY_LOG_INDEX}, - {"safe-mode", no_argument, 0, (int) OPT_SAFE}, - {"safe-show-database", no_argument, 0, (int) OPT_SAFE_SHOW_DB}, - {"safe-user-create", no_argument, 0, (int) OPT_SAFE_USER_CREATE}, - {"server-id", required_argument, 0, (int) OPT_SERVER_ID}, - {"set-variable", required_argument, 0, 'O'}, - {"show-slave-auth-info", no_argument, 0, - (int) OPT_SHOW_SLAVE_AUTH_INFO}, - {"skip-bdb", no_argument, 0, (int) OPT_BDB_SKIP}, - {"skip-innodb", no_argument, 0, (int) OPT_INNODB_SKIP}, - {"skip-concurrent-insert", no_argument, 0, (int) OPT_SKIP_CONCURRENT_INSERT}, - {"skip-delay-key-write", no_argument, 0, (int) OPT_SKIP_DELAY_KEY_WRITE}, - {"skip-grant-tables", no_argument, 0, (int) OPT_SKIP_GRANT}, - {"skip-locking", no_argument, 0, (int) OPT_SKIP_LOCK}, - {"skip-host-cache", no_argument, 0, (int) OPT_SKIP_HOST_CACHE}, - {"skip-name-resolve", no_argument, 0, (int) OPT_SKIP_RESOLVE}, - {"skip-networking", no_argument, 0, (int) OPT_SKIP_NETWORKING}, - {"skip-new", no_argument, 0, (int) OPT_SKIP_NEW}, - {"skip-safemalloc", no_argument, 0, (int) OPT_SKIP_SAFEMALLOC}, - {"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB}, - {"skip-slave-start", no_argument, 0, (int) OPT_SKIP_SLAVE_START}, - {"skip-stack-trace", no_argument, 0, (int) OPT_SKIP_STACK_TRACE}, - {"skip-symlink", no_argument, 0, (int) OPT_SKIP_SYMLINKS}, - {"skip-thread-priority", no_argument, 0, (int) OPT_SKIP_PRIOR}, - {"relay-log-info-file", required_argument, 0, - (int) OPT_RELAY_LOG_INFO_FILE}, - {"slave-load-tmpdir", required_argument, 0, (int) OPT_SLAVE_LOAD_TMPDIR}, - {"slave-skip-errors", required_argument, 0, - (int) OPT_SLAVE_SKIP_ERRORS}, - {"socket", required_argument, 0, (int) OPT_SOCKET}, - {"sql-bin-update-same", no_argument, 0, (int) OPT_SQL_BIN_UPDATE_SAME}, - {"sql-mode", required_argument, 0, (int) OPT_SQL_MODE}, + {"report-host", OPT_REPORT_HOST, + "Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.", + (gptr*) &report_host, (gptr*) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + {"report-user", OPT_REPORT_USER, "Undocumented", (gptr*) &report_user, + (gptr*) &report_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"report-password", OPT_REPORT_PASSWORD, "Undocumented", + (gptr*) &report_password, (gptr*) &report_password, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"report-port", OPT_REPORT_PORT, + "Port for connecting to slave reported to the master during slave registration. Set it only if the slave is listening on a non-default port or if you have a special tunnel from the master or other clients to the slave. If not sure, leave this option unset.", + (gptr*) &report_port, (gptr*) &report_port, 0, GET_UINT, REQUIRED_ARG, + MYSQL_PORT, 0, 0, 0, 0, 0}, + {"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented", + (gptr*) &rpl_recovery_rank, (gptr*) &rpl_recovery_rank, 0, GET_UINT, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"relay-log", OPT_RELAY_LOG, "Undocumented", + (gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"relay-log-index", OPT_RELAY_LOG_INDEX, "Undocumented", + (gptr*) &opt_relaylog_index_name, (gptr*) &opt_relaylog_index_name, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"safe-show-database", OPT_SAFE_SHOW_DB, + "Don't show databases for which the user has no privileges", + (gptr*) &opt_safe_show_db, (gptr*) &opt_safe_show_db, 0, GET_BOOL, NO_ARG, + 0, 0, 0, 0, 0, 0}, + {"safe-user-create", OPT_SAFE_USER_CREATE, + "Don't allow new user creation by the user who has no write privileges to the mysql.user table", + (gptr*) &opt_safe_user_create, (gptr*) &opt_safe_user_create, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"server-id", OPT_SERVER_ID, + "Uniquely identifies the server instance in the community of replication partners", + (gptr*) &server_id, (gptr*) &server_id, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, + {"set-variable", 'O', + "Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO, "Undocumented", + (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"concurrent-insert", OPT_CONCURRENT_INSERT, + "Use concurrent insert with MyISAM. Disable with prefix --skip-", + (gptr*) &myisam_concurrent_insert, (gptr*) &myisam_concurrent_insert, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"delay-key-write", OPT_USE_DELAY_KEY_WRITE, + "Use delay_key_write option for all tables. Disable with prefix --skip-", + (gptr*) &myisam_delay_key_write, (gptr*) &myisam_delay_key_write, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-grant-tables", OPT_SKIP_GRANT, + "Start without grant tables. This gives all users FULL ACCESS to all tables!", + (gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, + 0}, + {"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-locking", OPT_SKIP_LOCK, + "Don't use system locking. To use isamchk one has to shut down the server.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-name-resolve", OPT_SKIP_RESOLVE, + "Don't resolve hostnames. All hostnames are IP's or 'localhost'", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-networking", OPT_SKIP_NETWORKING, + "Don't allow connection with TCP/IP.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, + 0, 0, 0}, + {"skip-new", OPT_SKIP_NEW, "Don't use new, possible wrong routines.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-show-database", OPT_SKIP_SHOW_DB, + "Don't allow 'SHOW DATABASE' commands", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, + 0, 0, 0, 0}, + {"skip-slave-start", OPT_SKIP_SLAVE_START, + "If set, slave is not autostarted.", (gptr*) &opt_skip_slave_start, + (gptr*) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-stack-trace", OPT_SKIP_STACK_TRACE, + "Don't print a stack trace on failure", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, + 0, 0, 0, 0}, + {"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-thread-priority", OPT_SKIP_PRIOR, + "Don't give threads different priorities.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, + 0, 0, 0, 0, 0}, + {"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, "Undocumented", + (gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "Undocumented", + (gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS, + "Tells the slave thread to continue replication when a query returns an error from the provided list. Normally, replication will discontinue when an error is encountered, giving the user a chance to resolve the inconsistency in the data manually. Do not use this option unless you fully understand why you are getting the errors. If there are no bugs in your replication setup and client programs, and no bugs in MySQL itself, you should never get an abort with error. Indiscriminate use of this option will result in slaves being hopelessly out of sync with the master and you having no idea how the problem happened. For error codes, you should use the numbers provided by the error message in your slave error log and in the output of SHOW SLAVE STATUS. Full list of error messages can be found in the source distribution in `Docs/mysqld_error.txt'. You can (but should not) also use a very non-recommended value of all which will ignore all error messages and keep barging along regardless. Needless to say, if you use it, we make no promises regarding your data integrity. Please do not complain if your data on the slave is not anywhere close to what it is on the master in this case -- you have been warned. Example: slave-skip-errors=1062,1053 or slave-skip-errors=all", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"socket", OPT_SOCKET, "Socket file to use for connection", + (gptr*) &mysql_unix_port, (gptr*) &mysql_unix_port, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME, + "If set, setting SQL_LOG_BIN to a value will automatically set SQL_LOG_UPDATE to the same value and vice versa.", + (gptr*) &opt_sql_bin_update, (gptr*) &opt_sql_bin_update, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"sql-mode", OPT_SQL_MODE, + "Syntax: sql-mode=option[,option[,option...]] where option can be one of: REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, SERIALIZE, ONLY_FULL_GROUP_BY, NO_UNSIGNED_SUBTRACTION.", + (gptr*) &sql_mode_str, (gptr*) &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0, + 0, 0, 0, 0, 0}, #ifdef HAVE_OPENSSL - {"ssl", no_argument, 0, OPT_SSL_SSL}, - {"ssl-key", required_argument, 0, OPT_SSL_KEY}, - {"ssl-cert", required_argument, 0, OPT_SSL_CERT}, - {"ssl-ca", required_argument, 0, OPT_SSL_CA}, - {"ssl-capath", required_argument, 0, OPT_SSL_CAPATH}, - {"ssl-cipher", required_argument, 0, OPT_SSL_CIPHER}, -#endif -#ifdef __WIN__ - {"standalone", no_argument, 0, (int) OPT_STANDALONE}, -#endif - {"transaction-isolation", required_argument, 0, (int) OPT_TX_ISOLATION}, - {"temp-pool", no_argument, 0, (int) OPT_TEMP_POOL}, - {"tmpdir", required_argument, 0, 't'}, - {"use-locking", no_argument, 0, (int) OPT_USE_LOCKING}, +#include "sslopt-longopts.h" +#endif + {"transaction-isolation", OPT_TX_ISOLATION, + "Default transaction isolation level", (gptr*) &default_tx_isolation_name, + (gptr*) &default_tx_isolation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, + 0, 0}, + {"temp-pool", OPT_TEMP_POOL, + "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file. This is to work around a problem in the Linux kernel dealing with creating a bunch of new files with different names. With the old behavior, Linux seems to 'leak' memory, as it's being allocated to the directory entry cache instead of the disk cache.", + (gptr*) &use_temp_pool, (gptr*) &use_temp_pool, 0, GET_BOOL, NO_ARG, 0, 0, + 0, 0, 0, 0}, + {"tmpdir", 't', "Path for temporary files", (gptr*) &mysql_tmpdir, + (gptr*) &mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"use-locking", OPT_USE_LOCKING, "Use system locking", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef USE_SYMDIR - {"use-symbolic-links", no_argument, 0, 's'}, -#endif - {"user", required_argument, 0, 'u'}, - {"version", no_argument, 0, 'V'}, - {"warnings", no_argument, 0, 'W'}, - {0, 0, 0, 0} -}; - -#define LONG_TIMEOUT ((ulong) 3600L*24L*365L) - -CHANGEABLE_VAR changeable_vars[] = { - { "back_log", (long*) &back_log, - 50, 1, 65535, 0, 1 }, + {"use-symbolic-links", 's', "Enable symbolic link support", + (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, 0, 0, + 0, 0, 0, 0}, +#endif + {"user", 'u', "Run mysqld daemon as user", (gptr*) &mysqld_user, + (gptr*) &mysqld_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'v', "Synonym for option -v", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, + 0, 0, 0, 0}, + {"warnings", 'W', "Log some not critical warnings to the log file", + (gptr*) &opt_warnings, (gptr*) &opt_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, + { "back_log", OPT_BACK_LOG, + "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG, + REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, #ifdef HAVE_BERKELEY_DB - { "bdb_cache_size", (long*) &berkeley_cache_size, - KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE }, - {"bdb_log_buffer_size", (long*) &berkeley_log_buffer_size, 0, 256*1024L, - ~0L, 0, 1024}, - { "bdb_max_lock", (long*) &berkeley_max_lock, - 10000, 0, (long) ~0, 0, 1 }, - /* QQ: The following should be removed soon! */ - { "bdb_lock_max", (long*) &berkeley_max_lock, - 10000, 0, (long) ~0, 0, 1 }, -#endif - { "binlog_cache_size", (long*) &binlog_cache_size, - 32*1024L, IO_SIZE, ~0L, 0, IO_SIZE }, - { "connect_timeout", (long*) &connect_timeout, - CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1 }, - { "delayed_insert_timeout", (long*) &delayed_insert_timeout, - DELAYED_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 }, - { "delayed_insert_limit", (long*) &delayed_insert_limit, - DELAYED_LIMIT, 1, ~0L, 0, 1 }, - { "delayed_queue_size", (long*) &delayed_queue_size, - DELAYED_QUEUE_SIZE, 1, ~0L, 0, 1 }, - { "flush_time", (long*) &flush_time, - FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1 }, - { "ft_min_word_len", (long*) &ft_min_word_len, - 4, 1, HA_FT_MAXLEN, 0, 1 }, - { "ft_max_word_len", (long*) &ft_max_word_len, - HA_FT_MAXLEN, 10, HA_FT_MAXLEN, 0, 1 }, - { "ft_max_word_len_for_sort",(long*) &ft_max_word_len_for_sort, - 20, 4, HA_FT_MAXLEN, 0, 1 }, + { "bdb_cache_size", OPT_BDB_CACHE_SIZE, + "The buffer that is allocated to cache index and rows for BDB tables." + (gptr*) &berkeley_cache_size, (gptr*) &berkeley_cache_size, 0, GET_ULONG, + REQUIRED_ARG, KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE, 0}, + {"bdb_log_buffer_size", OPT_BDB_LOG_BUFFER_SIZE, + "The buffer that is allocated to cache index and rows for BDB tables.", + (gptr*) &berkeley_log_buffer_size, (gptr*) &berkeley_log_buffer_size, 0, + GET_ULONG, REQUIRED_ARG, 0, 256*1024L, ~0L, 0, 1024, 0}, + {"bdb_max_lock", OPT_BDB_MAX_LOCK, + "The maximum number of locks you can have active on a BDB table.", + (gptr*) &berkeley_max_lock, (gptr*) &berkeley_max_lock, 0, GET_ULONG, + REQUIRED_ARG, 10000, 0, (long) ~0, 0, 1, 0}, + /* QQ: The following should be removed soon! */ + {"bdb_lock_max", OPT_BDB_MAX_LOCK, "Synonym for bdb_max_lock", + (gptr*) &berkeley_max_lock, (gptr*) &berkeley_max_lock, 0, GET_ULONG, + REQUIRED_ARG, 10000, 0, (long) ~0, 0, 1, 0}, +#endif /* HAVE_BERKELEY_DB */ + {"binlog_cache_size", OPT_BINLOG_CACHE_SIZE, + "The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.", + (gptr*) &binlog_cache_size, (gptr*) &binlog_cache_size, 0, GET_ULONG, + REQUIRED_ARG, 32*1024L, IO_SIZE, ~0L, 0, IO_SIZE, 0}, + {"connect_timeout", OPT_CONNECT_TIMEOUT, + "The number of seconds the mysqld server is waiting for a connect packet before responding with Bad handshake", + (gptr*) &connect_timeout, (gptr*) &connect_timeout, 0, GET_ULONG, + REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 }, + {"delayed_insert_timeout", OPT_DELAYED_INSERT_TIMEOUT, + "How long a INSERT DELAYED thread should wait for INSERT statements before terminating.", + (gptr*) &delayed_insert_timeout, (gptr*) &delayed_insert_timeout, 0, + GET_ULONG, REQUIRED_ARG, DELAYED_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, + {"delayed_insert_limit", OPT_DELAYED_INSERT_LIMIT, + "After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing.", + (gptr*) &delayed_insert_limit, (gptr*) &delayed_insert_limit, 0, GET_ULONG, + REQUIRED_ARG, DELAYED_LIMIT, 1, ~0L, 0, 1, 0}, + { "delayed_queue_size", OPT_DELAYED_QUEUE_SIZE, + "What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again.", + (gptr*) &delayed_queue_size, (gptr*) &delayed_queue_size, 0, GET_ULONG, + REQUIRED_ARG, DELAYED_QUEUE_SIZE, 1, ~0L, 0, 1, 0}, + { "flush_time", OPT_FLUSH_TIME, + "A dedicated thread is created to flush all tables at the given interval.", + (gptr*) &flush_time, (gptr*) &flush_time, 0, GET_ULONG, REQUIRED_ARG, + FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1, 0}, + { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, + "The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.", + (gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG, + REQUIRED_ARG, 4, 1, HA_FT_MAXLEN, 0, 1, 0}, + { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, + "The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.", + (gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG, + REQUIRED_ARG, HA_FT_MAXLEN, 10, HA_FT_MAXLEN, 0, 1, 0}, + { "ft_max_word_len_for_sort", OPT_FT_MAX_WORD_LEN_FOR_SORT, + "Undocumented", (gptr*) &ft_max_word_len_for_sort, + (gptr*) &ft_max_word_len_for_sort, 0, GET_ULONG, REQUIRED_ARG, 20, 4, + HA_FT_MAXLEN, 0, 1, 0}, #ifdef HAVE_INNOBASE_DB - {"innodb_mirrored_log_groups", - (long*) &innobase_mirrored_log_groups, 1, 1, 10, 0, 1}, - {"innodb_log_files_in_group", - (long*) &innobase_log_files_in_group, 2, 2, 100, 0, 1}, - {"innodb_log_file_size", - (long*) &innobase_log_file_size, 5*1024*1024L, 1*1024*1024L, - ~0L, 0, 1024*1024L}, - {"innodb_log_buffer_size", - (long*) &innobase_log_buffer_size, 1024*1024L, 256*1024L, - ~0L, 0, 1024}, - {"innodb_buffer_pool_size", - (long*) &innobase_buffer_pool_size, 8*1024*1024L, 1024*1024L, - ~0L, 0, 1024*1024L}, - {"innodb_additional_mem_pool_size", - (long*) &innobase_additional_mem_pool_size, 1*1024*1024L, 512*1024L, - ~0L, 0, 1024}, - {"innodb_file_io_threads", - (long*) &innobase_file_io_threads, 4, 4, 64, 0, 1}, - {"innodb_lock_wait_timeout", - (long*) &innobase_lock_wait_timeout, 50, 1, - 1024 * 1024 * 1024, 0, 1}, - {"innodb_thread_concurrency", - (long*) &innobase_thread_concurrency, 8, 1, 1000, 0, 1}, - {"innodb_force_recovery", - (long*) &innobase_force_recovery, 0, 0, 6, 0, 1}, -#endif - { "interactive_timeout", (long*) &net_interactive_timeout, - NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 }, - { "join_buffer_size", (long*) &join_buff_size, - 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE }, - { "key_buffer_size", (long*) &keybuff_size, - KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE }, - { "long_query_time", (long*) &long_query_time, - 10, 1, LONG_TIMEOUT, 0, 1 }, - { "lower_case_table_names", (long*) &lower_case_table_names, - IF_WIN(1,0), 0, 1, 0, 1 }, - { "max_allowed_packet", (long*) &max_allowed_packet, - 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 }, - { "max_binlog_cache_size", (long*) &max_binlog_cache_size, - ~0L, IO_SIZE, ~0L, 0, IO_SIZE }, - { "max_binlog_size", (long*) &max_binlog_size, - 1024*1024L*1024L, 1024, 1024*1024L*1024L, 0, 1 }, - { "max_connections", (long*) &max_connections, - 100, 1, 16384, 0, 1 }, - { "max_connect_errors", (long*) &max_connect_errors, - MAX_CONNECT_ERRORS, 1, ~0L, 0, 1 }, - { "max_delayed_threads", (long*) &max_insert_delayed_threads, - 20, 1, 16384, 0, 1 }, - { "max_heap_table_size", (long*) &max_heap_table_size, - 16*1024*1024L, 16384, ~0L, MALLOC_OVERHEAD, 1024 }, - { "max_join_size", (long*) &max_join_size, - ~0L, 1, ~0L, 0, 1 }, - { "max_sort_length", (long*) &max_item_sort_length, - 1024, 4, 8192*1024L, 0, 1 }, - { "max_tmp_tables", (long*) &max_tmp_tables, - 32, 1, ~0L, 0, 1 }, - { "max_user_connections", (long*) &max_user_connections, - 0, 1, ~0L, 0, 1 }, - { "max_write_lock_count", (long*) &max_write_lock_count, - ~0L, 1, ~0L, 0, 1 }, - { "myisam_bulk_insert_tree_size", (long*) &myisam_bulk_insert_tree_size, - 8192*1024, 0, ~0L, 0, 1 }, - { "myisam_block_size", (long*) &opt_myisam_block_size, - MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, - 0, MI_MIN_KEY_BLOCK_LENGTH }, - { "myisam_max_extra_sort_file_size", - (long*) &myisam_max_extra_sort_file_size, - (long) (MI_MAX_TEMP_LENGTH/(1024L*1024L)), 0, ~0L, 0, 1 }, - { "myisam_max_sort_file_size", (long*) &myisam_max_sort_file_size, - (long) (LONG_MAX/(1024L*1024L)), 0, ~0L, 0, 1 }, - { "myisam_sort_buffer_size", (long*) &myisam_sort_buffer_size, - 8192*1024, 4, ~0L, 0, 1 }, - { "net_buffer_length", (long*) &net_buffer_length, - 16384, 1024, 1024*1024L, MALLOC_OVERHEAD, 1024 }, - { "net_retry_count", (long*) &mysqld_net_retry_count, - MYSQLD_NET_RETRY_COUNT, 1, ~0L, 0, 1 }, - { "net_read_timeout", (long*) &net_read_timeout, - NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 }, - { "net_write_timeout", (long*) &net_write_timeout, - NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 }, - { "open_files_limit", (long*) &open_files_limit, - 0, 0, 65535, 0, 1}, - { "query_buffer_size", (long*) &query_buff_size, - 0, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE }, + {"innodb_mirrored_log_groups", OPT_INNODB_MIRRORED_LOG_GROUPS, + "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.", + (gptr*) &innobase_mirrored_log_groups, + (gptr*) &innobase_mirrored_log_groups, 0, GET_LONG, REQUIRED_ARG, 1, 1, 10, + 0, 1, 0}, + {"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP, + "Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.", + (gptr*) &innobase_log_files_in_group, (gptr*) &innobase_log_files_in_group, + 0, GET_LONG, REQUIRED_ARG, 2, 2, 100, 0, 1, 0}, + {"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE, + "Size of each log file in a log group in megabytes.", + (gptr*) &innobase_log_file_size, (gptr*) &innobase_log_file_size, 0, + GET_LONG, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, ~0L, 0, 1024*1024L, 0}, + {"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE, + "The size of the buffer which InnoDB uses to write log to the log files on disk.", + (gptr*) &innobase_log_buffer_size, (gptr*) &innobase_log_buffer_size, 0, + GET_LONG, REQUIRED_ARG, 1024*1024L, 256*1024L, ~0L, 0, 1024, 0}, + {"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE, + "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", + (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0, + GET_LONG, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, ~0L, 0, 1024*1024L, 0}, + {"innodb_additional_mem_pool_size", OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE, + "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.", + (gptr*) &innobase_additional_mem_pool_size, + (gptr*) &innobase_additional_mem_pool_size, 0, GET_LONG, REQUIRED_ARG, + 1*1024*1024L, 512*1024L, ~0L, 0, 1024, 0}, + {"innodb_file_io_threads", OPT_INNODB_FILE_IO_THREADS, + "Number of file I/O threads in InnoDB.", (gptr*) &innobase_file_io_threads, + (gptr*) &innobase_file_io_threads, 0, GET_LONG, REQUIRED_ARG, 4, 4, 64, 0, + 1, 0}, + {"innodb_lock_wait_timeout", OPT_INNODB_LOCK_WAIT_TIMEOUT, + "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back.", + (gptr*) &innobase_lock_wait_timeout, (gptr*) &innobase_lock_wait_timeout, + 0, GET_LONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0}, + {"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY, + "Helps in performance tuning in heavily concurrent environments.", + (gptr*) &innobase_thread_concurrency, (gptr*) &innobase_thread_concurrency, + 0, GET_LONG, REQUIRED_ARG, 8, 1, 1000, 0, 1, 0}, + {"innodb_force_recovery", OPT_INNODB_FORCE_RECOVERY, + "Helps to save your data in case the disk image of the database becomes corrupt.", + (gptr*) &innobase_force_recovery, (gptr*) &innobase_force_recovery, 0, + GET_LONG, REQUIRED_ARG, 0, 0, 6, 0, 1, 0}, +#endif /* HAVE_INNOBASE_DB */ + {"interactive_timeout", OPT_INTERACTIVE_TIMEOUT, + "The number of seconds the server waits for activity on an interactive connection before closing it.", + (gptr*) &net_interactive_timeout, (gptr*) &net_interactive_timeout, 0, + GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, + {"join_buffer_size", OPT_JOIN_BUFF_SIZE, + "The size of the buffer that is used for full joins.", + (gptr*) &join_buff_size, (gptr*) &join_buff_size, 0, GET_ULONG, + REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, + IO_SIZE, 0}, + {"key_buffer_size", OPT_KEY_BUFFER_SIZE, + "The size of the buffer used for index blocks. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.", + (gptr*) &keybuff_size, (gptr*) &keybuff_size, 0, GET_ULONG, REQUIRED_ARG, + KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE, 0}, + {"long_query_time", OPT_LONG_QUERY_TIME, + "Log all queries that have taken more than long_query_time seconds to execute to file.", + (gptr*) &long_query_time, (gptr*) &long_query_time, 0, GET_ULONG, + REQUIRED_ARG, 10, 1, LONG_TIMEOUT, 0, 1, 0}, + {"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES, + "If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive.", + (gptr*) &lower_case_table_names, (gptr*) &lower_case_table_names, 0, + GET_ULONG, REQUIRED_ARG, IF_WIN(1,0), 0, 1, 0, 1, 0}, + {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, + "Max packetlength to send/receive from to server.", + (gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0, GET_ULONG, + REQUIRED_ARG, 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024, 0}, + {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE, + "Can be used to restrict the total size used to cache a multi-transaction query.", + (gptr*) &max_binlog_cache_size, (gptr*) &max_binlog_cache_size, 0, + GET_ULONG, REQUIRED_ARG, ~0L, IO_SIZE, ~0L, 0, IO_SIZE, 0}, + {"max_binlog_size", OPT_MAX_BINLOG_SIZE, + "Binary log will be rotated automatically when the size crosses the limit.", + (gptr*) &max_binlog_size, (gptr*) &max_binlog_size, 0, GET_ULONG, + REQUIRED_ARG, 1024*1024L*1024L, 1024, 1024*1024L*1024L, 0, 1, 0}, + {"max_connections", OPT_MAX_CONNECTIONS, + "The number of simultaneous clients allowed.", (gptr*) &max_connections, + (gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 100, 1, 16384, 0, 1, + 0}, + {"max_connect_errors", OPT_MAX_CONNECT_ERRORS, + "If there is more than this number of interrupted connections from a host this host will be blocked from further connections.", + (gptr*) &max_connect_errors, (gptr*) &max_connect_errors, 0, GET_ULONG, + REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ~0L, 0, 1, 0}, + {"max_delayed_threads", OPT_MAX_DELAYED_THREADS, + "Don't start more than this number of threads to handle INSERT DELAYED statements.", + (gptr*) &max_insert_delayed_threads, (gptr*) &max_insert_delayed_threads, + 0, GET_ULONG, REQUIRED_ARG, 20, 1, 16384, 0, 1, 0}, + {"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE, + "Don't allow creation of heap tables bigger than this.", + (gptr*) &max_heap_table_size, (gptr*) &max_heap_table_size, 0, GET_ULONG, + REQUIRED_ARG, 16*1024*1024L, 16384, ~0L, MALLOC_OVERHEAD, 1024, 0}, + {"max_join_size", OPT_MAX_JOIN_SIZE, + "Joins that are probably going to read more than max_join_size records return an error.", + (gptr*) &max_join_size, (gptr*) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, + ~0L, 1, ~0L, 0, 1, 0}, + {"max_sort_length", OPT_MAX_SORT_LENGTH, + "The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).", + (gptr*) &max_item_sort_length, (gptr*) &max_item_sort_length, 0, GET_ULONG, + REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, + {"max_tmp_tables", OPT_MAX_TMP_TABLES, + "Maximum number of temporary tables a client can keep open at a time.", + (gptr*) &max_tmp_tables, (gptr*) &max_tmp_tables, 0, GET_ULONG, + REQUIRED_ARG, 32, 1, ~0L, 0, 1, 0}, + {"max_user_connections", OPT_MAX_USER_CONNECTIONS, + "The maximum number of active connections for a single user (0 = no limit).", + (gptr*) &max_user_connections, (gptr*) &max_user_connections, 0, GET_ULONG, + REQUIRED_ARG, 0, 1, ~0L, 0, 1, 0}, + {"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT, + "After this many write locks, allow some read locks to run in between.", + (gptr*) &max_write_lock_count, (gptr*) &max_write_lock_count, 0, GET_ULONG, + REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0}, + {"myisam_bulk_insert_tree_size", OPT_MYISAM_BULK_INSERT_TREE_SIZE, + "Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!", + (gptr*) &myisam_bulk_insert_tree_size, + (gptr*) &myisam_bulk_insert_tree_size, 0, GET_ULONG, REQUIRED_ARG, + 8192*1024, 0, ~0L, 0, 1, 0}, + {"myisam_block_size", OPT_MYISAM_BLOCK_SIZE, + "Undocumented", (gptr*) &opt_myisam_block_size, + (gptr*) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG, + MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, + 0, MI_MIN_KEY_BLOCK_LENGTH, 0}, + {"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, + "Used to help MySQL to decide when to use the slow but safe key cache index create method. Note that this parameter is given in megabytes!", + (gptr*) &myisam_max_extra_sort_file_size, + (gptr*) &myisam_max_extra_sort_file_size, 0, GET_ULONG, REQUIRED_ARG, + (long) (MI_MAX_TEMP_LENGTH/(1024L*1024L)), 0, ~0L, 0, 1, 0}, + {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE, + "Don't use the fast sort index method to created index if the temporary file would get bigger than this. Note that this paramter is given in megabytes!", + (gptr*) &myisam_max_sort_file_size, (gptr*) &myisam_max_sort_file_size, 0, + GET_ULONG, REQUIRED_ARG, (long) (LONG_MAX/(1024L*1024L)), 0, ~0L, 0, 1, 0}, + {"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE, + "The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.", + (gptr*) &myisam_sort_buffer_size, (gptr*) &myisam_sort_buffer_size, 0, + GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0}, + {"net_buffer_length", OPT_NET_BUFFER_LENGTH, + "Buffer for TCP/IP and socket communication.", (gptr*) &net_buffer_length, + (gptr*) &net_buffer_length, 0, GET_ULONG, REQUIRED_ARG, 16384, 1024, + 1024*1024L, MALLOC_OVERHEAD, 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, + 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.", + (gptr*) &net_read_timeout, (gptr*) &net_read_timeout, 0, GET_ULONG, + REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, + {"net_write_timeout", OPT_NET_WRITE_TIMEOUT, + "Number of seconds to wait for a block to be written to a connection before aborting the write.", + (gptr*) &net_write_timeout, (gptr*) &net_write_timeout, 0, GET_ULONG, + REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, + {"open_files_limit", OPT_OPEN_FILES_LIMIT, + "If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files.", + (gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG, + REQUIRED_ARG, 0, 0, 65535, 0, 1, 0}, + {"query_buffer_size", OPT_QUERY_BUFFER_SIZE, + "The initial allocation of the query buffer.", (gptr*) &query_buff_size, + (gptr*) &query_buff_size, 0, GET_ULONG, REQUIRED_ARG, 0, MALLOC_OVERHEAD, + (long) ~0, MALLOC_OVERHEAD, IO_SIZE, 0}, #ifdef HAVE_QUERY_CACHE - { "query_cache_limit", (long*) &query_cache_limit, - 1024*1024L, 0, ULONG_MAX, 0, 1}, + {"query_cache_limit", OPT_QUERY_CACHE_LIMIT, + "Don't cache results that are bigger than this.", + (gptr*) &query_cache_limit, (gptr*) &query_cache_limit, 0, GET_ULONG, + REQUIRED_ARG, 1024*1024L, 0, ULONG_MAX, 0, 1, 0}, #endif /*HAVE_QUERY_CACHE*/ - { "query_cache_size", (long*) &query_cache_size, - 0, 0, ULONG_MAX, 0, 1}, + {"query_cache_size", OPT_QUERY_CACHE_SIZE, + "The memory allocated to store results from old queries.", + (gptr*) &query_cache_size, (gptr*) &query_cache_size, 0, GET_ULONG, + REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0}, #ifdef HAVE_QUERY_CACHE - { "query_cache_startup_type",(long*) &query_cache_startup_type, - 1, 0, 2, 0, 1}, + {"query_cache_startup_type", OPT_QUERY_CACHE_STARTUP_TYPE, + "0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.", + (gptr*) &query_cache_startup_type, (gptr*) &query_cache_startup_type, 0, + GET_ULONG, REQUIRED_ARG, 1, 0, 2, 0, 1, 0}, #endif /*HAVE_QUERY_CACHE*/ - { "record_buffer", (long*) &my_default_record_cache_size, - 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE }, - { "record_rnd_buffer", (long*) &record_rnd_cache_size, - 0, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE }, - { "relay_log_space_limit", (long*) &relay_log_space_limit, 0L, 0L,ULONG_MAX, - 0, 1}, - { "slave_net_timeout", (long*) &slave_net_timeout, - SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 }, - { "slow_launch_time", (long*) &slow_launch_time, - 2L, 0L, LONG_TIMEOUT, 0, 1 }, - { "sort_buffer", (long*) &sortbuff_size, - MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0L, MALLOC_OVERHEAD, 1 }, - { "table_cache", (long*) &table_cache_size, - 64, 1, 16384, 0, 1 }, - { "thread_concurrency", (long*) &concurrency, - DEFAULT_CONCURRENCY, 1, 512, 0, 1 }, - { "thread_cache_size", (long*) &thread_cache_size, - 0, 0, 16384, 0, 1 }, - { "tmp_table_size", (long*) &tmp_table_size, - 32*1024*1024L, 1024, ~0L, 0, 1 }, - { "thread_stack", (long*) &thread_stack, - DEFAULT_THREAD_STACK, 1024*32, ~0L, 0, 1024 }, - { "wait_timeout", (long*) &net_wait_timeout, - NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 }, - { NullS, (long*) 0, 0, 0, 0, 0, 0} + {"record_buffer", OPT_RECORD_BUFFER, + "Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.", + (gptr*) &my_default_record_cache_size, + (gptr*) &my_default_record_cache_size, 0, GET_ULONG, REQUIRED_ARG, + 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, + {"record_rnd_buffer", OPT_RECORD_RND_BUFFER, + "When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks. If not set, then it's set to the value of record_buffer.", + (gptr*) &record_rnd_cache_size, (gptr*) &record_rnd_cache_size, 0, + GET_ULONG, REQUIRED_ARG, 0, IO_SIZE*2+MALLOC_OVERHEAD, + ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, + {"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT, + "Undocumented", (gptr*) &relay_log_space_limit, + (gptr*) &relay_log_space_limit, 0, GET_ULONG, REQUIRED_ARG, 0L, 0L, + ULONG_MAX, 0, 1, 0}, + {"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT, + "Undocumented", (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0, + GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, + {"slow_launch_time", OPT_SLOW_LAUNCH_TIME, + "If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.", + (gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG, + REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0}, + {"sort_buffer", OPT_SORT_BUFFER, + "Each thread that needs to do a sort allocates a buffer of this size.", + (gptr*) &sortbuff_size, (gptr*) &sortbuff_size, 0, GET_ULONG, REQUIRED_ARG, + MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0L, MALLOC_OVERHEAD, + 1, 0}, + {"table_cache", OPT_TABLE_CACHE, + "The number of open tables for all threads.", (gptr*) &table_cache_size, + (gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, 16384, 0, 1, + 0}, + {"thread_concurrency", OPT_THREAD_CONCURRENCY, + "Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.", + (gptr*) &concurrency, (gptr*) &concurrency, 0, GET_ULONG, REQUIRED_ARG, + DEFAULT_CONCURRENCY, 1, 512, 0, 1, 0}, + {"thread_cache_size", OPT_THREAD_CACHE_SIZE, + "How many threads we should keep in a cache for reuse.", + (gptr*) &thread_cache_size, (gptr*) &thread_cache_size, 0, GET_ULONG, + REQUIRED_ARG, 0, 0, 16384, 0, 1, 0}, + {"tmp_table_size", OPT_TMP_TABLE_SIZE, + "If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.", + (gptr*) &tmp_table_size, (gptr*) &tmp_table_size, 0, GET_ULONG, + REQUIRED_ARG, 32*1024*1024L, 1024, ~0L, 0, 1, 0}, + {"thread_stack", OPT_THREAD_STACK, + "The stack size for each thread.", (gptr*) &thread_stack, + (gptr*) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK, + 1024*32, ~0L, 0, 1024, 0}, + {"wait_timeout", OPT_WAIT_TIMEOUT, + "The number of seconds the server waits for activity on a connection before closing it", + (gptr*) &net_wait_timeout, (gptr*) &net_wait_timeout, 0, GET_ULONG, + REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; - struct show_var_st init_vars[]= { {"back_log", (char*) &back_log, SHOW_LONG}, {"basedir", mysql_home, SHOW_CHAR}, @@ -3417,167 +3823,22 @@ and you are welcome to modify and redistribute it under the GPL license\n\ Starts the MySQL server\n"); printf("Usage: %s [OPTIONS]\n", my_progname); - puts("\n\ - --ansi Use ANSI SQL syntax instead of MySQL syntax\n\ - -b, --basedir=path Path to installation directory. All paths are\n\ - usually resolved relative to this\n\ - --big-tables Allow big result sets by saving all temporary sets\n\ - on file (Solves most 'table full' errors)\n\ - --bind-address=IP Ip address to bind to\n\ - --bootstrap Used by mysql installation scripts\n\ - --character-sets-dir=...\n\ - Directory where character sets are\n\ - --chroot=path Chroot mysqld daemon during startup\n\ - --core-file Write core on errors\n\ - -h, --datadir=path Path to the database root"); -#ifndef DBUG_OFF - printf("\ - -#, --debug[=...] Debug log. Default is '%s'\n",default_dbug_option); -#ifdef SAFEMALLOC - puts("\ - --skip-safemalloc Don't use the memory allocation checking"); -#endif -#endif - puts("\ - --default-character-set=charset\n\ - Set the default character set\n\ - --default-table-type=type\n\ - Set the default table type for tables\n\ - --delay-key-write-for-all-tables\n\ - Don't flush key buffers between writes for any MyISAM\n\ - table\n"); -#ifdef HAVE_OPENSSL - puts("\ - --des-key-file Load keys for des_encrypt() and des_encrypt\n\ - from given file"); -#endif /* HAVE_OPENSSL */ - puts("\ - --enable-locking Enable system locking\n\ - --enable-pstack Print a symbolic stack trace on failure\n\ - -T, --exit-info Used for debugging; Use at your own risk!\n\ - --flush Flush tables to disk between SQL commands\n\ - -?, --help Display this help and exit\n\ - --init-file=file Read SQL commands from this file at startup\n\ - -L, --language=... Client error messages in given language. May be\n\ - given as a full path\n\ - --local-infile=[1|0] Enable/disable LOAD DATA LOCAL INFILE\n\ - -l, --log[=file] Log connections and queries to file\n\ - --log-bin[=file] Log queries in new binary format (for replication)\n\ - --log-bin-index=file File that holds the names for last binary log files\n\ - --log-update[=file] Log updates to file.# where # is a unique number\n\ - if not given.\n\ - --log-isam[=file] Log all MyISAM changes to file\n\ - --log-long-format Log some extra information to update log\n\ - --low-priority-updates INSERT/DELETE/UPDATE has lower priority than selects\n\ - --log-slow-queries=[file]\n\ - Log slow queries to this log file. Defaults logging\n\ - to hostname-slow.log\n\ - --pid-file=path Pid file used by safe_mysqld\n\ - --myisam-recover[=option[,option...]] where options is one of DEAULT,\n\ - BACKUP or FORCE.\n\ - --memlock Lock mysqld in memory\n\ - -n, --new Use very new possible 'unsafe' functions\n\ - -o, --old-protocol Use the old (3.20) protocol\n\ - -P, --port=... Port number to use for connection\n"); -#ifdef ONE_THREAD - puts("\ - --one-thread Only use one thread (for debugging under Linux)\n"); -#endif - puts("\ - -O, --set-variable var=option\n\ - Give a variable an value. --help lists variables\n\ - --safe-mode Skip some optimize stages (for testing)\n\ - --safe-show-database Don't show databases for which the user has no\n\ - privileges\n\ - --safe-user-create Don't allow new user creation by the user who has\n\ - no write privileges to the mysql.user table\n\ - --skip-concurrent-insert\n\ - Don't use concurrent insert with MyISAM\n\ - --skip-delay-key-write\n\ - Ignore the delay_key_write option for all tables\n\ - --skip-grant-tables Start without grant tables. This gives all users\n\ - FULL ACCESS to all tables!\n\ - --skip-host-cache Don't cache host names\n\ - --skip-locking Don't use system locking. To use isamchk one has\n\ - to shut down the server.\n\ - --skip-name-resolve Don't resolve hostnames.\n\ - All hostnames are IP's or 'localhost'\n\ - --skip-networking Don't allow connection with TCP/IP.\n\ - --skip-new Don't use new, possible wrong routines.\n"); - /* We have to break the string here because of VC++ limits */ - puts("\ - --skip-stack-trace Don't print a stack trace on failure\n\ - --skip-symlink Don't allow symlinking of tables\n\ - --skip-show-database Don't allow 'SHOW DATABASE' commands\n\ - --skip-thread-priority\n\ - Don't give threads different priorities.\n\ - --socket=... Socket file to use for connection\n\ - -t, --tmpdir=path Path for temporary files\n\ - --sql-mode=option[,option[,option...]] where option can be one of:\n\ - REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES,\n\ - IGNORE_SPACE, SERIALIZE, ONLY_FULL_GROUP_BY,\n\ - NO_UNSIGNED_SUBTRACTION.\n\ - --transaction-isolation\n\ - Default transaction isolation level\n\ - --temp-pool Use a pool of temporary files\n\ - -u, --user=user_name Run mysqld daemon as user\n\ - -V, --version output version information and exit\n\ - -W, --warnings Log some not critical warnings to the log file\n"); #ifdef __WIN__ puts("NT and Win32 specific options:\n\ - --console Don't remove the console window\n\ --install Install the default service (NT)\n\ --install-manual Install the default service started manually (NT)\n\ --remove Remove the default service from the service list (NT)\n\ - --enable-named-pipe Enable the named pipe (NT)\n\ - --standalone Dummy option to start as a standalone program (NT)\ "); -#ifdef USE_SYMDIR - puts("--use-symbolic-links Enable symbolic link support"); -#endif puts(""); #endif -#ifdef HAVE_BERKELEY_DB - puts("\ - --bdb-home= directory Berkeley home direcory\n\ - --bdb-lock-detect=# Berkeley lock detect\n\ - (DEFAULT, OLDEST, RANDOM or YOUNGEST, # sec)\n\ - --bdb-logdir=directory Berkeley DB log file directory\n\ - --bdb-no-sync Don't synchronously flush logs\n\ - --bdb-no-recover Don't try to recover Berkeley DB tables on start\n\ - --bdb-shared-data Start Berkeley DB in multi-process mode\n\ - --bdb-tmpdir=directory Berkeley DB tempfile name\n\ - --skip-bdb Don't use berkeley db (will save memory)\n\ -"); -#endif /* HAVE_BERKELEY_DB */ -#ifdef HAVE_INNOBASE_DB - puts("\ - --innodb_data_home_dir=dir The common part for Innodb table spaces\n\ - --innodb_data_file_path=dir Path to individual files and their sizes\n\ - --innodb_flush_method=# With which method to flush data\n\ - --innodb_flush_log_at_trx_commit[=#]\n\ - Set to 0 if you don't want to flush logs\n\ - --innodb_log_arch_dir=dir Where full logs should be archived\n\ - --innodb_log_archive[=#] Set to 1 if you want to have logs archived\n\ - --innodb_log_group_home_dir=dir Path to innodb log files.\n\ - --skip-innodb Don't use Innodb (will save memory)\n\ -"); -#endif /* HAVE_INNOBASE_DB */ print_defaults("my",load_default_groups); puts(""); - -#ifdef HAVE_OPENSSL - puts("\ - --ssl Use SSL for connection (automatically set with other flags\n\ - --ssl-key X509 key in PEM format (implies --ssl)\n\ - --ssl-cert X509 cert in PEM format (implies --ssl)\n\ - --ssl-ca CA file in PEM format (check OpenSSL docs, implies --ssl)\n\ - --ssl-capath CA directory (check OpenSSL docs, implies --ssl)\n\ - --ssl-cipher SSL cipher to use (implies --ssl)"); -#endif - fix_paths(); set_ports(); + + my_print_help(my_long_options); + my_print_variables(my_long_options); + printf("\ To see what values a running MySQL server is using, type\n\ 'mysqladmin variables' instead of 'mysqld --help'.\n\ @@ -3610,17 +3871,11 @@ The default values (after parsing the command line arguments) are:\n\n"); puts("\nsystem locking is not in use"); if (opt_noacl) puts("\nGrant tables are not used. All users have full access rights"); - printf("\nPossible variables for option --set-variable (-O) are:\n"); - for (uint i=0 ; changeable_vars[i].name ; i++) - printf("%-20s current value: %lu\n", - changeable_vars[i].name, - (ulong) *changeable_vars[i].varptr); } static void set_options(void) { - set_all_changeable_vars( changeable_vars ); #if !defined( my_pthread_setprio ) && !defined( HAVE_PTHREAD_SETSCHEDPARAM ) opt_specialflag |= SPECIAL_NO_PRIOR; #endif @@ -3650,632 +3905,524 @@ static void set_options(void) my_bind_addr = htonl( INADDR_ANY ); } - /* Initiates DEBUG - but no debugging here ! */ -static void get_options(int argc,char **argv) +static my_bool +get_one_option(int optid, const struct my_option *opt __attribute__((unused)), + char *argument) { - int c,option_index=0; - - myisam_delay_key_write=1; // Allow use of this -#ifndef HAVE_purify - my_use_symdir=1; // Use internal symbolic links -#else - /* Symlinks gives too many warnings with purify */ - my_disable_symlinks=1; - my_use_symdir=0; - have_symlink=SHOW_OPTION_DISABLED; -#endif - - optind = 0; // setup in case getopt() was called previously - while ((c=getopt_long(argc,argv,"ab:C:h:#::T::?l::L:O:P:sS::t:u:noVvWI?", - long_options, &option_index)) != EOF) - { - switch(c) { - case '#': + switch(optid) { + case '#': #ifndef DBUG_OFF - DBUG_PUSH(optarg ? optarg : default_dbug_option); -#endif - opt_endinfo=1; /* unireg: memory allocation */ - break; - case 'W': - opt_warnings=1; - break; - case 'a': - opt_sql_mode = (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT | - MODE_ANSI_QUOTES | MODE_IGNORE_SPACE | MODE_SERIALIZABLE - | MODE_ONLY_FULL_GROUP_BY); - default_tx_isolation= ISO_SERIALIZABLE; - break; - case 'b': - strmake(mysql_home,optarg,sizeof(mysql_home)-1); - break; - case 'l': - opt_log=1; - opt_logname=optarg; // Use hostname.log if null - break; - case 'h': - strmake(mysql_real_data_home,optarg, sizeof(mysql_real_data_home)-1); - break; - case 'L': - strmake(language, optarg, sizeof(language)-1); - break; - case 'n': - opt_specialflag|= SPECIAL_NEW_FUNC; - break; - case 'o': - protocol_version=PROTOCOL_VERSION-1; - break; - case 'O': - if (set_changeable_var(optarg, changeable_vars)) - { - use_help(); - exit(1); - } - break; - case 'P': - mysql_port= (unsigned int) atoi(optarg); - break; - case OPT_LOCAL_INFILE: - opt_local_infile= test(!optarg || atoi(optarg) != 0); - break; - case OPT_SLAVE_SKIP_ERRORS: - init_slave_skip_errors(optarg); - break; - case OPT_SAFEMALLOC_MEM_LIMIT: + DBUG_PUSH(argument ? argument : default_dbug_option); +#endif + opt_endinfo=1; /* unireg: memory allocation */ + break; + case 'a': + opt_sql_mode = (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT | + MODE_ANSI_QUOTES | MODE_IGNORE_SPACE | MODE_SERIALIZABLE + | MODE_ONLY_FULL_GROUP_BY); + default_tx_isolation= ISO_SERIALIZABLE; + break; + case 'b': + strmake(mysql_home,argument,sizeof(mysql_home)-1); + break; + case 'l': + opt_log=1; + opt_logname=argument; // Use hostname.log if null + break; + case 'h': + strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1); + break; + case 'L': + strmake(language, argument, sizeof(language)-1); + break; + case 'n': + opt_specialflag|= SPECIAL_NEW_FUNC; + break; + case 'o': + protocol_version=PROTOCOL_VERSION-1; + break; + case 'P': + mysql_port= (unsigned int) atoi(argument); + break; + case OPT_LOCAL_INFILE: + opt_local_infile= test(!argument || atoi(argument) != 0); + break; + case OPT_SLAVE_SKIP_ERRORS: + init_slave_skip_errors(argument); + break; + case OPT_SAFEMALLOC_MEM_LIMIT: #if !defined(DBUG_OFF) && defined(SAFEMALLOC) - safemalloc_mem_limit = atoi(optarg); + safemalloc_mem_limit = atoi(argument); #endif - break; - case OPT_RPL_RECOVERY_RANK: - rpl_recovery_rank=atoi(optarg); - break; - case OPT_SLAVE_LOAD_TMPDIR: - slave_load_tmpdir = my_strdup(optarg, MYF(MY_FAE)); - break; - case OPT_OLD_RPL_COMPAT: - opt_old_rpl_compat = 1; - break; - case OPT_SHOW_SLAVE_AUTH_INFO: - opt_show_slave_auth_info = 1; - break; - case OPT_SOCKET: - mysql_unix_port= optarg; - break; - case 'r': - mysqld_chroot=optarg; - break; -#ifdef USE_SYMDIR - case 's': - my_use_symdir=1; /* Use internal symbolic links */ - break; -#endif - case 't': - mysql_tmpdir=optarg; - break; - case OPT_TEMP_POOL: - use_temp_pool=1; - break; - case 'u': - mysqld_user=optarg; - break; - case 'v': - case 'V': - print_version(); - exit(0); - case 'I': - case '?': - usage(); - exit(0); - case 'T': - test_flags= optarg ? (uint) atoi(optarg) : 0; - opt_endinfo=1; - break; - case (int) OPT_BIG_TABLES: - thd_startup_options|=OPTION_BIG_TABLES; - break; - case (int) OPT_ISAM_LOG: - opt_myisam_log=1; - if (optarg) - myisam_log_filename=optarg; - break; - case (int) OPT_UPDATE_LOG: - opt_update_log=1; - opt_update_logname=optarg; // Use hostname.# if null - break; - case (int) OPT_RELAY_LOG_INDEX: - opt_relaylog_index_name = optarg; - break; - case (int) OPT_RELAY_LOG: - x_free(opt_relay_logname); - if (optarg && optarg[0]) - opt_relay_logname=my_strdup(optarg,MYF(0)); - break; - case (int) OPT_BIN_LOG_INDEX: - opt_binlog_index_name = optarg; - break; - case (int) OPT_BIN_LOG: - opt_bin_log=1; - x_free(opt_bin_logname); - if (optarg && optarg[0]) - opt_bin_logname=my_strdup(optarg,MYF(0)); - break; - // needs to be handled (as no-op) in non-debugging mode for test suite - case (int)OPT_DISCONNECT_SLAVE_EVENT_COUNT: + break; + case OPT_RPL_RECOVERY_RANK: + rpl_recovery_rank=atoi(argument); + break; + case OPT_SLAVE_LOAD_TMPDIR: + slave_load_tmpdir = my_strdup(argument, MYF(MY_FAE)); + break; + case OPT_SOCKET: + mysql_unix_port= argument; + break; + case 'r': + mysqld_chroot=argument; + break; + case 't': + mysql_tmpdir=argument; + break; + case 'u': + mysqld_user=argument; + break; + case 'v': + case 'V': + print_version(); + exit(0); + case 'I': + case '?': + usage(); + exit(0); + case 'T': + test_flags= argument ? (uint) atoi(argument) : 0; + opt_endinfo=1; + break; + case (int) OPT_BIG_TABLES: + thd_startup_options|=OPTION_BIG_TABLES; + break; + case (int) OPT_ISAM_LOG: + opt_myisam_log=1; + if (argument) + myisam_log_filename=argument; + break; + case (int) OPT_UPDATE_LOG: + opt_update_log=1; + opt_update_logname=argument; // Use hostname.# if null + break; + case (int) OPT_RELAY_LOG_INDEX: + opt_relaylog_index_name = argument; + break; + case (int) OPT_RELAY_LOG: + x_free(opt_relay_logname); + if (argument && argument[0]) + opt_relay_logname=my_strdup(argument,MYF(0)); + break; + case (int) OPT_BIN_LOG_INDEX: + opt_binlog_index_name = argument; + break; + case (int) OPT_BIN_LOG: + opt_bin_log=1; + x_free(opt_bin_logname); + if (argument && argument[0]) + opt_bin_logname=my_strdup(argument,MYF(0)); + break; + // needs to be handled (as no-op) in non-debugging mode for test suite + case (int)OPT_DISCONNECT_SLAVE_EVENT_COUNT: #ifndef DBUG_OFF - disconnect_slave_event_count = atoi(optarg); + disconnect_slave_event_count = atoi(argument); #endif - break; - case (int)OPT_ABORT_SLAVE_EVENT_COUNT: + break; + case (int)OPT_ABORT_SLAVE_EVENT_COUNT: #ifndef DBUG_OFF - abort_slave_event_count = atoi(optarg); + abort_slave_event_count = atoi(argument); #endif - break; - case (int)OPT_SPORADIC_BINLOG_DUMP_FAIL: -#ifndef DBUG_OFF - opt_sporadic_binlog_dump_fail = 1; -#endif - break; - case (int)OPT_MAX_BINLOG_DUMP_EVENTS: + break; + case (int) OPT_MAX_BINLOG_DUMP_EVENTS: #ifndef DBUG_OFF - max_binlog_dump_events = atoi(optarg); + max_binlog_dump_events = atoi(argument); #endif - break; - - case (int) OPT_LOG_SLAVE_UPDATES: - opt_log_slave_updates = 1; - break; - - case (int) OPT_INIT_RPL_ROLE: + break; + case (int) OPT_INIT_RPL_ROLE: { int role; - if ((role=find_type(optarg, &rpl_role_typelib, 2)) <= 0) + if ((role=find_type(argument, &rpl_role_typelib, 2)) <= 0) { - fprintf(stderr, "Unknown replication role: %s\n", optarg); + fprintf(stderr, "Unknown replication role: %s\n", argument); exit(1); } rpl_status = (role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE; break; } - case (int)OPT_REPLICATE_IGNORE_DB: + case (int)OPT_REPLICATE_IGNORE_DB: + { + i_string *db = new i_string(argument); + replicate_ignore_db.push_back(db); + break; + } + case (int)OPT_REPLICATE_DO_DB: + { + i_string *db = new i_string(argument); + replicate_do_db.push_back(db); + break; + } + case (int)OPT_REPLICATE_REWRITE_DB: + { + char* key = argument,*p, *val; + p = strstr(argument, "->"); + if (!p) { - i_string *db = new i_string(optarg); - replicate_ignore_db.push_back(db); - break; + fprintf(stderr, + "Bad syntax in replicate-rewrite-db - missing '->'!\n"); + exit(1); } - case (int)OPT_REPLICATE_DO_DB: + val = p--; + while(isspace(*p) && p > argument) *p-- = 0; + if(p == argument) { - i_string *db = new i_string(optarg); - replicate_do_db.push_back(db); - break; + fprintf(stderr, + "Bad syntax in replicate-rewrite-db - empty FROM db!\n"); + exit(1); } - case (int)OPT_REPLICATE_REWRITE_DB: + *val = 0; + val += 2; + while(*val && isspace(*val)) *val++; + if (!*val) { - char* key = optarg,*p, *val; - p = strstr(optarg, "->"); - if (!p) - { - fprintf(stderr, - "Bad syntax in replicate-rewrite-db - missing '->'!\n"); - exit(1); - } - val = p--; - while(isspace(*p) && p > optarg) *p-- = 0; - if(p == optarg) - { - fprintf(stderr, - "Bad syntax in replicate-rewrite-db - empty FROM db!\n"); - exit(1); - } - *val = 0; - val += 2; - while(*val && isspace(*val)) *val++; - if (!*val) - { - fprintf(stderr, - "Bad syntax in replicate-rewrite-db - empty TO db!\n"); - exit(1); - } - - i_string_pair* db_pair = new i_string_pair(key, val); - replicate_rewrite_db.push_back(db_pair); - break; + fprintf(stderr, + "Bad syntax in replicate-rewrite-db - empty TO db!\n"); + exit(1); } - case (int)OPT_BINLOG_IGNORE_DB: - { - i_string *db = new i_string(optarg); - binlog_ignore_db.push_back(db); - break; - } - case (int)OPT_BINLOG_DO_DB: - { - i_string *db = new i_string(optarg); - binlog_do_db.push_back(db); - break; - } - case (int)OPT_REPLICATE_DO_TABLE: + i_string_pair* db_pair = new i_string_pair(key, val); + replicate_rewrite_db.push_back(db_pair); + break; + } + + case (int)OPT_BINLOG_IGNORE_DB: + { + i_string *db = new i_string(argument); + binlog_ignore_db.push_back(db); + break; + } + case (int)OPT_BINLOG_DO_DB: + { + i_string *db = new i_string(argument); + binlog_do_db.push_back(db); + break; + } + case (int)OPT_REPLICATE_DO_TABLE: + { + if (!do_table_inited) + init_table_rule_hash(&replicate_do_table, &do_table_inited); + if(add_table_rule(&replicate_do_table, argument)) { - if (!do_table_inited) - init_table_rule_hash(&replicate_do_table, &do_table_inited); - if(add_table_rule(&replicate_do_table, optarg)) - { - fprintf(stderr, "Could not add do table rule '%s'!\n", optarg); - exit(1); - } - table_rules_on = 1; - break; + fprintf(stderr, "Could not add do table rule '%s'!\n", argument); + exit(1); } - case (int)OPT_REPLICATE_WILD_DO_TABLE: + table_rules_on = 1; + break; + } + case (int)OPT_REPLICATE_WILD_DO_TABLE: + { + if (!wild_do_table_inited) + init_table_rule_array(&replicate_wild_do_table, + &wild_do_table_inited); + if(add_wild_table_rule(&replicate_wild_do_table, argument)) { - if (!wild_do_table_inited) - init_table_rule_array(&replicate_wild_do_table, - &wild_do_table_inited); - if(add_wild_table_rule(&replicate_wild_do_table, optarg)) - { - fprintf(stderr, "Could not add do table rule '%s'!\n", optarg); - exit(1); - } - table_rules_on = 1; - break; + fprintf(stderr, "Could not add do table rule '%s'!\n", argument); + exit(1); } - case (int)OPT_REPLICATE_WILD_IGNORE_TABLE: + table_rules_on = 1; + break; + } + case (int)OPT_REPLICATE_WILD_IGNORE_TABLE: + { + if (!wild_ignore_table_inited) + init_table_rule_array(&replicate_wild_ignore_table, + &wild_ignore_table_inited); + if(add_wild_table_rule(&replicate_wild_ignore_table, argument)) { - if (!wild_ignore_table_inited) - init_table_rule_array(&replicate_wild_ignore_table, - &wild_ignore_table_inited); - if(add_wild_table_rule(&replicate_wild_ignore_table, optarg)) - { - fprintf(stderr, "Could not add ignore table rule '%s'!\n", optarg); - exit(1); - } - table_rules_on = 1; - break; + fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument); + exit(1); } - case (int)OPT_REPLICATE_IGNORE_TABLE: + table_rules_on = 1; + break; + } + case (int)OPT_REPLICATE_IGNORE_TABLE: + { + if (!ignore_table_inited) + init_table_rule_hash(&replicate_ignore_table, &ignore_table_inited); + if(add_table_rule(&replicate_ignore_table, argument)) { - if (!ignore_table_inited) - init_table_rule_hash(&replicate_ignore_table, &ignore_table_inited); - if(add_table_rule(&replicate_ignore_table, optarg)) - { - fprintf(stderr, "Could not add ignore table rule '%s'!\n", optarg); - exit(1); - } - table_rules_on = 1; - break; + fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument); + exit(1); } - case (int) OPT_SQL_BIN_UPDATE_SAME: - opt_sql_bin_update = 1; - break; - case (int) OPT_SLOW_QUERY_LOG: - opt_slow_log=1; - opt_slow_logname=optarg; - break; - case (int)OPT_RECKLESS_SLAVE: - opt_reckless_slave = 1; - init_slave_skip_errors("all"); + table_rules_on = 1; break; - case (int)OPT_SKIP_SLAVE_START: - opt_skip_slave_start = 1; - break; - case (int) OPT_SKIP_NEW: - opt_specialflag|= SPECIAL_NO_NEW_FUNC; - myisam_delay_key_write=0; - myisam_concurrent_insert=0; - myisam_recover_options= HA_RECOVER_NONE; - my_disable_symlinks=1; - my_use_symdir=0; - have_symlink=SHOW_OPTION_DISABLED; - ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED; + } + case (int) OPT_SLOW_QUERY_LOG: + opt_slow_log=1; + opt_slow_logname=argument; + break; + case (int)OPT_RECKLESS_SLAVE: + opt_reckless_slave = 1; + init_slave_skip_errors("all"); + break; + case (int) OPT_SKIP_NEW: + opt_specialflag|= SPECIAL_NO_NEW_FUNC; + myisam_delay_key_write=0; + myisam_concurrent_insert=0; + myisam_recover_options= HA_RECOVER_NONE; + my_disable_symlinks=1; + my_use_symdir=0; + have_symlink=SHOW_OPTION_DISABLED; + ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED; #ifdef HAVE_QUERY_CACHE - query_cache_size=0; -#endif - break; - case (int) OPT_SAFE: - opt_specialflag|= SPECIAL_SAFE_MODE; - myisam_delay_key_write=0; - myisam_recover_options= HA_RECOVER_NONE; // To be changed - ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED; - break; - case (int) OPT_SKIP_CONCURRENT_INSERT: - myisam_concurrent_insert=0; - break; - case (int) OPT_SKIP_PRIOR: - opt_specialflag|= SPECIAL_NO_PRIOR; - break; - case (int) OPT_SKIP_GRANT: - opt_noacl=1; - break; - case (int) OPT_SKIP_LOCK: - my_disable_locking=myisam_single_user= 1; - break; - case (int) OPT_SKIP_HOST_CACHE: - opt_specialflag|= SPECIAL_NO_HOST_CACHE; - break; - case (int) OPT_ENABLE_LOCK: - my_disable_locking=myisam_single_user=0; - break; - case (int) OPT_USE_LOCKING: - my_disable_locking=0; - break; - case (int) OPT_SKIP_RESOLVE: - opt_specialflag|=SPECIAL_NO_RESOLVE; - break; - case (int) OPT_LONG_FORMAT: - opt_specialflag|=SPECIAL_LONG_LOG_FORMAT; - break; - case (int) OPT_NO_MIX_TYPE: - opt_no_mix_types = 1; - break; - case (int) OPT_SKIP_NETWORKING: - opt_disable_networking=1; - mysql_port=0; - break; - case (int) OPT_SKIP_SHOW_DB: - opt_skip_show_db=1; - opt_specialflag|=SPECIAL_SKIP_SHOW_DB; - mysql_port=0; - break; - case (int) OPT_MEMLOCK: - locked_in_memory=1; - break; - case (int) OPT_ONE_THREAD: - test_flags |= TEST_NO_THREADS; - break; - case (int) OPT_WANT_CORE: - test_flags |= TEST_CORE_ON_SIGNAL; - break; - case (int) OPT_SKIP_STACK_TRACE: - test_flags|=TEST_NO_STACKTRACE; - break; - case (int) OPT_SKIP_SYMLINKS: - my_disable_symlinks=1; - my_use_symdir=0; - have_symlink=SHOW_OPTION_DISABLED; - break; - case (int) OPT_BIND_ADDRESS: - if (optarg && isdigit(optarg[0])) - { - my_bind_addr = (ulong) inet_addr(optarg); - } + query_cache_size=0; +#endif + break; + case (int) OPT_SAFE: + opt_specialflag|= SPECIAL_SAFE_MODE; + myisam_delay_key_write=0; + myisam_recover_options= HA_RECOVER_NONE; // To be changed + ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED; + break; + case (int) OPT_SKIP_PRIOR: + opt_specialflag|= SPECIAL_NO_PRIOR; + break; + case (int) OPT_SKIP_LOCK: + my_disable_locking=myisam_single_user= 1; + break; + case (int) OPT_SKIP_HOST_CACHE: + opt_specialflag|= SPECIAL_NO_HOST_CACHE; + break; + case (int) OPT_ENABLE_LOCK: + my_disable_locking=myisam_single_user=0; + break; + case (int) OPT_USE_LOCKING: + my_disable_locking=0; + break; + case (int) OPT_SKIP_RESOLVE: + opt_specialflag|=SPECIAL_NO_RESOLVE; + break; + case (int) OPT_LONG_FORMAT: + opt_specialflag|=SPECIAL_LONG_LOG_FORMAT; + break; + case (int) OPT_SKIP_NETWORKING: + opt_disable_networking=1; + mysql_port=0; + break; + case (int) OPT_SKIP_SHOW_DB: + opt_skip_show_db=1; + opt_specialflag|=SPECIAL_SKIP_SHOW_DB; + mysql_port=0; + break; + case (int) OPT_ONE_THREAD: + test_flags |= TEST_NO_THREADS; + break; + case (int) OPT_WANT_CORE: + test_flags |= TEST_CORE_ON_SIGNAL; + break; + case (int) OPT_SKIP_STACK_TRACE: + test_flags|=TEST_NO_STACKTRACE; + break; + case (int) OPT_SKIP_SYMLINKS: + my_disable_symlinks=1; + my_use_symdir=0; + have_symlink=SHOW_OPTION_DISABLED; + break; + case (int) OPT_BIND_ADDRESS: + if (argument && isdigit(argument[0])) + { + my_bind_addr = (ulong) inet_addr(argument); + } + else + { + struct hostent *ent; + if (!argument || !argument[0]) + ent=gethostbyname(argument); else { - struct hostent *ent; - if (!optarg || !optarg[0]) - ent=gethostbyname(optarg); - else - { - char myhostname[255]; - if (gethostname(myhostname,sizeof(myhostname)) < 0) - { - sql_perror("Can't start server: cannot get my own hostname!"); - exit(1); - } - ent=gethostbyname(myhostname); - } - if (!ent) + char myhostname[255]; + if (gethostname(myhostname,sizeof(myhostname)) < 0) { - sql_perror("Can't start server: cannot resolve hostname!"); + sql_perror("Can't start server: cannot get my own hostname!"); exit(1); } - my_bind_addr = (ulong) ((in_addr*)ent->h_addr_list[0])->s_addr; + ent=gethostbyname(myhostname); } - break; - case (int) OPT_PID_FILE: - strmake(pidfile_name, optarg, sizeof(pidfile_name)-1); - break; - case (int) OPT_INIT_FILE: - opt_init_file=optarg; - break; - case (int) OPT_HAVE_NAMED_PIPE: -#if __NT__ - opt_enable_named_pipe=1; -#endif - break; + if (!ent) + { + sql_perror("Can't start server: cannot resolve hostname!"); + exit(1); + } + my_bind_addr = (ulong) ((in_addr*)ent->h_addr_list[0])->s_addr; + } + break; + case (int) OPT_PID_FILE: + strmake(pidfile_name, argument, sizeof(pidfile_name)-1); + break; + case (int) OPT_INIT_FILE: + opt_init_file=argument; + break; #ifdef __WIN__ - case (int) OPT_STANDALONE: /* Dummy option for NT */ - break; - case (int) OPT_CONSOLE: - opt_console=1; - break; + case (int) OPT_STANDALONE: /* Dummy option for NT */ + break; #endif - case (int) OPT_FLUSH: + case (int) OPT_FLUSH: #ifdef HAVE_ISAM - nisam_flush=1; -#endif - myisam_flush=1; - flush_time=0; // No auto flush - break; - case OPT_LOW_PRIORITY_UPDATES: - thd_startup_options|=OPTION_LOW_PRIORITY_UPDATES; - thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY; - low_priority_updates=1; - break; - case OPT_BOOTSTRAP: - opt_noacl=opt_bootstrap=1; - break; - case OPT_TABLE_TYPE: + nisam_flush=1; +#endif + myisam_flush=1; + flush_time=0; // No auto flush + break; + case OPT_LOW_PRIORITY_UPDATES: + thd_startup_options|=OPTION_LOW_PRIORITY_UPDATES; + thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY; + low_priority_updates=1; + break; + case OPT_BOOTSTRAP: + opt_noacl=opt_bootstrap=1; + break; + case OPT_TABLE_TYPE: { int type; - if ((type=find_type(optarg, &ha_table_typelib, 2)) <= 0) + if ((type=find_type(argument, &ha_table_typelib, 2)) <= 0) { - fprintf(stderr,"Unknown table type: %s\n",optarg); + fprintf(stderr,"Unknown table type: %s\n",argument); exit(1); } default_table_type= (enum db_type) type; break; } - case OPT_SERVER_ID: - server_id = atoi(optarg); - server_id_supplied = 1; - break; - case OPT_DELAY_KEY_WRITE: - ha_open_options|=HA_OPEN_DELAY_KEY_WRITE; - myisam_delay_key_write=1; - break; - case OPT_SKIP_DELAY_KEY_WRITE: - myisam_delay_key_write=0; - break; - case 'C': - strmake(default_charset, optarg, sizeof(default_charset)-1); - break; - case OPT_CHARSETS_DIR: - strmake(mysql_charsets_dir, optarg, sizeof(mysql_charsets_dir)-1); - charsets_dir = mysql_charsets_dir; - break; + case OPT_SERVER_ID: + server_id = atoi(argument); + server_id_supplied = 1; + break; + case OPT_DELAY_KEY_WRITE: + ha_open_options|=HA_OPEN_DELAY_KEY_WRITE; + myisam_delay_key_write=1; + break; + case 'C': + strmake(default_charset, argument, sizeof(default_charset)-1); + break; + case OPT_CHARSETS_DIR: + strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir)-1); + charsets_dir = mysql_charsets_dir; + break; #ifdef HAVE_OPENSSL - case OPT_SSL_SSL: - opt_use_ssl = 1; /* true */ - break; - case OPT_SSL_KEY: - opt_use_ssl = 1; /* true */ - my_free(opt_ssl_key, MYF(MY_ALLOW_ZERO_PTR)); - opt_ssl_key = my_strdup(optarg, MYF(0)); - break; - case OPT_SSL_CERT: - opt_use_ssl = 1; /* true */ - my_free(opt_ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); - opt_ssl_cert = my_strdup(optarg, MYF(0)); - break; - case OPT_SSL_CA: - opt_use_ssl = 1; /* true */ - my_free(opt_ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); - opt_ssl_ca = my_strdup(optarg, MYF(0)); - break; - case OPT_SSL_CAPATH: - opt_use_ssl = 1; /* true */ - my_free(opt_ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); - opt_ssl_capath = my_strdup(optarg, MYF(0)); - break; - case OPT_SSL_CIPHER: - opt_use_ssl = 1; /* true */ - my_free(opt_ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); - opt_ssl_cipher = my_strdup(optarg, MYF(0)); - break; +#include "sslopt-case.h" #endif - case OPT_DES_KEY_FILE: + case OPT_DES_KEY_FILE: #ifdef HAVE_OPENSSL - des_key_file=optarg; + des_key_file=argument; #endif - break; - case OPT_TX_ISOLATION: + break; + case OPT_TX_ISOLATION: { int type; - if ((type=find_type(optarg, &tx_isolation_typelib, 2)) <= 0) + if ((type=find_type(argument, &tx_isolation_typelib, 2)) <= 0) { - fprintf(stderr,"Unknown transaction isolation type: %s\n",optarg); + fprintf(stderr,"Unknown transaction isolation type: %s\n",argument); exit(1); } default_tx_isolation= (enum_tx_isolation) (type-1); break; } #ifdef HAVE_BERKELEY_DB - case OPT_BDB_LOG: - berkeley_logdir=optarg; - break; - case OPT_BDB_HOME: - berkeley_home=optarg; - break; - case OPT_BDB_NOSYNC: - berkeley_env_flags|=DB_TXN_NOSYNC; - break; - case OPT_BDB_NO_RECOVER: - berkeley_init_flags&= ~(DB_RECOVER); - break; - case OPT_BDB_TMP: - berkeley_tmpdir=optarg; - break; - case OPT_BDB_LOCK: + case OPT_BDB_LOG: + berkeley_logdir=argument; + break; + case OPT_BDB_HOME: + berkeley_home=argument; + break; + case OPT_BDB_NOSYNC: + berkeley_env_flags|=DB_TXN_NOSYNC; + break; + case OPT_BDB_NO_RECOVER: + berkeley_init_flags&= ~(DB_RECOVER); + break; + case OPT_BDB_TMP: + berkeley_tmpdir=argument; + break; + case OPT_BDB_LOCK: { int type; - if ((type=find_type(optarg, &berkeley_lock_typelib, 2)) > 0) + if ((type=find_type(argument, &berkeley_lock_typelib, 2)) > 0) berkeley_lock_type=berkeley_lock_types[type-1]; else { - if (test_if_int(optarg,(uint) strlen(optarg))) - berkeley_lock_scan_time=atoi(optarg); + if (test_if_int(argument,(uint) strlen(argument))) + berkeley_lock_scan_time=atoi(argument); else { - fprintf(stderr,"Unknown lock type: %s\n",optarg); + fprintf(stderr,"Unknown lock type: %s\n",argument); exit(1); } } break; } - case OPT_BDB_SHARED: - berkeley_init_flags&= ~(DB_PRIVATE); - berkeley_shared_data=1; - break; + case OPT_BDB_SHARED: + berkeley_init_flags&= ~(DB_PRIVATE); + berkeley_shared_data=1; + break; #endif /* HAVE_BERKELEY_DB */ - case OPT_BDB_SKIP: + case OPT_BDB_SKIP: #ifdef HAVE_BERKELEY_DB - berkeley_skip=1; - have_berkeley_db=SHOW_OPTION_DISABLED; + berkeley_skip=1; + have_berkeley_db=SHOW_OPTION_DISABLED; #endif - break; - case OPT_INNODB_SKIP: + break; + case OPT_INNODB_SKIP: #ifdef HAVE_INNOBASE_DB - innodb_skip=1; - have_innodb=SHOW_OPTION_DISABLED; + innodb_skip=1; + have_innodb=SHOW_OPTION_DISABLED; #endif - break; - case OPT_INNODB_DATA_FILE_PATH: + break; + case OPT_INNODB_DATA_FILE_PATH: #ifdef HAVE_INNOBASE_DB - innobase_data_file_path=optarg; + innobase_data_file_path=argument; #endif - break; + break; #ifdef HAVE_INNOBASE_DB - case OPT_INNODB_DATA_HOME_DIR: - innobase_data_home_dir=optarg; - break; - case OPT_INNODB_LOG_GROUP_HOME_DIR: - innobase_log_group_home_dir=optarg; - break; - case OPT_INNODB_LOG_ARCH_DIR: - innobase_log_arch_dir=optarg; - break; - case OPT_INNODB_LOG_ARCHIVE: - innobase_log_archive= optarg ? test(atoi(optarg)) : 1; - break; - case OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT: - innobase_flush_log_at_trx_commit= optarg ? test(atoi(optarg)) : 1; - break; - case OPT_INNODB_FAST_SHUTDOWN: - innobase_fast_shutdown= optarg ? test(atoi(optarg)) : 1; - break; - case OPT_INNODB_FLUSH_METHOD: - innobase_unix_file_flush_method=optarg; - break; + case OPT_INNODB_DATA_HOME_DIR: + innobase_data_home_dir=argument; + break; + case OPT_INNODB_LOG_GROUP_HOME_DIR: + innobase_log_group_home_dir=argument; + break; + case OPT_INNODB_LOG_ARCH_DIR: + innobase_log_arch_dir=argument; + break; + case OPT_INNODB_LOG_ARCHIVE: + innobase_log_archive= argument ? test(atoi(argument)) : 1; + break; + case OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT: + innobase_flush_log_at_trx_commit= argument ? test(atoi(argument)) : 1; + break; + case OPT_INNODB_FAST_SHUTDOWN: + innobase_fast_shutdown= argument ? test(atoi(argument)) : 1; + break; + case OPT_INNODB_FLUSH_METHOD: + innobase_unix_file_flush_method=argument; + break; #endif /* HAVE_INNOBASE_DB */ - case OPT_DO_PSTACK: - opt_do_pstack = 1; - break; - case OPT_MYISAM_RECOVER: + case OPT_MYISAM_RECOVER: { - if (!optarg || !optarg[0]) + if (!argument || !argument[0]) { myisam_recover_options= HA_RECOVER_DEFAULT; myisam_recover_options_str= myisam_recover_typelib.type_names[0]; } else { - myisam_recover_options_str=optarg; + myisam_recover_options_str=argument; if ((myisam_recover_options= - find_bit_type(optarg, &myisam_recover_typelib)) == ~(ulong) 0) + find_bit_type(argument, &myisam_recover_typelib)) == ~(ulong) 0) { - fprintf(stderr, "Unknown option to myisam-recover: %s\n",optarg); + fprintf(stderr, "Unknown option to myisam-recover: %s\n",argument); exit(1); } } ha_open_options|=HA_OPEN_ABORT_IF_CRASHED; break; } - case OPT_SQL_MODE: + case OPT_SQL_MODE: { - sql_mode_str = optarg; + sql_mode_str = argument; if ((opt_sql_mode = - find_bit_type(optarg, &sql_mode_typelib)) == ~(ulong) 0) + find_bit_type(argument, &sql_mode_typelib)) == ~(ulong) 0) { - fprintf(stderr, "Unknown option to sql-mode: %s\n", optarg); + fprintf(stderr, "Unknown option to sql-mode: %s\n", argument); exit(1); } default_tx_isolation= ((opt_sql_mode & MODE_SERIALIZABLE) ? @@ -4283,78 +4430,80 @@ static void get_options(int argc,char **argv) ISO_READ_COMMITTED); break; } - case OPT_MASTER_HOST: - master_host=optarg; - break; - case OPT_MASTER_USER: - master_user=optarg; - break; - case OPT_MASTER_PASSWORD: - master_password=optarg; - break; - case OPT_MASTER_INFO_FILE: - master_info_file=optarg; - break; - case OPT_RELAY_LOG_INFO_FILE: - relay_log_info_file=optarg; - break; - case OPT_MASTER_PORT: - master_port= atoi(optarg); - break; - case OPT_MASTER_SSL: - master_ssl=atoi(optarg); - break; - case OPT_MASTER_SSL_KEY: - master_ssl_key=optarg; - break; - case OPT_MASTER_SSL_CERT: - master_ssl_cert=optarg; - break; - case OPT_REPORT_HOST: - report_host=optarg; - break; - case OPT_REPORT_USER: - report_user=optarg; - break; - case OPT_REPORT_PASSWORD: - report_password=optarg; - break; - case OPT_REPORT_PORT: - report_port= atoi(optarg); - break; - case OPT_MASTER_CONNECT_RETRY: - master_connect_retry= atoi(optarg); - break; - case OPT_MASTER_RETRY_COUNT: - master_retry_count= atoi(optarg); - break; - case OPT_SAFE_SHOW_DB: - opt_safe_show_db=1; - break; - case OPT_SAFE_USER_CREATE: - opt_safe_user_create=1; - break; - case OPT_SKIP_SAFEMALLOC: + case OPT_MASTER_HOST: + master_host=argument; + break; + case OPT_MASTER_USER: + master_user=argument; + break; + case OPT_MASTER_PASSWORD: + master_password=argument; + break; + case OPT_MASTER_INFO_FILE: + master_info_file=argument; + break; + case OPT_RELAY_LOG_INFO_FILE: + relay_log_info_file=argument; + break; + case OPT_MASTER_PORT: + master_port= atoi(argument); + break; + case OPT_MASTER_SSL_KEY: + master_ssl_key=argument; + break; + case OPT_MASTER_SSL_CERT: + master_ssl_cert=argument; + break; + case OPT_REPORT_HOST: + report_host=argument; + break; + case OPT_REPORT_USER: + report_user=argument; + break; + case OPT_REPORT_PASSWORD: + report_password=argument; + break; + case OPT_REPORT_PORT: + report_port= atoi(argument); + break; + case OPT_MASTER_CONNECT_RETRY: + master_connect_retry= atoi(argument); + break; + case OPT_MASTER_RETRY_COUNT: + master_retry_count= atoi(argument); + break; + case OPT_SKIP_SAFEMALLOC: #ifdef SAFEMALLOC - sf_malloc_quick=1; + sf_malloc_quick=1; #endif - break; - default: - fprintf(stderr,"%s: Unrecognized option: %c\n",my_progname,c); - use_help(); - exit(1); - } + break; } - // Skip empty arguments (from shell) - while (argc != optind && !argv[optind][0]) - optind++; - if (argc != optind) + return 0; +} + + /* Initiates DEBUG - but no debugging here ! */ + +static void get_options(int argc,char **argv) +{ + int ho_error; + + myisam_delay_key_write=1; // Allow use of this +#ifndef HAVE_purify + my_use_symdir=1; // Use internal symbolic links +#else + /* Symlinks gives too many warnings with purify */ + my_disable_symlinks=1; + my_use_symdir=0; + have_symlink=SHOW_OPTION_DISABLED; +#endif + + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) { - fprintf(stderr,"%s: Too many parameters\n",my_progname); - use_help(); + printf("%s: handle_options() failed with error %d\n", my_progname, + ho_error); exit(1); } - optind = 0; // setup so that getopt_long() can be called again + fix_paths(); default_table_type_name=ha_table_typelib.type_names[default_table_type-1]; default_tx_isolation_name=tx_isolation_typelib.type_names[default_tx_isolation]; -- cgit v1.2.1 From 86a8c06f0c1b3f52b190226559f7a642c8c9def6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 May 2002 05:46:30 -0300 Subject: Add several services for NT --- sql/mysqld.cc | 85 +++++++++++++++++++++++++++++++++++++++------------------ sql/nt_servc.cc | 30 ++++++++++++++++++++ sql/nt_servc.h | 2 ++ 3 files changed, 90 insertions(+), 27 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 91388197dc4..bdcef2f207f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -421,6 +421,7 @@ enum db_type default_table_type=DB_TYPE_MYISAM; #include #if !defined(EMBEDDED_LIBRARY) HANDLE hEventShutdown; +static char *event_name; #include "nt_servc.h" static NTService Service; // Service object for WinNT #endif @@ -2063,7 +2064,7 @@ The server will not act as a slave."); (void) thr_setconcurrency(concurrency); // 10 by default #if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) //IRENA { - hEventShutdown=CreateEvent(0, FALSE, FALSE, "MySqlShutdown"); + hEventShutdown=CreateEvent(0, FALSE, FALSE, event_name); pthread_t hThread; if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0)) sql_print_error("Warning: Can't create thread to handle shutdown requests"); @@ -2198,46 +2199,70 @@ int mysql_service(void *p) int main(int argc, char **argv) { - // check environment variable OS - if (Service.GetOS()) // "OS" defined; Should be NT + if (Service.GetOS()) /* true NT family */ { + char file_path[FN_REFLEN]; + my_path(file_path, argv[0], ""); /* Find name in path */ + fn_format(file_path,argv[0],file_path,"",1+4+16); /* Force use of full path */ + 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])) + { + /* start an optional service */ + load_default_groups[0]= argv[1]; + event_name= argv[1]; + start_mode= 1; + Service.Init(event_name, mysql_service ); + return 0; + } + } + else if (argc == 3) /* install or remove any optional service */ { - char path[FN_REFLEN]; - my_path(path, argv[0], ""); // Find name in path - fn_format(path,argv[0],path,"",1+4+16); // Force use of full path - - if (!strcmp(argv[1],"-install") || !strcmp(argv[1],"--install")) + 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,MYSQL_SERVICENAME,MYSQL_SERVICENAME,path); - return 0; + Service.Install(1, argv[2], argv[2], file_path); + return 0; } - else if (!strcmp(argv[1],"-install-manual") || !strcmp(argv[1],"--install-manual")) + else if (Service.got_service_option(argv, "install-manual")) { - Service.Install(0,MYSQL_SERVICENAME,MYSQL_SERVICENAME,path); - return 0; + Service.Install(0, argv[2], argv[2], file_path); + return 0; } - else if (!strcmp(argv[1],"-remove") || !strcmp(argv[1],"--remove")) + else if (Service.got_service_option(argv, "remove")) { - Service.Remove(MYSQL_SERVICENAME); - return 0; + Service.Remove(argv[2]); + return 0; } } - else if (argc == 1) // No arguments; start as a service + else if (argc == 1 && Service.IsService(MYSQL_SERVICENAME)) { - // init service - start_mode = 1; - long tmp=Service.Init(MYSQL_SERVICENAME,mysql_service); + /* start the default service */ + start_mode= 1; + event_name= "MySqlShutdown"; + Service.Init(MYSQL_SERVICENAME, mysql_service); return 0; } } - - /* - This is a WIN95 machine or a start of mysqld as a standalone program - we have to pass the arguments, in case of NT-service this will be done - by ServiceMain() - */ - + /* Start as standalone server */ Service.my_argc=argc; Service.my_argv=argv; mysql_service(NULL); @@ -3825,9 +3850,15 @@ Starts the MySQL server\n"); printf("Usage: %s [OPTIONS]\n", my_progname); #ifdef __WIN__ puts("NT and Win32 specific options:\n\ + --console Don't remove the console window\n\ --install Install the default service (NT)\n\ --install-manual Install the default service started manually (NT)\n\ + --install service_name Install an optional service (NT)\n\ + --install-manual service_name Install an optional service started manually (NT)\n\ --remove Remove the default service from the service list (NT)\n\ + --remove service_name Remove the service_name from the service list (NT)\n\ + --enable-named-pipe Only to be used for the default server (NT)\n\ + --standalone Dummy option to start as a standalone server (NT)\ "); puts(""); #endif diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc index 8c705a94f55..be2ceb9cb7a 100644 --- a/sql/nt_servc.cc +++ b/sql/nt_servc.cc @@ -479,3 +479,33 @@ If this condition persist, reboot the machine and try again\n"); return ret_value; } +/* ------------------------------------------------------------------------ + -------------------------------------------------------------------------- */ +BOOL NTService::IsService(LPCSTR ServiceName) +{ + BOOL ret_value=FALSE; + SC_HANDLE service, scm; + + if (scm = OpenSCManager(0, 0,SC_MANAGER_ENUMERATE_SERVICE)) + { + if ((service = OpenService(scm,ServiceName, SERVICE_ALL_ACCESS ))) + { + ret_value=TRUE; + CloseServiceHandle(service); + } + CloseServiceHandle(scm); + } + return ret_value; +} +/* ------------------------------------------------------------------------ + -------------------------------------------------------------------------- */ +BOOL NTService::got_service_option(char **argv, char *service_option) +{ + char *option = argv[1]; + + while (*option) + if (!strcmp(option++, service_option)) + return TRUE; + + return FALSE; +} diff --git a/sql/nt_servc.h b/sql/nt_servc.h index 40d1a8c03fa..ab3238e0f41 100644 --- a/sql/nt_servc.h +++ b/sql/nt_servc.h @@ -52,6 +52,8 @@ class NTService LPCSTR szAccountName=NULL,LPCSTR szPassword=NULL); BOOL SeekStatus(LPCSTR szInternName, int OperationType); BOOL Remove(LPCSTR szInternName); + BOOL IsService(LPCSTR ServiceName); + BOOL got_service_option(char **argv, char *service_option); void Stop(void); //to be called from app. to stop service -- cgit v1.2.1 From bb340c9bc357a313c21b24e34162bede99418583 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 12 May 2002 23:01:45 -0300 Subject: Sergei's MyODBC fix --- sql/log.cc | 4 ++-- sql/slave.cc | 2 +- sql/sql_acl.cc | 8 ++++---- sql/sql_select.cc | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sql') diff --git a/sql/log.cc b/sql/log.cc index bc2b19d921f..f4284ac6bad 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -372,14 +372,14 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log) error = LOG_INFO_MEM; goto err; } - if (init_dynamic_array(&logs_to_purge, sizeof(char*), 1024, 1024)) + if (my_init_dynamic_array(&logs_to_purge, sizeof(char*), 1024, 1024)) { error = LOG_INFO_MEM; goto err; } logs_to_purge_inited = 1; - if (init_dynamic_array(&logs_to_keep, sizeof(char*), 1024, 1024)) + if (my_init_dynamic_array(&logs_to_keep, sizeof(char*), 1024, 1024)) { error = LOG_INFO_MEM; goto err; diff --git a/sql/slave.cc b/sql/slave.cc index cb3d375f476..946cf483e4b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -114,7 +114,7 @@ void init_table_rule_hash(HASH* h, bool* h_inited) void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited) { - init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE, + my_init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE, TABLE_RULE_ARR_SIZE); *a_inited = 1; } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 33924ada8ab..e6b0248e29b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -158,7 +158,7 @@ int acl_init(bool dont_read_acl_tables) init_sql_alloc(&mem,1024,0); init_read_record(&read_record_info,thd,table= tables[0].table,NULL,1,0); - VOID(init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50)); + VOID(my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50)); while (!(read_record_info.read_record(&read_record_info))) { ACL_HOST host; @@ -182,7 +182,7 @@ int acl_init(bool dont_read_acl_tables) freeze_size(&acl_hosts); init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0); - VOID(init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100)); + VOID(my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100)); if (table->field[2]->field_length == 8 && protocol_version == PROTOCOL_VERSION) { @@ -236,7 +236,7 @@ int acl_init(bool dont_read_acl_tables) freeze_size(&acl_users); init_read_record(&read_record_info,thd,table=tables[2].table,NULL,1,0); - VOID(init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100)); + VOID(my_init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100)); while (!(read_record_info.read_record(&read_record_info))) { ACL_DB db; @@ -688,7 +688,7 @@ int wild_case_compare(const char *str,const char *wildstr) static void init_check_host(void) { DBUG_ENTER("init_check_host"); - VOID(init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip), + VOID(my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip), acl_users.elements,1)); VOID(hash_init(&acl_check_hosts,acl_users.elements,0,0, (hash_get_key) check_get_key,0,HASH_CASE_INSENSITIVE)); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c4383cbb09f..c6339c2c34f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1462,7 +1462,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, join_tab[i].table->map); } } - if (init_dynamic_array(keyuse,sizeof(KEYUSE),20,64)) + if (my_init_dynamic_array(keyuse,sizeof(KEYUSE),20,64)) return TRUE; /* fill keyuse with found key parts */ for (KEY_FIELD *field=key_fields ; field != end ; field++) -- cgit v1.2.1 From 9595a545725de328da4806aa62586104c24e3e0f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 May 2002 22:03:47 +0300 Subject: Fixed some bugs and added support for --loose-set-variable mysys/my_getopt.c: Added support for --loose-set-variable sql/mysqld.cc: Fixed a bug when compiling with innodb and/or bdb. --- sql/mysqld.cc | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index bdcef2f207f..9bbac7bdb0b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2806,7 +2806,20 @@ enum options { OPT_SORT_BUFFER, OPT_TABLE_CACHE, OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, - OPT_WAIT_TIMEOUT + OPT_WAIT_TIMEOUT, + OPT_INNODB_MIRRORED_LOG_GROUPS, + OPT_INNODB_LOG_FILES_IN_GROUP, + OPT_INNODB_LOG_FILE_SIZE, + OPT_INNODB_LOG_BUFFER_SIZE, + OPT_INNODB_BUFFER_POOL_SIZE, + OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE, + OPT_INNODB_FILE_IO_THREADS, + OPT_INNODB_LOCK_WAIT_TIMEOUT, + OPT_INNODB_THREAD_CONCURRENCY, + OPT_INNODB_FORCE_RECOVERY, + OPT_BDB_CACHE_SIZE, + OPT_BDB_LOG_BUFFER_SIZE, + OPT_BDB_MAX_LOCK }; @@ -2945,7 +2958,7 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN, "Speeds up server shutdown process", (gptr*) &innobase_fast_shutdown, - (gptr*) &innobase_fast_shutdown, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + (gptr*) &innobase_fast_shutdown, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #endif /* End HAVE_INNOBASE_DB */ {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -3040,6 +3053,7 @@ static struct my_option my_long_options[] = */ {"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory, (gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifndef DBUG_OFF {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT, "Undocumented: Meant for debugging and testing of replication", (gptr*) &disconnect_slave_event_count, @@ -3056,6 +3070,7 @@ static struct my_option my_long_options[] = (gptr*) &opt_sporadic_binlog_dump_fail, (gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif {"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT, "Simulate memory shortage when compiled with the --with-debug=full option", 0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -3243,7 +3258,7 @@ static struct my_option my_long_options[] = REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, #ifdef HAVE_BERKELEY_DB { "bdb_cache_size", OPT_BDB_CACHE_SIZE, - "The buffer that is allocated to cache index and rows for BDB tables." + "The buffer that is allocated to cache index and rows for BDB tables.", (gptr*) &berkeley_cache_size, (gptr*) &berkeley_cache_size, 0, GET_ULONG, REQUIRED_ARG, KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE, 0}, {"bdb_log_buffer_size", OPT_BDB_LOG_BUFFER_SIZE, -- cgit v1.2.1 From 86b22609f3283b3b0948e663d5f50c8d9f9c2234 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 May 2002 14:42:03 +0300 Subject: DROP DATABASE with symlinks did not work before --- sql/sql_db.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 1e798a392b1..372dff85007 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -271,9 +271,16 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *org_path, */ if (!found_other_files) { - char tmp_path[FN_REFLEN]; + char tmp_path[FN_REFLEN], lnk_path[FN_REFLEN]; char *path=unpack_filename(tmp_path,org_path); #ifdef HAVE_READLINK + if (path[0] == FN_CURLIB) + { + int length = (strxmov(lnk_path,curr_dir,path + 2, NullS) - lnk_path) - 1; + path=lnk_path; + if (path[length] == FN_LIBCHAR) + path[length]='\0'; + } int linkcount = readlink(path,filePath,sizeof(filePath)-1); if (linkcount > 0) // If the path was a symbolic link { -- cgit v1.2.1 From e5a0468c9597e94d173c460627e7d9d46f4eee00 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 May 2002 17:24:07 +0300 Subject: Fixed typo in error message from sql_yacc.yy sql/sql_yacc.yy: Fixed typo --- sql/sql_yacc.yy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 79227bcc3f9..e5c9bb04af8 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3514,7 +3514,7 @@ require_list_element: SUBJECT_SYM TEXT_STRING LEX *lex=Lex; if (lex->ssl_cipher) { - net_printf(&lex->thd->net,ER_DUP_ARGUMENT, "CHIPER"); + net_printf(&lex->thd->net,ER_DUP_ARGUMENT, "CIPHER"); YYABORT; } lex->ssl_cipher=$2.str; -- cgit v1.2.1 From d7181839db6d77cc87eb0db8ac6ac158ee41b4d2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 May 2002 19:06:23 +0300 Subject: Corrected fix for DROP DATABASE on symbolic link --- sql/sql_db.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'sql') diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 372dff85007..451a48042b5 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -271,20 +271,20 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *org_path, */ if (!found_other_files) { - char tmp_path[FN_REFLEN], lnk_path[FN_REFLEN]; + char tmp_path[FN_REFLEN], *pos; char *path=unpack_filename(tmp_path,org_path); #ifdef HAVE_READLINK - if (path[0] == FN_CURLIB) - { - int length = (strxmov(lnk_path,curr_dir,path + 2, NullS) - lnk_path) - 1; - path=lnk_path; - if (path[length] == FN_LIBCHAR) - path[length]='\0'; - } - int linkcount = readlink(path,filePath,sizeof(filePath)-1); - if (linkcount > 0) // If the path was a symbolic link + int error; + + /* Remove end FN_LIBCHAR as this causes problem on Linux in readlink */ + pos=strend(path); + if (pos > path && pos[-1] == FN_LIBCHAR) + *--pos=0; + + if ((error=my_readlink(filePath, path, MYF(MY_WME))) < 0) + DBUG_RETURN(-1); + if (!error) { - *(filePath + linkcount) = '\0'; if (my_delete(path,MYF(!level ? MY_WME : 0))) { /* Don't give errors if we can't delete 'RAID' directory */ @@ -293,11 +293,12 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *org_path, send_error(&thd->net); DBUG_RETURN(-1); } - path=filePath; + /* Delete directory symbolic link pointed at */ + path= filePath; } #endif /* Remove last FN_LIBCHAR to not cause a probelm on OS/2 */ - char *pos=strend(path); + pos=strend(path); if (pos > path && pos[-1] == FN_LIBCHAR) *--pos=0; /* Don't give errors if we can't delete 'RAID' directory */ -- cgit v1.2.1 From 258718ad24b18abc7ddd189efec54eb732c2a4b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 01:01:26 +0300 Subject: Fixed bug in datetime range optimization Docs/manual.texi: Changelog mysql-test/r/type_datetime.result: Test of datetime optimization mysql-test/t/type_datetime.test: Test of datetime optimization --- sql/item.h | 19 +++++++++++++++++++ sql/item_cmpfunc.cc | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/item.h b/sql/item.h index 41b897956db..b8903756027 100644 --- a/sql/item.h +++ b/sql/item.h @@ -342,6 +342,25 @@ public: }; +/* + The following class is used to optimize comparing of date columns + We need to save the original item, to be able to set the field to the + original value in 'opt_range'. +*/ + +class Item_int_with_ref :public Item_int +{ + Item *ref; +public: + Item_int_with_ref(longlong i, Item *ref_arg) :Item_int(i), ref(ref_arg) + {} + bool save_in_field(Field *field) + { + return ref->save_in_field(field); + } +}; + + #include "item_sum.h" #include "item_func.h" #include "item_cmpfunc.h" diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 73821f8d826..ae50090fea1 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -45,8 +45,8 @@ static bool convert_constant_item(Field *field, Item **item) (*item)->save_in_field(field); if (!((*item)->null_value)) { - Item *tmp=new Item_int(field->val_int()); - if ((tmp)) + Item *tmp=new Item_int_with_ref(field->val_int(), *item); + if (tmp) *item=tmp; return 1; } -- cgit v1.2.1 From 96652de0ba50bf9cdf9e8a4afba97239076a9177 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 02:33:41 +0300 Subject: Some bug fixes. myisam/myisamchk.c: Fixed a type. mysys/my_getopt.c: Made GET_STRALC to work like x_free() when doing a freeing. Fixed a bug in my_print_variables() when printing a ulonglong value. sql/mysqld.cc: Fixed some wrongly alloced/freed variables and removed some unneccessary code. --- sql/mysqld.cc | 128 ++-------------------------------------------------------- 1 file changed, 4 insertions(+), 124 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9bbac7bdb0b..372a09c9788 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2977,8 +2977,8 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0, 0}, {"log-bin", OPT_BIN_LOG, "Log queries in new binary format (for replication)", - (gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STR, OPT_ARG, 0, - 0, 0, 0, 0, 0}, + (gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STRALC, + OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-bin-index", OPT_BIN_LOG_INDEX, "File that holds the names for last binary log files", (gptr*) &opt_binlog_index_name, (gptr*) &opt_binlog_index_name, 0, GET_STR, @@ -3139,7 +3139,7 @@ static struct my_option my_long_options[] = REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"relay-log", OPT_RELAY_LOG, "Undocumented", (gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"relay-log-index", OPT_RELAY_LOG_INDEX, "Undocumented", (gptr*) &opt_relaylog_index_name, (gptr*) &opt_relaylog_index_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -3208,7 +3208,7 @@ static struct my_option my_long_options[] = (gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "Undocumented", - (gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR, + (gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS, "Tells the slave thread to continue replication when a query returns an error from the provided list. Normally, replication will discontinue when an error is encountered, giving the user a chance to resolve the inconsistency in the data manually. Do not use this option unless you fully understand why you are getting the errors. If there are no bugs in your replication setup and client programs, and no bugs in MySQL itself, you should never get an abort with error. Indiscriminate use of this option will result in slaves being hopelessly out of sync with the master and you having no idea how the problem happened. For error codes, you should use the numbers provided by the error message in your slave error log and in the output of SHOW SLAVE STATUS. Full list of error messages can be found in the source distribution in `Docs/mysqld_error.txt'. You can (but should not) also use a very non-recommended value of all which will ignore all error messages and keep barging along regardless. Needless to say, if you use it, we make no promises regarding your data integrity. Please do not complain if your data on the slave is not anywhere close to what it is on the master in this case -- you have been warned. Example: slave-skip-errors=1062,1053 or slave-skip-errors=all", @@ -3974,7 +3974,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case 'l': opt_log=1; - opt_logname=argument; // Use hostname.log if null break; case 'h': strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1); @@ -3988,9 +3987,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'o': protocol_version=PROTOCOL_VERSION-1; break; - case 'P': - mysql_port= (unsigned int) atoi(argument); - break; case OPT_LOCAL_INFILE: opt_local_infile= test(!argument || atoi(argument) != 0); break; @@ -4002,24 +3998,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), safemalloc_mem_limit = atoi(argument); #endif break; - case OPT_RPL_RECOVERY_RANK: - rpl_recovery_rank=atoi(argument); - break; - case OPT_SLAVE_LOAD_TMPDIR: - slave_load_tmpdir = my_strdup(argument, MYF(MY_FAE)); - break; - case OPT_SOCKET: - mysql_unix_port= argument; - break; - case 'r': - mysqld_chroot=argument; - break; - case 't': - mysql_tmpdir=argument; - break; - case 'u': - mysqld_user=argument; - break; case 'v': case 'V': print_version(); @@ -4037,45 +4015,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case (int) OPT_ISAM_LOG: opt_myisam_log=1; - if (argument) - myisam_log_filename=argument; break; case (int) OPT_UPDATE_LOG: opt_update_log=1; - opt_update_logname=argument; // Use hostname.# if null - break; - case (int) OPT_RELAY_LOG_INDEX: - opt_relaylog_index_name = argument; - break; - case (int) OPT_RELAY_LOG: - x_free(opt_relay_logname); - if (argument && argument[0]) - opt_relay_logname=my_strdup(argument,MYF(0)); - break; - case (int) OPT_BIN_LOG_INDEX: - opt_binlog_index_name = argument; break; case (int) OPT_BIN_LOG: opt_bin_log=1; - x_free(opt_bin_logname); - if (argument && argument[0]) - opt_bin_logname=my_strdup(argument,MYF(0)); - break; - // needs to be handled (as no-op) in non-debugging mode for test suite - case (int)OPT_DISCONNECT_SLAVE_EVENT_COUNT: -#ifndef DBUG_OFF - disconnect_slave_event_count = atoi(argument); -#endif - break; - case (int)OPT_ABORT_SLAVE_EVENT_COUNT: -#ifndef DBUG_OFF - abort_slave_event_count = atoi(argument); -#endif - break; - case (int) OPT_MAX_BINLOG_DUMP_EVENTS: -#ifndef DBUG_OFF - max_binlog_dump_events = atoi(argument); -#endif break; case (int) OPT_INIT_RPL_ROLE: { @@ -4197,7 +4142,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), } case (int) OPT_SLOW_QUERY_LOG: opt_slow_log=1; - opt_slow_logname=argument; break; case (int)OPT_RECKLESS_SLAVE: opt_reckless_slave = 1; @@ -4297,9 +4241,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case (int) OPT_PID_FILE: strmake(pidfile_name, argument, sizeof(pidfile_name)-1); break; - case (int) OPT_INIT_FILE: - opt_init_file=argument; - break; #ifdef __WIN__ case (int) OPT_STANDALONE: /* Dummy option for NT */ break; @@ -4331,7 +4272,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; } case OPT_SERVER_ID: - server_id = atoi(argument); server_id_supplied = 1; break; case OPT_DELAY_KEY_WRITE: @@ -4365,21 +4305,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; } #ifdef HAVE_BERKELEY_DB - case OPT_BDB_LOG: - berkeley_logdir=argument; - break; - case OPT_BDB_HOME: - berkeley_home=argument; - break; case OPT_BDB_NOSYNC: berkeley_env_flags|=DB_TXN_NOSYNC; break; case OPT_BDB_NO_RECOVER: berkeley_init_flags&= ~(DB_RECOVER); break; - case OPT_BDB_TMP: - berkeley_tmpdir=argument; - break; case OPT_BDB_LOCK: { int type; @@ -4420,15 +4351,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; #ifdef HAVE_INNOBASE_DB - case OPT_INNODB_DATA_HOME_DIR: - innobase_data_home_dir=argument; - break; - case OPT_INNODB_LOG_GROUP_HOME_DIR: - innobase_log_group_home_dir=argument; - break; - case OPT_INNODB_LOG_ARCH_DIR: - innobase_log_arch_dir=argument; - break; case OPT_INNODB_LOG_ARCHIVE: innobase_log_archive= argument ? test(atoi(argument)) : 1; break; @@ -4438,9 +4360,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case OPT_INNODB_FAST_SHUTDOWN: innobase_fast_shutdown= argument ? test(atoi(argument)) : 1; break; - case OPT_INNODB_FLUSH_METHOD: - innobase_unix_file_flush_method=argument; - break; #endif /* HAVE_INNOBASE_DB */ case OPT_MYISAM_RECOVER: { @@ -4476,48 +4395,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ISO_READ_COMMITTED); break; } - case OPT_MASTER_HOST: - master_host=argument; - break; - case OPT_MASTER_USER: - master_user=argument; - break; case OPT_MASTER_PASSWORD: master_password=argument; break; - case OPT_MASTER_INFO_FILE: - master_info_file=argument; - break; - case OPT_RELAY_LOG_INFO_FILE: - relay_log_info_file=argument; - break; - case OPT_MASTER_PORT: - master_port= atoi(argument); - break; - case OPT_MASTER_SSL_KEY: - master_ssl_key=argument; - break; - case OPT_MASTER_SSL_CERT: - master_ssl_cert=argument; - break; - case OPT_REPORT_HOST: - report_host=argument; - break; - case OPT_REPORT_USER: - report_user=argument; - break; - case OPT_REPORT_PASSWORD: - report_password=argument; - break; - case OPT_REPORT_PORT: - report_port= atoi(argument); - break; - case OPT_MASTER_CONNECT_RETRY: - master_connect_retry= atoi(argument); - break; - case OPT_MASTER_RETRY_COUNT: - master_retry_count= atoi(argument); - break; case OPT_SKIP_SAFEMALLOC: #ifdef SAFEMALLOC sf_malloc_quick=1; -- cgit v1.2.1 From 6057cb2cbfd91d12c88802555857f32772434566 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 May 2002 21:28:09 -0300 Subject: Fix VC++ compiler error --- sql/sql_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 588d60462b0..69b0f6bb3a5 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1071,7 +1071,7 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used) DUMP(this); for ( ; tables_used; tables_used=tables_used->next) { - invalidate_table(tables_used->key, tables_used->key_length); + invalidate_table((uchar *) tables_used->key, tables_used->key_length); DBUG_PRINT("qcache", (" db %s, table %s", tables_used->key, tables_used->table_name)); } -- cgit v1.2.1 From dcdb2a57902877bde6b5958825a29950019c2755 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 11:06:44 +0200 Subject: Fixed sql_yacc.yy to be compatible with bison 1.31 and above. Made detection of GNU tar a bit more flexible. Only use /usr/local/mysql-glibc if it actually exists Build-tools/Do-linux-build: Only use the "--with-other-libc" parameter, if another libc actually exists at this location Makefile.am: Removed hard-coded tar binary name configure.in: Added check for GNU tar with various names sql/sql_yacc.yy: Added semicolons to several expressions to make bison 1.31 and above happy when used in Yacc compatibility mode. From the bison NEWS: "Bison has always permitted actions such as { $$ = $1 }: it adds the ending semicolon. Now if in Yacc compatibility mode, the semicolon is no longer output: one has to write { $$ = $1; }." BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/sql_yacc.yy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sql') diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0cbf6f45194..c01532e48f7 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -726,7 +726,7 @@ opt_table_options: table_options: table_option { $$=$1; } - | table_option table_options { $$= $1 | $2 } + | table_option table_options { $$= $1 | $2; } table_option: TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; } @@ -1469,7 +1469,7 @@ simple_expr: (Item_func_match *)($$=new Item_func_match(*$2,$5))); } | BINARY expr %prec NEG { $$= new Item_func_binary($2); } | CASE_SYM opt_expr WHEN_SYM when_list opt_else END - { $$= new Item_func_case(* $4, $2, $5 ) } + { $$= new Item_func_case(* $4, $2, $5 ); } | FUNC_ARG0 '(' ')' { $$= ((Item*(*)(void))($1.symbol->create_func))();} | FUNC_ARG1 '(' expr ')' @@ -1696,7 +1696,7 @@ sum_expr: { $$=new Item_sum_sum($3); } in_sum_expr: - { Lex->in_sum_expr++ } + { Lex->in_sum_expr++; } expr { Lex->in_sum_expr--; @@ -1730,7 +1730,7 @@ opt_else: | ELSE expr { $$= $2; } when_list: - { Lex->when_list.push_front(new List) } + { Lex->when_list.push_front(new List); } when_list2 { $$= Lex->when_list.pop(); } @@ -1753,7 +1753,7 @@ opt_pad: join_table_list: '(' join_table_list ')' { $$=$2; } | join_table { $$=$1; } - | join_table_list normal_join join_table { $$=$3 } + | join_table_list normal_join join_table { $$=$3; } | join_table_list STRAIGHT_JOIN join_table { $$=$3 ; $$->straight=1; } | join_table_list INNER_SYM JOIN_SYM join_table ON expr { add_join_on($4,$6); $$=$4; } @@ -1808,7 +1808,7 @@ opt_key_definition: { Lex->ignore_index= *$2; Lex->ignore_index_ptr= &Lex->ignore_index;} key_usage_list: - key_or_index { Lex->interval_list.empty() } '(' key_usage_list2 ')' + key_or_index { Lex->interval_list.empty(); } '(' key_usage_list2 ')' { $$= &Lex->interval_list; } key_usage_list2: @@ -2287,7 +2287,7 @@ describe: YYABORT; } opt_describe_column - | describe_command select { Lex->options|= SELECT_DESCRIBE }; + | describe_command select { Lex->options|= SELECT_DESCRIBE; }; describe_command: @@ -2456,7 +2456,7 @@ literal: | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } | NULL_SYM { $$ = new Item_null(); Lex->next_state=STATE_OPERATOR_OR_IDENT;} - | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length)}; + | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length); } | DATE_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; } | TIMESTAMP text_literal { $$ = $2; } -- cgit v1.2.1 From 552102e35596c46e2bacc18a275aac444330b28b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 13:50:38 +0300 Subject: Features made for Schlund plus several bug fixes. Read a manual for more detail --- sql/lex.h | 3 + sql/sql_acl.cc | 108 +++++++++++++++++++++++++-------- sql/sql_acl.h | 4 +- sql/sql_class.cc | 2 +- sql/sql_class.h | 2 +- sql/sql_db.cc | 20 +++++-- sql/sql_lex.h | 3 +- sql/sql_parse.cc | 175 ++++++++++++++++++++++++++++++++++-------------------- sql/sql_select.cc | 9 +-- sql/sql_yacc.yy | 21 ++++++- sql/structs.h | 13 ++-- 11 files changed, 248 insertions(+), 112 deletions(-) (limited to 'sql') diff --git a/sql/lex.h b/sql/lex.h index 8c7beb64b9b..e03c4db6479 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -229,6 +229,8 @@ static SYMBOL symbols[] = { { "MASTER_USER", SYM(MASTER_USER_SYM),0,0}, { "MAX_ROWS", SYM(MAX_ROWS),0,0}, { "MAX_QUERIES_PER_HOUR", SYM(MAX_QUERIES_PER_HOUR), 0,0}, + { "MAX_UPDATES_PER_HOUR", SYM(MAX_UPDATES_PER_HOUR), 0,0}, + { "MAX_CONNECTIONS_PER_HOUR", SYM(MAX_CONNECTIONS_PER_HOUR), 0,0}, { "MATCH", SYM(MATCH),0,0}, { "MEDIUMBLOB", SYM(MEDIUMBLOB),0,0}, { "MEDIUMTEXT", SYM(MEDIUMTEXT),0,0}, @@ -290,6 +292,7 @@ static SYMBOL symbols[] = { { "REPEATABLE", SYM(REPEATABLE_SYM),0,0}, { "REQUIRE", SYM(REQUIRE_SYM),0,0}, { "RESET", SYM(RESET_SYM),0,0}, + { "USER_RESOURCES", SYM(RESOURCES),0,0}, { "RESTORE", SYM(RESTORE_SYM),0,0}, { "RESTRICT", SYM(RESTRICT),0,0}, { "RETURNS", SYM(UDF_RETURNS_SYM),0,0}, diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 104b431bdbb..4893028526f 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -58,7 +58,8 @@ class ACL_USER :public ACL_ACCESS { public: acl_host_and_ip host; - uint hostname_length, questions, updates; + uint hostname_length; + USER_RESOURCES user_resource; char *user,*password; ulong salt[2]; #ifdef HAVE_OPENSSL @@ -110,6 +111,32 @@ static void update_hostname(acl_host_and_ip *host, const char *hostname); static bool compare_hostname(const acl_host_and_ip *host, const char *hostname, const char *ip); +extern char uc_update_queries[SQLCOM_END]; + +static void init_update_queries(void) +{ + uc_update_queries[SQLCOM_CREATE_TABLE]=1; + uc_update_queries[SQLCOM_CREATE_INDEX]=1; + uc_update_queries[SQLCOM_ALTER_TABLE]=1; + uc_update_queries[SQLCOM_UPDATE]=1; + uc_update_queries[SQLCOM_INSERT]=1; + uc_update_queries[SQLCOM_INSERT_SELECT]=1; + uc_update_queries[SQLCOM_DELETE]=1; + uc_update_queries[SQLCOM_TRUNCATE]=1; + uc_update_queries[SQLCOM_DROP_TABLE]=1; + uc_update_queries[SQLCOM_LOAD]=1; + uc_update_queries[SQLCOM_CREATE_DB]=1; + uc_update_queries[SQLCOM_DROP_DB]=1; + uc_update_queries[SQLCOM_REPLACE]=1; + uc_update_queries[SQLCOM_REPLACE_SELECT]=1; + uc_update_queries[SQLCOM_RENAME_TABLE]=1; + uc_update_queries[SQLCOM_BACKUP_TABLE]=1; + uc_update_queries[SQLCOM_RESTORE_TABLE]=1; + uc_update_queries[SQLCOM_DELETE_MULTI]=1; + uc_update_queries[SQLCOM_DROP_INDEX]=1; + uc_update_queries[SQLCOM_MULTI_UPDATE]=1; +} + int acl_init(bool dont_read_acl_tables) { THD *thd; @@ -247,14 +274,16 @@ int acl_init(bool dont_read_acl_tables) { /* Table has new MySQL usage limits */ char *ptr = get_field(&mem, table, 21); - user.questions=atoi(ptr); + user.user_resource.questions=atoi(ptr); ptr = get_field(&mem, table, 22); - user.updates=atoi(ptr); - if (user.questions) + user.user_resource.updates=atoi(ptr); + ptr = get_field(&mem, table, 23); + user.user_resource.connections=atoi(ptr); + if (user.user_resource.questions || user.user_resource.updates || user.user_resource.connections) mqh_used=1; } else - user.questions=user.updates=0; + bzero(&(user.user_resource),sizeof(user.user_resource)); #ifndef TO_BE_REMOVED if (table->fields <= 13) { // Without grant @@ -299,6 +328,7 @@ int acl_init(bool dont_read_acl_tables) init_check_host(); mysql_unlock_tables(thd, lock); + init_update_queries(); thd->version--; // Force close to free memory close_thread_tables(thd); delete thd; @@ -442,13 +472,13 @@ static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b) uint acl_getroot(THD *thd, const char *host, const char *ip, const char *user, const char *password,const char *message,char **priv_user, - bool old_ver, uint *max_questions) + bool old_ver, USER_RESOURCES *mqh) { uint user_access=NO_ACCESS; *priv_user=(char*) user; char *ptr=0; - *max_questions=0; + bzero(mqh,sizeof(USER_RESOURCES)); if (!initialized) return (uint) ~NO_ACCESS; // If no data allow anything /* purecov: tested */ VOID(pthread_mutex_lock(&acl_cache->lock)); @@ -556,7 +586,7 @@ uint acl_getroot(THD *thd, const char *host, const char *ip, const char *user, #else /* HAVE_OPENSSL */ user_access=acl_user->access; #endif /* HAVE_OPENSSL */ - *max_questions=acl_user->questions; + *mqh=acl_user->user_resource; if (!acl_user->user) *priv_user=(char*) ""; // Change to anonymous user /* purecov: inspected */ break; @@ -590,7 +620,7 @@ static void acl_update_user(const char *user, const char *host, const char *ssl_cipher, const char *x509_issuer, const char *x509_subject, - unsigned int mqh, + USER_RESOURCES *mqh, uint privileges) { for (uint i=0 ; i < acl_users.elements ; i++) @@ -604,8 +634,8 @@ static void acl_update_user(const char *user, const char *host, acl_user->host.hostname && !strcmp(host,acl_user->host.hostname)) { acl_user->access=privileges; - acl_user->questions=mqh; -#ifdef HAVE_OPENSSL + acl_user->user_resource=*mqh; +#ifdef HAVE_OPENSSL acl_user->ssl_type=ssl_type; acl_user->ssl_cipher=ssl_cipher; acl_user->x509_issuer=x509_issuer; @@ -634,7 +664,7 @@ static void acl_insert_user(const char *user, const char *host, const char *ssl_cipher, const char *x509_issuer, const char *x509_subject, - unsigned int mqh, + USER_RESOURCES *mqh, uint privileges) { ACL_USER acl_user; @@ -642,7 +672,7 @@ static void acl_insert_user(const char *user, const char *host, update_hostname(&acl_user.host,strdup_root(&mem,host)); acl_user.password=0; acl_user.access=privileges; - acl_user.questions=mqh; + acl_user.user_resource = *mqh; acl_user.sort=get_sort(2,acl_user.host.hostname,acl_user.user); acl_user.hostname_length=(uint) strlen(acl_user.host.hostname); #ifdef HAVE_OPENSSL @@ -1151,7 +1181,14 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, DBUG_ENTER("replace_user_table"); if (combo.password.str && combo.password.str[0]) + { + if (combo.password.length <= HASH_PASSWORD_LENGTH) + { + send_error(&thd->net, ER_PASSWORD_NO_MATCH); + DBUG_RETURN(1); + } password=combo.password.str; + } else { password=empty_string; @@ -1233,10 +1270,16 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, } } #endif /* HAVE_OPENSSL */ - if (table->fields >= 23 && thd->lex.mqh) + if (table->fields >= 23) { - table->field[21]->store((longlong) thd->lex.mqh); - mqh_used=1; + USER_RESOURCES mqh = thd->lex.mqh; + if (mqh.questions) + table->field[21]->store((longlong) mqh.questions); + if (mqh.updates) + table->field[22]->store((longlong) mqh.updates); + if (mqh.connections) + table->field[23]->store((longlong) mqh.connections); + mqh_used = mqh_used || mqh.questions || mqh.updates || mqh.connections; } if (old_row_exists) { @@ -1276,7 +1319,7 @@ end: thd->lex.ssl_cipher, thd->lex.x509_issuer, thd->lex.x509_subject, - thd->lex.mqh, + &thd->lex.mqh, rights); else acl_insert_user(combo.user.str,combo.host.str,password, @@ -1284,7 +1327,7 @@ end: thd->lex.ssl_cipher, thd->lex.x509_issuer, thd->lex.x509_subject, - thd->lex.mqh, + &thd->lex.mqh, rights); } table->file->index_end(); @@ -2691,11 +2734,25 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) #endif /* HAVE_OPENSSL */ if (want_access & GRANT_ACL) global.append(" WITH GRANT OPTION",18); - else if (acl_user->questions) + if (acl_user->user_resource.questions) { char buff[65], *p; // just as in int2str global.append(" WITH MAX_QUERIES_PER_HOUR = ",29); - p=int2str(acl_user->questions,buff,10); + p=int2str(acl_user->user_resource.questions,buff,10); + global.append(buff,p-buff); + } + if (acl_user->user_resource.updates) + { + char buff[65], *p; // just as in int2str + global.append(" WITH MAX_UPDATES_PER_HOUR = ",29); + p=int2str(acl_user->user_resource.updates,buff,10); + global.append(buff,p-buff); + } + if (acl_user->user_resource.connections) + { + char buff[65], *p; // just as in int2str + global.append(" WITH MAX_CONNECTIONS_PER_HOUR = ",33); + p=int2str(acl_user->user_resource.connections,buff,10); global.append(buff,p-buff); } thd->packet.length(0); @@ -2860,16 +2917,17 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) } -uint get_mqh(const char *user, const char *host) +void get_mqh(const char *user, const char *host, USER_CONN *uc) { - if (!initialized) return 0; - ACL_USER *acl_user; - acl_user= find_acl_user(host,user); - return (acl_user) ? acl_user->questions : 0; + if (initialized && (acl_user= find_acl_user(host,user))) + uc->user_resources= acl_user->user_resource; + else + bzero((char*) &uc->user_resources, sizeof(uc->user_resources)); } + /***************************************************************************** ** Instantiate used templates *****************************************************************************/ diff --git a/sql/sql_acl.h b/sql/sql_acl.h index f118ac17789..9ac3bc6ed74 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -61,7 +61,7 @@ uint acl_get(const char *host, const char *ip, const char *bin_ip, const char *user, const char *db); uint acl_getroot(THD *thd, const char *host, const char *ip, const char *user, const char *password,const char *scramble,char **priv_user, - bool old_ver, uint *max); + bool old_ver, USER_RESOURCES *max); bool acl_check_host(const char *host, const char *ip); bool change_password(THD *thd, const char *host, const char *user, char *password); @@ -82,4 +82,4 @@ bool check_grant_db(THD *thd,const char *db); uint get_table_grant(THD *thd, TABLE_LIST *table); uint get_column_grant(THD *thd, TABLE_LIST *table, Field *field); int mysql_show_grants(THD *thd, LEX_USER *user); -uint get_mqh(const char *user, const char *host); +void get_mqh(const char *user, const char *host, USER_CONN *uc); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 03bb8ae2c97..c332181b410 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -147,7 +147,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), /* Initialize sub structures */ bzero((char*) &mem_root,sizeof(mem_root)); bzero((char*) &transaction.mem_root,sizeof(transaction.mem_root)); - user_connect=(UC *)0; + user_connect=(USER_CONN *)0; hash_init(&user_vars, USER_VARS_HASH_SIZE, 0, 0, (hash_get_key) get_var_key, (void (*)(void*)) free_var,0); diff --git a/sql/sql_class.h b/sql/sql_class.h index e755deeea61..31da5c53bf8 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -382,7 +382,7 @@ public: ha_rows select_limit,offset_limit,default_select_limit,cuted_fields, max_join_size, sent_row_count, examined_row_count; table_map used_tables; - UC *user_connect; + USER_CONN *user_connect; ulong query_id,version, inactive_timeout,options,thread_id; long dbug_thread_id; pthread_t real_id; diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 9f521ac5ffd..9198cb4ba82 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -283,13 +283,20 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, */ if (!found_other_files) { - char tmp_path[FN_REFLEN]; + char tmp_path[FN_REFLEN], *pos; char *path=unpack_filename(tmp_path,org_path); #ifdef HAVE_READLINK - int linkcount = readlink(path,filePath,sizeof(filePath)-1); - if (linkcount > 0) // If the path was a symbolic link + int error; + + /* Remove end FN_LIBCHAR as this causes problem on Linux in readlink */ + pos=strend(path); + if (pos > path && pos[-1] == FN_LIBCHAR) + *--pos=0; + + if ((error=my_readlink(filePath, path, MYF(MY_WME))) < 0) + DBUG_RETURN(-1); + if (!error) { - *(filePath + linkcount) = '\0'; if (my_delete(path,MYF(!level ? MY_WME : 0))) { /* Don't give errors if we can't delete 'RAID' directory */ @@ -297,11 +304,12 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, DBUG_RETURN(deleted); DBUG_RETURN(-1); } - path=filePath; + /* Delete directory symbolic link pointed at */ + path= filePath; } #endif /* Remove last FN_LIBCHAR to not cause a problem on OS/2 */ - char *pos=strend(path); + pos=strend(path); if (pos > path && pos[-1] == FN_LIBCHAR) *--pos=0; /* Don't give errors if we can't delete 'RAID' directory */ diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 6961ab8c712..8713e8f0be7 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -176,6 +176,7 @@ typedef struct st_lex { HA_CHECK_OPT check_opt; // check/repair options HA_CREATE_INFO create_info; LEX_MASTER_INFO mi; // used by CHANGE MASTER + USER_RESOURCES mqh; ulong thread_id,type; enum_sql_command sql_command; enum lex_states next_state; @@ -184,7 +185,7 @@ typedef struct st_lex { enum enum_ha_read_modes ha_read_mode; enum ha_rkey_function ha_rkey_mode; enum enum_enable_or_disable alter_keys_onoff; - uint grant,grant_tot_col,which_columns, union_option, mqh; + uint grant,grant_tot_col,which_columns, union_option; thr_lock_type lock_option; bool drop_primary,drop_if_exists,local_file; bool in_comment,ignore_space,verbose,simple_alter, option_type; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index dc89888a1a5..af68c1bb9f3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -59,9 +59,9 @@ extern "C" pthread_mutex_t THR_LOCK_keycache; extern "C" int gethostname(char *name, int namelen); #endif -static int check_for_max_user_connections(UC *uc); +static int check_for_max_user_connections(USER_CONN *uc); static bool check_mqh(THD *thd); -static void decrease_user_connections(UC *uc); +static void decrease_user_connections(USER_CONN *uc); static bool check_db_used(THD *thd,TABLE_LIST *tables); static bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *tables); static bool check_dup(const char *db, const char *name, TABLE_LIST *tables); @@ -126,18 +126,19 @@ extern pthread_mutex_t LOCK_user_conn; static int get_or_create_user_conn(THD *thd, const char *user, const char *host, - uint max_questions) + USER_RESOURCES *mqh) { int return_val=0; - uint temp_len; + uint temp_len, user_len, host_len; char temp_user[USERNAME_LENGTH+HOSTNAME_LENGTH+2]; struct user_conn *uc; DBUG_ASSERT(user != 0); DBUG_ASSERT(host != 0); - temp_len= (uint) (strxnmov(temp_user, sizeof(temp_user)-1, user, "@", host, - NullS) - temp_user); + user_len=strlen(user); + host_len=strlen(host); + temp_len= (strmov(strmov(temp_user, user)+1, host) - temp_user)+1; (void) pthread_mutex_lock(&LOCK_user_conn); if (!(uc = (struct user_conn *) hash_search(&hash_user_connections, (byte*) temp_user, temp_len))) @@ -153,10 +154,14 @@ static int get_or_create_user_conn(THD *thd, const char *user, } uc->user=(char*) (uc+1); memcpy(uc->user,temp_user,temp_len+1); + uc->user_len= user_len; + uc->host=uc->user + uc->user_len + 1; uc->len = temp_len; - uc->connections = 1; - uc->questions=0; - uc->max_questions=max_questions; + uc->connections = 1; + uc->questions=uc->updates=uc->conn_per_hour=0; + uc->user_resources=*mqh; + if (mqh->connections > max_user_connections) + uc->user_resources.connections = max_user_connections; uc->intime=thd->thr_create_time; if (hash_insert(&hash_user_connections, (byte*) uc)) { @@ -184,9 +189,9 @@ static bool check_user(THD *thd,enum_server_command command, const char *user, const char *passwd, const char *db, bool check_count) { NET *net= &thd->net; - uint max_questions=0; thd->db=0; thd->db_length=0; + USER_RESOURCES ur; if (!(thd->user = my_strdup(user, MYF(0)))) { @@ -197,7 +202,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user, passwd, thd->scramble, &thd->priv_user, protocol_version == 9 || !(thd->client_capabilities & - CLIENT_LONG_PASSWORD),&max_questions); + 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, @@ -237,9 +242,9 @@ static bool check_user(THD *thd,enum_server_command command, const char *user, db ? db : (char*) ""); thd->db_access=0; /* Don't allow user to connect if he has done too many queries */ - if ((max_questions || max_user_connections) && get_or_create_user_conn(thd,user,thd->host_or_ip,max_questions)) + if ((ur.questions || ur.updates || ur.connections) && get_or_create_user_conn(thd,user,thd->host_or_ip,&ur)) return -1; - if (max_user_connections && thd->user_connect && + if (thd->user_connect && thd->user_connect->user_resources.connections && check_for_max_user_connections(thd->user_connect)) return -1; if (db && db[0]) @@ -279,32 +284,43 @@ void init_max_user_conn(void) } -static int check_for_max_user_connections(UC *uc) +static int check_for_max_user_connections(USER_CONN *uc) { int error=0; DBUG_ENTER("check_for_max_user_connections"); - if (max_user_connections <= (uint) uc->connections) + if (max_user_connections && ( max_user_connections <= (uint) uc->connections)) { net_printf(&(current_thd->net),ER_TOO_MANY_USER_CONNECTIONS, uc->user); error=1; goto end; } uc->connections++; - +if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections) + { + net_printf(¤t_thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_connections", + (long) uc->user_resources.connections); + error=1; + goto end; + } end: DBUG_RETURN(error); } -static void decrease_user_connections(UC *uc) +static void decrease_user_connections(USER_CONN *uc) { - if (!max_user_connections) +/* if (!max_user_connections) return; +*/ DBUG_ENTER("decrease_user_connections"); - - if (!--uc->connections && !mqh_used) + if (mqh_used) + { + if (uc->conn_per_hour) + uc->conn_per_hour--; + } + else if (!--uc->connections) { /* Last connection for user; Delete it */ (void) pthread_mutex_lock(&LOCK_user_conn); @@ -325,70 +341,92 @@ void free_max_user_conn(void) Check if maximum queries per hour limit has been reached returns 0 if OK. - In theory we would need a mutex in the UC structure for this to be 100 % + In theory we would need a mutex in the USER_CONN structure for this to be 100 % safe, but as the worst scenario is that we would miss counting a couple of queries, this isn't critical. */ +char uc_update_queries[SQLCOM_END]; + static bool check_mqh(THD *thd) { bool error=0; DBUG_ENTER("check_mqh"); - UC *uc=thd->user_connect; + USER_CONN *uc=thd->user_connect; DBUG_ASSERT(uc != 0); + uint check_command = thd->lex.sql_command; + - bool my_start = thd->start_time != 0; - time_t check_time = (my_start) ? thd->start_time : time(NULL); - if (check_time - uc->intime >= 3600) + if (check_command < (uint) SQLCOM_END) { - (void) pthread_mutex_lock(&LOCK_user_conn); - uc->questions=1; - uc->intime=check_time; - (void) pthread_mutex_unlock(&LOCK_user_conn); + if (uc->user_resources.updates && uc_update_queries[check_command] && + ++(uc->updates) > uc->user_resources.updates) + { + net_printf(&thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_updates", + (long) uc->user_resources.updates); + error=1; + goto end; + } } - else if (uc->max_questions && ++(uc->questions) > uc->max_questions) + else { - net_printf(&thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_questions", - (long) uc->max_questions); - error=1; - goto end; + bool my_start = thd->start_time != 0; + time_t check_time = (my_start) ? thd->start_time : time(NULL); + + if (check_time - uc->intime >= 3600) + { + (void) pthread_mutex_lock(&LOCK_user_conn); + uc->questions=1; + uc->updates=0; + uc->conn_per_hour=0; + uc->intime=check_time; + (void) pthread_mutex_unlock(&LOCK_user_conn); + } + else if (uc->user_resources.questions && ++(uc->questions) > uc->user_resources.questions) + { + net_printf(&thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_questions", + (long) uc->user_resources.questions); + error=1; + goto end; + } } - end: DBUG_RETURN(error); } -static void reset_mqh(THD *thd, LEX_USER *lu, uint mq) +static void reset_mqh(THD *thd, LEX_USER *lu, USER_RESOURCES *mqh, bool get_them=false) { (void) pthread_mutex_lock(&LOCK_user_conn); if (lu) // for GRANT { - UC *uc; + USER_CONN *uc; uint temp_len=lu->user.length+lu->host.length+2; char temp_user[USERNAME_LENGTH+HOSTNAME_LENGTH+2]; memcpy(temp_user,lu->user.str,lu->user.length); memcpy(temp_user+lu->user.length+1,lu->host.str,lu->host.length); - temp_user[lu->user.length]=temp_user[temp_len-1]=0; + temp_user[lu->user.length]='\0'; temp_user[temp_len-1]=0; if ((uc = (struct user_conn *) hash_search(&hash_user_connections, - (byte*) temp_user, temp_len))) + (byte*) temp_user, temp_len-1))) { uc->questions=0; - uc->max_questions=mq; + uc->user_resources=*mqh; + uc->updates=0; + uc->conn_per_hour=0; } } - else // for FLUSH PRIVILEGES + else // for FLUSH PRIVILEGES and FLUSH USER_RESOURCES { for (uint idx=0;idx < hash_user_connections.records; idx++) { - char user[USERNAME_LENGTH+1]; - char *where; - UC *uc=(struct user_conn *) hash_element(&hash_user_connections, idx); - where=strchr(uc->user,'@'); - strmake(user,uc->user,where - uc->user); - uc->max_questions=get_mqh(user,where+1); + USER_CONN *uc=(struct user_conn *) hash_element(&hash_user_connections, idx); + if (get_them) + get_mqh(uc->user,uc->host,uc); + uc->questions=0; + uc->updates=0; + uc->conn_per_hour=0; } } (void) pthread_mutex_unlock(&LOCK_user_conn); @@ -708,7 +746,7 @@ pthread_handler_decl(handle_bootstrap,arg) thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1); thd->query[length] = '\0'; thd->query_id=query_id++; - if (thd->user_connect && check_mqh(thd)) + if (mqh_used && thd->user_connect && check_mqh(thd)) { thd->net.error = 0; close_thread_tables(thd); // Free tables @@ -895,7 +933,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, char *save_user= thd->user; char *save_priv_user= thd->priv_user; char *save_db= thd->db; - UC *save_uc= thd->user_connect; + USER_CONN *save_uc= thd->user_connect; if ((uint) ((uchar*) db - net->read_pos) > packet_length) { // Check if protocol is ok @@ -948,7 +986,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, my_pthread_setprio(pthread_self(),QUERY_PRIOR); mysql_log.write(thd,command,"%s",thd->query); DBUG_PRINT("query",("%s",thd->query)); - if (thd->user_connect && check_mqh(thd)) + if (mqh_used && thd->user_connect && check_mqh(thd)) { error = TRUE; // Abort client net->error = 0; // Don't give abort message @@ -1073,8 +1111,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd, send_error(net,0); else send_eof(net); - if (mqh_used) - reset_mqh(thd,(LEX_USER *) NULL, 0); break; } case COM_SHUTDOWN: @@ -2316,12 +2352,12 @@ mysql_execute_command(void) Query_log_event qinfo(thd, thd->query); mysql_bin_log.write(&qinfo); } - if (mqh_used && lex->mqh) + if (mqh_used && (lex->mqh.questions || lex->mqh.updates || lex->mqh.connections) && lex->sql_command == SQLCOM_GRANT) { List_iterator str_list(lex->users_list); LEX_USER *user; while ((user=str_list++)) - reset_mqh(thd,user,lex->mqh); + reset_mqh(thd,user,&(lex->mqh)); } } } @@ -2727,8 +2763,15 @@ mysql_parse(THD *thd,char *inBuf,uint length) LEX *lex=lex_start(thd, (uchar*) inBuf, length); if (!yyparse() && ! thd->fatal_error) { - mysql_execute_command(); - query_cache_end_of_result(&thd->net); + if (mqh_used && thd->user_connect && check_mqh(thd)) + { + thd->net.error = 0; + } + else + { + mysql_execute_command(); + query_cache_end_of_result(&thd->net); + } } else query_cache_abort(&thd->net); @@ -3272,6 +3315,8 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) { acl_reload(); grant_reload(); + if (mqh_used) + reset_mqh(thd,(LEX_USER *) NULL, 0, true); } if (options & REFRESH_LOG) { @@ -3318,14 +3363,16 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) result=load_des_key_file(des_key_file); } #endif - if (options & REFRESH_SLAVE) - { - LOCK_ACTIVE_MI; - if (reset_slave(active_mi)) - result=1; - UNLOCK_ACTIVE_MI; - } - return result; + if (options & REFRESH_SLAVE) + { + LOCK_ACTIVE_MI; + if (reset_slave(active_mi)) + result=1; + UNLOCK_ACTIVE_MI; + } + if (options & REFRESH_USER_RESOURCES) + reset_mqh(thd,(LEX_USER *) NULL, 0); + return result; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 18f256d9edb..94d89ffe05e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -501,8 +501,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List &fields,COND *conds, select_distinct=0; } else if (select_distinct && join.tables - join.const_tables == 1 && - (thd->select_limit == HA_POS_ERROR || - (join.select_options & OPTION_FOUND_ROWS) || + ((thd->select_limit == HA_POS_ERROR || + (join.select_options & OPTION_FOUND_ROWS)) && order && !(skip_sort_order= test_if_skip_sort_order(&join.join_tab[join.const_tables], @@ -2363,7 +2363,7 @@ make_simple_join(JOIN *join,TABLE *tmp_table) join->send_records=(ha_rows) 0; join->group=0; join->do_send_rows = 1; - join->row_limit=HA_POS_ERROR; + join->row_limit=join->thd->select_limit; join_tab->cache.buff=0; /* No cacheing */ join_tab->table=tmp_table; @@ -4899,7 +4899,7 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), JOIN_TAB *jt=join->join_tab; if ((join->tables == 1) && !join->tmp_table && !join->sort_and_group && !join->send_group_parts && !join->having && !jt->select_cond && - !(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT)) + !(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT) && (jt->records < INT_MAX32)) { /* Join over all rows in table; Return number of found rows */ join->select_options ^= OPTION_FOUND_ROWS; @@ -6990,6 +6990,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, /* Don't log this into the slow query log */ select_lex->options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED); + thd->offset_limit=0; if (thd->lex.select == select_lex) { field_list.push_back(new Item_empty_string("table",NAME_LEN)); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8012768e508..ea1a227750e 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -245,7 +245,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token RELAY_LOG_POS_SYM %token MATCH %token MAX_ROWS +%token MAX_CONNECTIONS_PER_HOUR %token MAX_QUERIES_PER_HOUR +%token MAX_UPDATES_PER_HOUR %token MEDIUM_SYM %token MERGE_SYM %token MIN_ROWS @@ -289,6 +291,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token RENAME %token REPEATABLE_SYM %token REQUIRE_SYM +%token RESOURCES %token RESTORE_SYM %token RESTRICT %token REVOKE @@ -2714,6 +2717,7 @@ flush_option: | SLAVE { Lex->type|= REFRESH_SLAVE; } | MASTER_SYM { Lex->type|= REFRESH_MASTER; } | DES_KEY_FILE { Lex->type|= REFRESH_DES_KEY_FILE; } + | RESOURCES { Lex->type|= REFRESH_USER_RESOURCES; } opt_table_list: /* empty */ {} @@ -3040,7 +3044,9 @@ keyword: | MASTER_USER_SYM {} | MASTER_PASSWORD_SYM {} | MASTER_CONNECT_RETRY_SYM {} + | MAX_CONNECTIONS_PER_HOUR {} | MAX_QUERIES_PER_HOUR {} + | MAX_UPDATES_PER_HOUR {} | MEDIUM_SYM {} | MERGE_SYM {} | MINUTE_SYM {} @@ -3074,6 +3080,7 @@ keyword: | REPAIR {} | REPEATABLE_SYM {} | RESET_SYM {} + | RESOURCES {} | RESTORE_SYM {} | ROLLBACK_SYM {} | ROWS_SYM {} @@ -3443,7 +3450,7 @@ grant: lex->select->db=0; lex->ssl_type=SSL_TYPE_NONE; lex->ssl_cipher=lex->x509_subject=lex->x509_issuer=0; - lex->mqh=0; + bzero(&(lex->mqh),sizeof(lex->mqh)); } grant_privileges ON opt_table TO_SYM user_list require_clause grant_options @@ -3643,9 +3650,17 @@ grant_option_list: grant_option: GRANT OPTION { Lex->grant |= GRANT_ACL;} - | MAX_QUERIES_PER_HOUR EQ NUM + | MAX_QUERIES_PER_HOUR EQ ULONG_NUM { - Lex->mqh=atoi($3.str); + Lex->mqh.questions=$3; + } + | MAX_UPDATES_PER_HOUR EQ ULONG_NUM + { + Lex->mqh.updates=$3; + } + | MAX_CONNECTIONS_PER_HOUR EQ ULONG_NUM + { + Lex->mqh.connections=$3; } begin: diff --git a/sql/structs.h b/sql/structs.h index 2250ea784f2..75280b34715 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -162,13 +162,16 @@ typedef struct st_lex_user { } LEX_USER; +typedef struct user_resources { + uint questions, updates, connections; +} USER_RESOURCES; + typedef struct user_conn { - char *user; - uint len, connections, questions, max_questions; + char *user, *host; + uint len, connections, conn_per_hour, updates, questions, user_len; + USER_RESOURCES user_resources; time_t intime; -} UC; - - +} USER_CONN; /* Bits in form->update */ #define REG_MAKE_DUPP 1 /* Make a copy of record when read */ #define REG_NEW_RECORD 2 /* Write a new record if not found */ -- cgit v1.2.1 From a2d3a9c687a07b454385c33893c8c125e5e332e7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 16:36:41 +0300 Subject: Removed some long from mysqld comments (should be in manual). Docs/manual.texi: Updated information about --temp-pool libmysql/libmysql.c: Call my_end() at exit libmysqld/lib_sql.cc: Call my_end() at exit sql/mysqld.cc: Removed some long comments (should be in manual). --- sql/mysqld.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 372a09c9788..61622556d4f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3211,7 +3211,7 @@ static struct my_option my_long_options[] = (gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS, - "Tells the slave thread to continue replication when a query returns an error from the provided list. Normally, replication will discontinue when an error is encountered, giving the user a chance to resolve the inconsistency in the data manually. Do not use this option unless you fully understand why you are getting the errors. If there are no bugs in your replication setup and client programs, and no bugs in MySQL itself, you should never get an abort with error. Indiscriminate use of this option will result in slaves being hopelessly out of sync with the master and you having no idea how the problem happened. For error codes, you should use the numbers provided by the error message in your slave error log and in the output of SHOW SLAVE STATUS. Full list of error messages can be found in the source distribution in `Docs/mysqld_error.txt'. You can (but should not) also use a very non-recommended value of all which will ignore all error messages and keep barging along regardless. Needless to say, if you use it, we make no promises regarding your data integrity. Please do not complain if your data on the slave is not anywhere close to what it is on the master in this case -- you have been warned. Example: slave-skip-errors=1062,1053 or slave-skip-errors=all", + "Tells the slave thread to continue replication when a query returns an error from the provided list", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"socket", OPT_SOCKET, "Socket file to use for connection", (gptr*) &mysql_unix_port, (gptr*) &mysql_unix_port, 0, GET_STR, @@ -3227,18 +3227,18 @@ static struct my_option my_long_options[] = #ifdef HAVE_OPENSSL #include "sslopt-longopts.h" #endif - {"transaction-isolation", OPT_TX_ISOLATION, - "Default transaction isolation level", (gptr*) &default_tx_isolation_name, - (gptr*) &default_tx_isolation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, - 0, 0}, {"temp-pool", OPT_TEMP_POOL, - "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file. This is to work around a problem in the Linux kernel dealing with creating a bunch of new files with different names. With the old behavior, Linux seems to 'leak' memory, as it's being allocated to the directory entry cache instead of the disk cache.", + "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.", (gptr*) &use_temp_pool, (gptr*) &use_temp_pool, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files", (gptr*) &mysql_tmpdir, (gptr*) &mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"use-locking", OPT_USE_LOCKING, "Use system locking", 0, 0, 0, GET_NO_ARG, - NO_ARG, 0, 0, 0, 0, 0, 0}, + {"transaction-isolation", OPT_TX_ISOLATION, + "Default transaction isolation level", (gptr*) &default_tx_isolation_name, + (gptr*) &default_tx_isolation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, + 0, 0}, + {"use-locking", OPT_USE_LOCKING, "Use system (external) locking", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef USE_SYMDIR {"use-symbolic-links", 's', "Enable symbolic link support", (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, 0, 0, -- cgit v1.2.1 From df3182b5516485bc3137e21bc7f03a20086a8e7c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 18:41:36 +0300 Subject: Fixed some things to make MySQL to compile again. libmysqld/lib_sql.cc: Fix to make the embedded server compile with the new USER_REOSURCEs. sql/sql_acl.cc: Fixed wrong test in password checking. sql/sql_cache.cc: Fixed wrong cast sql/sql_parse.cc: Cleanup --- sql/sql_acl.cc | 9 +++------ sql/sql_cache.cc | 2 +- sql/sql_parse.cc | 4 +++- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'sql') diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 97cd02e5032..9c2eb9feb69 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1180,20 +1180,17 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, char *password,empty_string[1]; DBUG_ENTER("replace_user_table"); + password=empty_string; + empty_string[0]=0; if (combo.password.str && combo.password.str[0]) { - if (combo.password.length <= HASH_PASSWORD_LENGTH) + if (combo.password.length != HASH_PASSWORD_LENGTH) { send_error(&thd->net, ER_PASSWORD_NO_MATCH); DBUG_RETURN(1); } password=combo.password.str; } - else - { - password=empty_string; - empty_string[0]=0; - } table->field[0]->store(combo.host.str,combo.host.length); table->field[1]->store(combo.user.str,combo.user.length); diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 69b0f6bb3a5..87ca7003b7b 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1071,7 +1071,7 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used) DUMP(this); for ( ; tables_used; tables_used=tables_used->next) { - invalidate_table((uchar *) tables_used->key, tables_used->key_length); + invalidate_table((byte*) tables_used->key, tables_used->key_length); DBUG_PRINT("qcache", (" db %s, table %s", tables_used->key, tables_used->table_name)); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index af68c1bb9f3..315c4b85a1c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -242,7 +242,8 @@ static bool check_user(THD *thd,enum_server_command command, const char *user, db ? db : (char*) ""); thd->db_access=0; /* Don't allow user to connect if he has done too many queries */ - if ((ur.questions || ur.updates || ur.connections) && get_or_create_user_conn(thd,user,thd->host_or_ip,&ur)) + if ((ur.questions || ur.updates || ur.connections) && + get_or_create_user_conn(thd,user,thd->host_or_ip,&ur)) return -1; if (thd->user_connect && thd->user_connect->user_resources.connections && check_for_max_user_connections(thd->user_connect)) @@ -259,6 +260,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user, return 0; // ok } + /* Check for maximum allowable user connections, if the mysqld server is started with corresponding variable that is greater then 0. -- cgit v1.2.1 From a4c1ba532545390058102d6eb5a2443927e8a7c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 20:24:00 +0300 Subject: Changed GET_STRALC to GET_STR_ALLOC mysys/my_getopt.c: Changed GET_STRALC to GET_STR_ALLOC Added error checking for my_strdup() --- sql/mysqld.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 61622556d4f..afc68a3d29e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2977,7 +2977,7 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0, 0}, {"log-bin", OPT_BIN_LOG, "Log queries in new binary format (for replication)", - (gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STRALC, + (gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-bin-index", OPT_BIN_LOG_INDEX, "File that holds the names for last binary log files", @@ -3139,7 +3139,7 @@ static struct my_option my_long_options[] = REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"relay-log", OPT_RELAY_LOG, "Undocumented", (gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0, - GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"relay-log-index", OPT_RELAY_LOG_INDEX, "Undocumented", (gptr*) &opt_relaylog_index_name, (gptr*) &opt_relaylog_index_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -3208,7 +3208,7 @@ static struct my_option my_long_options[] = (gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "Undocumented", - (gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STRALC, + (gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS, "Tells the slave thread to continue replication when a query returns an error from the provided list", -- cgit v1.2.1 From cae95ac0cde82c606e71b09d8dcd79c4cf4f6f0f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 May 2002 12:51:46 +0200 Subject: "repair ... use_frm" crash fixed --- sql/sql_table.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sql') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index dcbfd709f97..4316acfa47d 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -934,20 +934,19 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table, else { - char from[FN_REFLEN],to[FN_REFLEN]; + char from[FN_REFLEN],tmp[FN_REFLEN]; char* db = thd->db ? thd->db : table->db; sprintf(from, "%s/%s/%s", mysql_real_data_home, db, table->name); fn_format(from, from, "", MI_NAME_DEXT, 4); - sprintf(to,"%s-%lx_%lx", from, current_pid, thd->thread_id); + sprintf(tmp,"%s-%lx_%lx", from, current_pid, thd->thread_id); - - my_rename(to, from, MYF(MY_WME)); + close_cached_table(thd,table->table); if (lock_and_wait_for_table_name(thd,table)) DBUG_RETURN(-1); - if (my_rename(from, to, MYF(MY_WME))) + if (my_rename(from, tmp, MYF(MY_WME))) { unlock_table_name(thd, table); DBUG_RETURN(send_check_errmsg(thd, table, "repair", @@ -959,7 +958,7 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table, DBUG_RETURN(send_check_errmsg(thd, table, "repair", "Failed generating table from .frm file")); } - if (my_rename(to, from, MYF(MY_WME))) + if (my_rename(tmp, from, MYF(MY_WME))) { unlock_table_name(thd, table); DBUG_RETURN(send_check_errmsg(thd, table, "repair", -- cgit v1.2.1 From 002e76fb8d868d7105c47de3388f0ab08d8e396d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 May 2002 16:06:57 +0300 Subject: Fix bug in SELECT SQL_CALC_FOUND_ROWS Docs/manual.texi: Update of new GRANT options libmysql/manager.c: Use new my_gethostbyname_r() functions mysql-test/r/select_found.result: new test case mysql-test/t/select_found.test: new test case sql/mysqld.cc: Change names of some status variables --- sql/mysqld.cc | 50 +++++++++++++++++++++++++------------------------- sql/sql_select.cc | 18 +++++++++--------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 61622556d4f..c27d2854939 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3734,12 +3734,12 @@ struct show_var_st status_vars[]= { {"Com_show_grants", (char*) (com_stat+(uint) SQLCOM_SHOW_GRANTS),SHOW_LONG}, {"Com_show_keys", (char*) (com_stat+(uint) SQLCOM_SHOW_KEYS),SHOW_LONG}, {"Com_show_logs", (char*) (com_stat+(uint) SQLCOM_SHOW_LOGS),SHOW_LONG}, - {"Com_show_master_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG}, + {"Com_show_master_status", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG}, {"Com_show_new_master", (char*) (com_stat+(uint) SQLCOM_SHOW_NEW_MASTER),SHOW_LONG}, {"Com_show_open_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_OPEN_TABLES),SHOW_LONG}, {"Com_show_processlist", (char*) (com_stat+(uint) SQLCOM_SHOW_PROCESSLIST),SHOW_LONG}, {"Com_show_slave_hosts", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_HOSTS),SHOW_LONG}, - {"Com_show_slave_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG}, + {"Com_show_slave_status", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG}, {"Com_show_status", (char*) (com_stat+(uint) SQLCOM_SHOW_STATUS),SHOW_LONG}, {"Com_show_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLES),SHOW_LONG}, {"Com_show_variables", (char*) (com_stat+(uint) SQLCOM_SHOW_VARIABLES),SHOW_LONG}, @@ -3807,29 +3807,29 @@ struct show_var_st status_vars[]= { {"Sort_rows", (char*) &filesort_rows, SHOW_LONG}, {"Sort_scan", (char*) &filesort_scan_count, SHOW_LONG}, #ifdef HAVE_OPENSSL - {"ssl_accepts", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT}, - {"ssl_finished_accepts", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT_GOOD}, - {"ssl_finished_connects", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT_GOOD}, - {"ssl_accept_renegotiates", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT_RENEGOTIATE}, - {"ssl_connect_renegotiates", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT_RENEGOTIATE}, - {"ssl_callback_cache_hits", (char*) 0, SHOW_SSL_CTX_SESS_CB_HITS}, - {"ssl_session_cache_hits", (char*) 0, SHOW_SSL_CTX_SESS_HITS}, - {"ssl_session_cache_misses", (char*) 0, SHOW_SSL_CTX_SESS_MISSES}, - {"ssl_session_cache_timeouts", (char*) 0, SHOW_SSL_CTX_SESS_TIMEOUTS}, - {"ssl_used_session_cache_entries",(char*) 0, SHOW_SSL_CTX_SESS_NUMBER}, - {"ssl_client_connects", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT}, - {"ssl_session_cache_overflows", (char*) 0, SHOW_SSL_CTX_SESS_CACHE_FULL}, - {"ssl_session_cache_size", (char*) 0, SHOW_SSL_CTX_SESS_GET_CACHE_SIZE}, - {"ssl_session_cache_mode", (char*) 0, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE}, - {"ssl_sessions_reused", (char*) 0, SHOW_SSL_SESSION_REUSED}, - {"ssl_ctx_verify_mode", (char*) 0, SHOW_SSL_CTX_GET_VERIFY_MODE}, - {"ssl_ctx_verify_depth", (char*) 0, SHOW_SSL_CTX_GET_VERIFY_DEPTH}, - {"ssl_verify_mode", (char*) 0, SHOW_SSL_GET_VERIFY_MODE}, - {"ssl_verify_depth", (char*) 0, SHOW_SSL_GET_VERIFY_DEPTH}, - {"ssl_version", (char*) 0, SHOW_SSL_GET_VERSION}, - {"ssl_cipher", (char*) 0, SHOW_SSL_GET_CIPHER}, - {"ssl_cipher_list", (char*) 0, SHOW_SSL_GET_CIPHER_LIST}, - {"ssl_default_timeout", (char*) 0, SHOW_SSL_GET_DEFAULT_TIMEOUT}, + {"Ssl_accepts", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT}, + {"Ssl_finished_accepts", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT_GOOD}, + {"Ssl_finished_connects", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT_GOOD}, + {"Ssl_accept_renegotiates", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT_RENEGOTIATE}, + {"Ssl_connect_renegotiates", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT_RENEGOTIATE}, + {"Ssl_callback_cache_hits", (char*) 0, SHOW_SSL_CTX_SESS_CB_HITS}, + {"Ssl_session_cache_hits", (char*) 0, SHOW_SSL_CTX_SESS_HITS}, + {"Ssl_session_cache_misses", (char*) 0, SHOW_SSL_CTX_SESS_MISSES}, + {"Ssl_session_cache_timeouts", (char*) 0, SHOW_SSL_CTX_SESS_TIMEOUTS}, + {"Ssl_used_session_cache_entries",(char*) 0, SHOW_SSL_CTX_SESS_NUMBER}, + {"Ssl_client_connects", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT}, + {"Ssl_session_cache_overflows", (char*) 0, SHOW_SSL_CTX_SESS_CACHE_FULL}, + {"Ssl_session_cache_size", (char*) 0, SHOW_SSL_CTX_SESS_GET_CACHE_SIZE}, + {"Ssl_session_cache_mode", (char*) 0, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE}, + {"Ssl_sessions_reused", (char*) 0, SHOW_SSL_SESSION_REUSED}, + {"Ssl_ctx_verify_mode", (char*) 0, SHOW_SSL_CTX_GET_VERIFY_MODE}, + {"Ssl_ctx_verify_depth", (char*) 0, SHOW_SSL_CTX_GET_VERIFY_DEPTH}, + {"Ssl_verify_mode", (char*) 0, SHOW_SSL_GET_VERIFY_MODE}, + {"Ssl_verify_depth", (char*) 0, SHOW_SSL_GET_VERIFY_DEPTH}, + {"Ssl_version", (char*) 0, SHOW_SSL_GET_VERSION}, + {"Ssl_cipher", (char*) 0, SHOW_SSL_GET_CIPHER}, + {"Ssl_cipher_list", (char*) 0, SHOW_SSL_GET_CIPHER_LIST}, + {"Ssl_default_timeout", (char*) 0, SHOW_SSL_GET_DEFAULT_TIMEOUT}, #endif /* HAVE_OPENSSL */ {"Table_locks_immediate", (char*) &locks_immediate, SHOW_LONG}, {"Table_locks_waited", (char*) &locks_waited, SHOW_LONG}, diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7da477e89f0..d48bc3b3a18 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -501,8 +501,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List &fields,COND *conds, select_distinct=0; } else if (select_distinct && join.tables - join.const_tables == 1 && - ((thd->select_limit == HA_POS_ERROR || - (join.select_options & OPTION_FOUND_ROWS)) && + (thd->select_limit == HA_POS_ERROR || + (join.select_options & OPTION_FOUND_ROWS) || order && !(skip_sort_order= test_if_skip_sort_order(&join.join_tab[join.const_tables], @@ -4899,11 +4899,12 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), JOIN_TAB *jt=join->join_tab; if ((join->tables == 1) && !join->tmp_table && !join->sort_and_group && !join->send_group_parts && !join->having && !jt->select_cond && - !(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT) && (jt->records < INT_MAX32)) + !(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT)) { /* Join over all rows in table; Return number of found rows */ join->select_options ^= OPTION_FOUND_ROWS; - join->send_records = jt->records; + jt->table->file->info(HA_STATUS_VARIABLE); + join->send_records = jt->table->file->records; } else { @@ -4941,10 +4942,9 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), join->procedure->end_group(); if (idx < (int) join->send_group_parts) { - int error; + int error=0; if (join->procedure) { - error=0; if (join->having && join->having->val_int() == 0) error= -1; // Didn't satisfy having else if (join->do_send_rows) @@ -4962,13 +4962,11 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), } if (join->having && join->having->val_int() == 0) error= -1; // Didn't satisfy having - else + else if (join->do_send_rows) error=join->result->send_data(*join->fields) ? 1 : 0; } if (error > 0) DBUG_RETURN(-1); /* purecov: inspected */ - if (end_of_records) - DBUG_RETURN(0); if (!error && ++join->send_records >= join->thd->select_limit && join->do_send_rows) { @@ -4977,6 +4975,8 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), join->do_send_rows=0; join->thd->select_limit = HA_POS_ERROR; } + if (end_of_records) + DBUG_RETURN(0); } } else -- cgit v1.2.1 From ad67401fe99d802242f01efa564cbcb7ef2ca143 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 May 2002 16:32:51 +0300 Subject: New my_gethostbyname_r() handling Changed some status variable names Fix bug in GRANT ... PASSWORD string Docs/manual.texi: Update of variable names include/my_net.h: New my_gethostbyname_r() handling include/my_pthread.h: New my_gethostbyname_r() handling libmysql/Makefile.shared: New my_gethostbyname_r() handling libmysql/libmysql.c: New my_gethostbyname_r() handling mysys/Makefile.am: New my_gethostbyname_r() handling mysys/my_pthread.c: New my_gethostbyname_r() handling mysys/my_thr_init.c: New my_gethostbyname_r() handling sql/hostname.cc: New my_gethostbyname_r() handling sql/mini_client.cc: New my_gethostbyname_r() handling sql/mysqld.cc: change some status variable names sql/sql_acl.cc: Fix bug in GRANT ... PASSWORD string --- sql/hostname.cc | 7 ++++++- sql/mini_client.cc | 15 ++------------- sql/mysqld.cc | 4 ++-- sql/sql_acl.cc | 13 +++++++++---- 4 files changed, 19 insertions(+), 20 deletions(-) (limited to 'sql') diff --git a/sql/hostname.cc b/sql/hostname.cc index bc812341337..21dbd5a2bbe 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -171,17 +171,22 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) { DBUG_PRINT("error",("gethostbyname_r returned %d",tmp_errno)); add_wrong_ip(in); + my_gethostbyname_r_free(); DBUG_RETURN(0); } if (!hp->h_name[0]) { DBUG_PRINT("error",("Got an empty hostname")); add_wrong_ip(in); + my_gethostbyname_r_free(); DBUG_RETURN(0); // Don't allow empty hostnames } if (!(name=my_strdup(hp->h_name,MYF(0)))) + { + my_gethostbyname_r_free(); DBUG_RETURN(0); // out of memory - + } + my_gethostbyname_r_free(); #else VOID(pthread_mutex_lock(&LOCK_hostname)); if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET))) diff --git a/sql/mini_client.cc b/sql/mini_client.cc index 3dfd58375a5..8f703b80e3a 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -614,7 +614,6 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr)); } else -#if defined(HAVE_GETHOSTBYNAME_R) && defined(_REENTRANT) && defined(THREAD) { int tmp_errno; struct hostent tmp_hostent,*hp; @@ -625,22 +624,12 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, { net->last_errno=CR_UNKNOWN_HOST; sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno); + my_gethostbyname_r_free(); goto error; } memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); + my_gethostbyname_r_free(); } -#else - { - struct hostent *hp; - if (!(hp=gethostbyname(host))) - { - net->last_errno=CR_UNKNOWN_HOST; - sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno); - goto error; - } - memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); - } -#endif sock_addr.sin_port = (ushort) htons((ushort) port); if (mc_sock_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), mysql->options.connect_timeout) <0) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ebb7592820b..9ac6ea6fff8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3149,10 +3149,10 @@ struct show_var_st status_vars[]= { {"Com_show_grants", (char*) (com_stat+(uint) SQLCOM_SHOW_GRANTS),SHOW_LONG}, {"Com_show_keys", (char*) (com_stat+(uint) SQLCOM_SHOW_KEYS),SHOW_LONG}, {"Com_show_logs", (char*) (com_stat+(uint) SQLCOM_SHOW_LOGS),SHOW_LONG}, - {"Com_show_master_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG}, + {"Com_show_master_status", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG}, {"Com_show_open_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_OPEN_TABLES),SHOW_LONG}, {"Com_show_processlist", (char*) (com_stat+(uint) SQLCOM_SHOW_PROCESSLIST),SHOW_LONG}, - {"Com_show_slave_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG}, + {"Com_show_slave_status", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG}, {"Com_show_status", (char*) (com_stat+(uint) SQLCOM_SHOW_STATUS),SHOW_LONG}, {"Com_show_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLES),SHOW_LONG}, {"Com_show_variables", (char*) (com_stat+(uint) SQLCOM_SHOW_VARIABLES),SHOW_LONG}, diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index e6b0248e29b..446076e0d55 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -983,12 +983,17 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo, char *password,empty_string[1]; DBUG_ENTER("replace_user_table"); + password=empty_string; + empty_string[0]=0; + if (combo.password.str && combo.password.str[0]) - password=combo.password.str; - else { - password=empty_string; - empty_string[0]=0; + if (combo.password.length != HASH_PASSWORD_LENGTH) + { + my_error(ER_PASSWORD_NO_MATCH,MYF(0)); + DBUG_RETURN(-1); + } + password=combo.password.str; } table->field[0]->store(combo.host.str,combo.host.length); -- cgit v1.2.1 From 03aebd40aa9c8a949baabb2e49d35da0c92c41f2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 May 2002 23:35:09 +0300 Subject: Fixed some compilation problems in last changeset Docs/manual.texi: Small changes regarind user resources client/mysqlbinlog.cc: Applied patch to support --database mysql-test/r/func_isnull.result: New test results mysql-test/r/join.result: New test results mysql-test/r/show_check.result: New test results mysql-test/r/type_datetime.result: New test results mysql-test/r/type_decimal.result: New test results mysql-test/r/type_float.result: New test results mysys/my_gethostbyname.c: Fixed type on last push mysys/my_pthread.c: Fixed type on last push sql/sql_select.cc: Fixed bug in LIMIT handling --- sql/sql_select.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d48bc3b3a18..06e0d94f524 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4967,6 +4967,11 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), } if (error > 0) DBUG_RETURN(-1); /* purecov: inspected */ + if (end_of_records) + { + join->send_records++; + DBUG_RETURN(0); + } if (!error && ++join->send_records >= join->thd->select_limit && join->do_send_rows) { @@ -4975,8 +4980,6 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), join->do_send_rows=0; join->thd->select_limit = HA_POS_ERROR; } - if (end_of_records) - DBUG_RETURN(0); } } else -- cgit v1.2.1 From 135f5745f6ffb7587224813030bbc1e3eeb3b029 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 May 2002 10:50:57 +0300 Subject: Fix bug in CONCAT_WS() Update of glibc patch from MySQL 4.0 Docs/glibc-2.2.5.patch: Update of patch from MySQL 4.0 Docs/manual.texi: ChangeLog sql/item_strfunc.cc: Fix bug in CONCAT_WS() sql/share/italian/errmsg.txt: Update of new error messages --- sql/item_strfunc.cc | 2 +- sql/share/italian/errmsg.txt | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'sql') diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 0321d37c0fe..54fc427edf0 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -313,7 +313,7 @@ null: void Item_func_concat_ws::fix_length_and_dec() { - max_length=0; + max_length=separator->max_length*(arg_count-1); for (uint i=0 ; i < arg_count ; i++) max_length+=args[i]->max_length; if (max_length > MAX_BLOB_WIDTH) diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 3da78e82d99..4b434573390 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -209,13 +209,13 @@ "E' scaduto il timeout per l'attesa del lock", "Il numero totale di lock e' maggiore della grandezza della tabella di lock", "I lock di aggiornamento non possono essere acquisiti durante una transazione 'READ UNCOMMITTED'", -"DROP DATABASE not allowed while thread is holding global read lock", -"CREATE DATABASE not allowed while thread is holding global read lock", -"Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", -"Incorrect table definition; All MERGE tables must be in the same database", -"Deadlock found when trying to get lock; Try restarting transaction", -"The used table type doesn't support FULLTEXT indexes", -"Cannot add foreign key constraint", -"Cannot add a child row: a foreign key constraint fails", -"Cannot delete a parent row: a foreign key constraint fails", +"DROP DATABASE non e' permesso mentre il thread ha un lock globale di lettura", +"CREATE DATABASE non e' permesso mentre il thread ha un lock globale di lettura", +"Argomenti errati a %s", +"A %-.32s@%-.64s non e' permesso creare nuovi utenti", +"Definizione della tabella errata; tutte le tabelle di tipo MERGE devono essere nello stesso database", +"Trovato deadlock durante il lock; Provare a far ripartire la transazione", +"La tabella usata non supporta gli indici FULLTEXT", +"Impossibile aggiungere il vincolo di integrita' referenziale (foreign key constraint)", +"Impossibile aggiungere la riga: un vincolo d'integrita' referenziale non e' soddisfatto", +"Impossibile cancellare la riga: un vincolo d'integrita' referenziale non e' soddisfatto", -- cgit v1.2.1 From 1503a4724e9bd65826cf7547240c4e03f773d2a0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 May 2002 16:45:00 +0300 Subject: Optimize LIKE with turbo-boyer-more algoritm Docs/manual.texi: Added info about LIKE optimization mysql-test/r/func_like.result: Test of new LIKE optimization mysql-test/t/func_like.test: Test of new LIKE optimization --- sql/item_cmpfunc.cc | 266 +++++++++++++++++++++++++++++++++++++++++++++++++++- sql/item_cmpfunc.h | 29 +++++- sql/unireg.h | 7 ++ 3 files changed, 295 insertions(+), 7 deletions(-) (limited to 'sql') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 09c2bdc593a..c21ad18f08e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1228,23 +1228,23 @@ void Item_func_like::fix_length_and_dec() // cmp_type=STRING_RESULT; // For quick select } - longlong Item_func_like::val_int() { - String *res,*res2; - res=args[0]->val_str(&tmp_value1); + String* res = args[0]->val_str(&tmp_value1); if (args[0]->null_value) { null_value=1; return 0; } - res2=args[1]->val_str(&tmp_value2); + String* res2 = args[1]->val_str(&tmp_value2); if (args[1]->null_value) { null_value=1; return 0; } null_value=0; + if (canDoTurboBM) + return turboBM_matches(res->ptr(), res->length()) ? 1 : 0; if (binary) return wild_compare(*res,*res2,escape) ? 0 : 1; else @@ -1268,6 +1268,51 @@ Item_func::optimize_type Item_func_like::select_optimize() const return OPTIMIZE_NONE; } +bool Item_func_like::fix_fields(THD *thd,struct st_table_list *tlist) +{ + if (Item_bool_func2::fix_fields(thd, tlist)) + return 1; + + /* + TODO--we could do it for non-const, but we'd have to + recompute the tables for each row--probably not worth it. + */ + if (args[1]->const_item() && !(specialflag & SPECIAL_NO_NEW_FUNC)) + { + String* res2 = args[1]->val_str(&tmp_value2); + const size_t len = res2->length(); + const char* first = res2->ptr(); + const char* last = first + len - 1; + /* + len must be > 2 ('%pattern%') + heuristic: only do TurboBM for pattern_len > 2 + */ + + if (len > MIN_TURBOBM_PATTERN_LEN + 2 && + *first == wild_many && + *last == wild_many) + { + const char* tmp = first + 1; + for ( ; *tmp != wild_many && *tmp != wild_one && *tmp != escape; tmp++) ; + canDoTurboBM = tmp == last; + } + + if (canDoTurboBM) + { + pattern = first + 1; + pattern_len = len - 2; + DBUG_PRINT("TurboBM", ("Initializing pattern: '%s'...", first)); + int* suff = (int*)thd->alloc(sizeof(int[pattern_len + 1])); + bmGs = (int*)thd->alloc(sizeof(int[pattern_len + 1])); + bmBc = (int*)thd->alloc(sizeof(int[alphabet_size])); + turboBM_compute_good_suffix_shifts(suff); + turboBM_compute_bad_character_shifts(); + DBUG_PRINT("turboBM",("done")); + } + } + return 0; +} + #ifdef USE_REGEX bool @@ -1307,7 +1352,6 @@ Item_func_regex::fix_fields(THD *thd,TABLE_LIST *tables) return 0; } - longlong Item_func_regex::val_int() { char buff[MAX_FIELD_WIDTH]; @@ -1364,3 +1408,215 @@ Item_func_regex::~Item_func_regex() } #endif /* USE_REGEX */ + + +#ifdef LIKE_CMP_TOUPPER +#define likeconv(A) (uchar) toupper(A) +#else +#define likeconv(A) (uchar) my_sort_order[(uchar) (A)] +#endif + + +/********************************************************************** + turboBM_compute_suffixes() + Precomputation dependent only on pattern_len. +**********************************************************************/ + +void Item_func_like::turboBM_compute_suffixes(int* suff) +{ + const int plm1 = pattern_len - 1; + int f = 0; + int g = plm1; + int* const splm1 = suff + plm1; + + *splm1 = pattern_len; + + if (binary) + { + int i; + for (i = pattern_len - 2; i >= 0; i--) + { + int tmp = *(splm1 + i - f); + if (g < i && tmp < i - g) + suff[i] = tmp; + else + { + if (i < g) + g = i; // g = min(i, g) + f = i; + while (g >= 0 && pattern[g] == pattern[g + plm1 - f]) + g--; + suff[i] = f - g; + } + } + } + else + { + int i; + for (i = pattern_len - 2; 0 <= i; --i) + { + int tmp = *(splm1 + i - f); + if (g < i && tmp < i - g) + suff[i] = tmp; + else + { + if (i < g) + g = i; // g = min(i, g) + f = i; + while (g >= 0 && likeconv(pattern[g]) == likeconv(pattern[g + plm1 - f])) + g--; + suff[i] = f - g; + } + } + } +} + + +/********************************************************************** + turboBM_compute_good_suffix_shifts() + Precomputation dependent only on pattern_len. +**********************************************************************/ + +void Item_func_like::turboBM_compute_good_suffix_shifts(int* suff) +{ + turboBM_compute_suffixes(suff); + + int* end = bmGs + pattern_len; + int* k; + for (k = bmGs; k < end; k++) + *k = pattern_len; + + int tmp; + int i; + int j = 0; + const int plm1 = pattern_len - 1; + for (i = plm1; i > -1; i--) + { + if (suff[i] == i + 1) + { + for (tmp = plm1 - i; j < tmp; j++) + { + int* tmp2 = bmGs + j; + if (*tmp2 == pattern_len) + *tmp2 = tmp; + } + } + } + + int* tmp2; + for (tmp = plm1 - i; j < tmp; j++) + { + tmp2 = bmGs + j; + if (*tmp2 == pattern_len) + *tmp2 = tmp; + } + + tmp2 = bmGs + plm1; + for (i = 0; i <= pattern_len - 2; i++) + *(tmp2 - suff[i]) = plm1 - i; +} + + +/********************************************************************** + turboBM_compute_bad_character_shifts() + Precomputation dependent on pattern_len. +**********************************************************************/ + +void Item_func_like::turboBM_compute_bad_character_shifts() +{ + int* i; + int* end = bmBc + alphabet_size; + for (i = bmBc; i < end; i++) + *i = pattern_len; + + int j; + const int plm1 = pattern_len - 1; + if (binary) + for (j = 0; j < plm1; j++) + bmBc[pattern[j]] = plm1 - j; + else + for (j = 0; j < plm1; j++) + bmBc[likeconv(pattern[j])] = plm1 - j; +} + + +/********************************************************************** + turboBM_matches() + Search for pattern in text, returns true/false for match/no match +**********************************************************************/ + +bool Item_func_like::turboBM_matches(const char* text, int text_len) const +{ + register int bcShift; + register int turboShift; + int shift = pattern_len; + int j = 0; + int u = 0; + + const int plm1 = pattern_len - 1; + const int tlmpl = text_len - pattern_len; + + /* Searching */ + if (binary) + { + while (j <= tlmpl) + { + register int i = plm1; + while (i >= 0 && pattern[i] == text[i + j]) + { + i--; + if (i == plm1 - shift) + i -= u; + } + if (i < 0) + return true; + + register const int v = plm1 - i; + turboShift = u - v; + bcShift = bmBc[text[i + j]] - plm1 + i; + shift = max(turboShift, bcShift); + shift = max(shift, bmGs[i]); + if (shift == bmGs[i]) + u = min(pattern_len - shift, v); + else + { + if (turboShift < bcShift) + shift = max(shift, u + 1); + u = 0; + } + j += shift; + } + return false; + } + else + { + while (j <= tlmpl) + { + register int i = plm1; + while (i >= 0 && likeconv(pattern[i]) == likeconv(text[i + j])) + { + i--; + if (i == plm1 - shift) + i -= u; + } + if (i < 0) + return true; + + register const int v = plm1 - i; + turboShift = u - v; + bcShift = bmBc[likeconv(text[i + j])] - plm1 + i; + shift = max(turboShift, bcShift); + shift = max(shift, bmGs[i]); + if (shift == bmGs[i]) + u = min(pattern_len - shift, v); + else + { + if (turboShift < bcShift) + shift = max(shift, u + 1); + u = 0; + } + j += shift; + } + return false; + } +} diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 2048c4baea8..cd6e3d6e414 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -478,15 +478,40 @@ public: class Item_func_like :public Item_bool_func2 { char escape; -public: - Item_func_like(Item *a,Item *b, char* escape_arg) :Item_bool_func2(a,b),escape(*escape_arg) + + // Turbo Boyer-Moore data + bool canDoTurboBM; // pattern is '%abcd%' case + const char* pattern; + int pattern_len; + + // TurboBM buffers, *this is owner + int* bmGs; // good suffix shift table, size is pattern_len + 1 + int* bmBc; // bad character shift table, size is alphabet_size + + void turboBM_compute_suffixes(int* suff); + void turboBM_compute_good_suffix_shifts(int* suff); + void turboBM_compute_bad_character_shifts(); + bool turboBM_matches(const char* text, int text_len) const; + enum { alphabet_size = 256 }; + +public: + Item_func_like::Item_func_like(Item *a,Item *b, char* escape_arg) : + Item_bool_func2(a,b), + escape(*escape_arg), + canDoTurboBM(false), + pattern(0), + pattern_len(0), + bmGs(0), + bmBc(0) {} + longlong val_int(); enum Functype functype() const { return LIKE_FUNC; } optimize_type select_optimize() const; cond_result eq_cmp_result() const { return COND_TRUE; } const char *func_name() const { return "like"; } void fix_length_and_dec(); + bool fix_fields(THD *thd,struct st_table_list *tlist); }; #ifdef USE_REGEX diff --git a/sql/unireg.h b/sql/unireg.h index c4d2052d1da..5a61f4a6c12 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -122,6 +122,13 @@ bfill((A)->null_flags,(A)->null_bytes,255);\ #define TE_INFO_LENGTH 3 #define MTYP_NOEMPTY_BIT 128 +/* + * Minimum length pattern before Turbo Boyer-Moore is used + * for SELECT "text" LIKE "%pattern%", excluding the two + * wildcards in class Item_func_like. + */ +#define MIN_TURBOBM_PATTERN_LEN 3 + /* Include prototypes for unireg */ #include "mysqld_error.h" -- cgit v1.2.1 From f2954f03079ba3561c95517217ed7fdd68d139d3 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 May 2002 14:30:54 +0300 Subject: Fixing that database privileges are also taken into account. Before this change LOCK TABLES worked only with global and table level privileges. --- sql/sql_parse.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index af68c1bb9f3..3ffc5edc69f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2223,7 +2223,8 @@ mysql_execute_command(void) } if (check_db_used(thd,tables) || end_active_trans(thd)) goto error; - if (grant_option && check_grant(thd,SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL,tables)) + if (check_table_access(thd, SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL , tables) + || (grant_option && check_grant(thd,SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL,tables))) goto error; thd->in_lock_tables=1; thd->options|= OPTION_TABLE_LOCK; -- cgit v1.2.1 From fc715c075f0cc544965035d5110240b58b7619e8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 May 2002 12:11:15 +0300 Subject: Updated assembler code from MySQL 4.0 (to make them work with gcc 3.0) Fixed memory overrun bug in glibc patch Updated french error messages Docs/glibc-2.2.5.patch: Fixed memory overrun bug in glibc patch sql/share/french/errmsg.txt: Updated french error messages (patch from Loic Le Loarer) strings/longlong2str-x86.s: Updated from MySQL 4.0 (to make them work with gcc 3.0) strings/strings-x86.s: Updated from MySQL 4.0 (to make them work with gcc 3.0) --- sql/share/french/errmsg.txt | 192 ++++++++++++++++++++++---------------------- 1 file changed, 96 insertions(+), 96 deletions(-) (limited to 'sql') diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 4848a3266bc..07b88e1356e 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -122,100 +122,100 @@ "Ligne trop grande. Le taille maximale d'une ligne, sauf les BLOBs, est %d. Changez le type de quelques colonnes en BLOB", "Débordement de la pile des tâches (Thread stack). Utilisées: %ld pour une pile de %ld. Essayez 'mysqld -O thread_stack=#' pour indiquer une plus grande valeur", "Dépendance croisée dans une clause OUTER JOIN. Vérifiez la condition ON", -"Column '%-.32s' is used with UNIQUE or INDEX but is not defined as NOT NULL", -"Can't load function '%-.64s'", -"Can't initialize function '%-.64s'; %-.80s", -"No paths allowed for shared library", -"Function '%-.64s' already exist", -"Can't open shared library '%-.64s' (errno: %d %s)", -"Can't find function '%-.64s' in library'", -"Function '%-.64s' is not defined", -"Host '%-.64s' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'", -"Host '%-.64s' is not allowed to connect to this MySQL server", -"You are using MySQL as an anonymous users and anonymous users are not allowed to change passwords", -"You must have privileges to update tables in the mysql database to be able to change passwords for others", -"Can't find any matching row in the user table", -"Rows matched: %ld Changed: %ld Warnings: %ld", -"Can't create a new thread (errno %d). If you are not out of available memory you can consult the manual for any possible OS dependent bug", +"La colonne '%-.32s' fait partie d'un index UNIQUE ou INDEX mais n'est pas définie comme NOT NULL" +"Imposible de charger la fonction '%-.64s'", +"Impossible d'initialiser la fonction '%-.64s'; %-.80s", +"Chemin interdit pour les bibliothèques partagées", +"La fonction '%-.64s' existe déjà", +"Impossible d'ouvrir la bibliothèque partagée '%-.64s' (errno: %d %s)", +"Impossible de trouver la fonction '%-.64s' dans la bibliothèque'", +"La fonction '%-.64s' n'est pas définie", +"L'hôte '%-.64s' est bloqué à cause d'un trop grand nombre d'erreur de connection. Débloquer le par 'mysqladmin flush-hosts'", +"Le hôte '%-.64s' n'est pas authorisé à se connecter à ce serveur MySQL", +"Vous utilisez un utilisateur anonyme et les utilisateurs anonymes ne sont pas autorisés à changer les mots de passe", +"Vous devez avoir le privilège update sur les tables de la base de donnée mysql pour pouvoir changer les mots de passe des autres", +"Impossible de trouver un enregistrement correspondant dans la table user", +"Enregistrements correspondants: %ld Modifiés: %ld Warnings: %ld", +"Impossible de créer une nouvelle tâche (errno %d). S'il reste de la mémoire libre, consultez le manual pour trouver un éventuel bug dépendant de l'OS", "Column count doesn't match value count at row %ld", -"Can't reopen table: '%-.64s', -"Invalid use of NULL value", -"Got error '%-.64s' from regexp", -"Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause", -"There is no such grant defined for user '%-.32s' on host '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'", -"Illegal GRANT/REVOKE command. Please consult the manual which privleges can be used.", -"The host or user argument to GRANT is too long", -"Table '%-64s.%s' doesn't exist", -"There is no such grant defined for user '%-.32s' on host '%-.64s' on table '%-.64s'", -"The used command is not allowed with this MySQL version", -"Something is wrong in your syntax", -"Delayed insert thread couldn't get requested lock for table %-.64s", -"Too many delayed threads in use", -"Aborted connection %ld to db: '%-.64s' user: '%-.64s' (%s)", -"Got a packet bigger than 'max_allowed_packet'", -"Got a read error from the connection pipe", -"Got an error from fcntl()", -"Got packets out of order", -"Couldn't uncompress communication packet", -"Got an error reading communication packets" -"Got timeout reading communication packets", -"Got an error writing communication packets", -"Got timeout writing communication packets", -"Result string is longer than max_allowed_packet", -"The used table type doesn't support BLOB/TEXT columns", -"The used table type doesn't support AUTO_INCREMENT columns", -"INSERT DELAYED can't be used with table '%-.64s', because it is locked with LOCK TABLES", -"Incorrect column name '%-.100s'", -"The used table handler can't index column '%-.64s'", -"All tables in the MERGE table are not defined identically", -"Can't write, because of unique constraint, to table '%-.64s'", -"BLOB column '%-.64s' used in key specification without a key length", -"All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead", -"Result consisted of more than one row", -"This table type requires a primary key", -"This version of MySQL is not compiled with RAID support", -"You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column", -"Key '%-.64s' doesn't exist in table '%-.64s'", -"Can't open table", -"The handler for the table doesn't support check/repair", -"You are not allowed to execute this command in a transaction", -"Got error %d during COMMIT", -"Got error %d during ROLLBACK", -"Got error %d during FLUSH_LOGS", -"Got error %d during CHECKPOINT", -"Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)", -"The handler for the table does not support binary table dump", -"Binlog closed while trying to FLUSH MASTER", -"Failed rebuilding the index of dumped table '%-.64s'", -"Error from master: '%-.64s'", -"Net error reading from master", -"Net error writing to master", -"Can't find FULLTEXT index matching the column list", -"Can't execute the given command because you have active locked tables or an active transaction", -"Unknown system variable '%-.64s'", -"Table '%-.64s' is marked as crashed and should be repaired", -"Table '%-.64s' is marked as crashed and last (automatic?) repair failed", -"Warning: Some non-transactional changed tables couldn't be rolled back", -"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", -"The server is not configured as slave, fix in config file or with CHANGE MASTER TO", -"Could not initialize master info structure, check permisions on master.info", -"Could not create slave thread, check system resources", -"User %-.64s has already more than 'max_user_connections' active connections", -"You may only use constant expressions with SET", -"Lock wait timeout exceeded", -"The total number of locks exceeds the lock table size", -"Update locks cannot be acquired during a READ UNCOMMITTED transaction", -"DROP DATABASE not allowed while thread is holding global read lock", -"CREATE DATABASE not allowed while thread is holding global read lock", -"Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", -"Incorrect table definition; All MERGE tables must be in the same database", -"Deadlock found when trying to get lock; Try restarting transaction", -"The used table type doesn't support FULLTEXT indexes", -"Cannot add foreign key constraint", -"Cannot add a child row: a foreign key constraint fails", -"Cannot delete a parent row: a foreign key constraint fails", +"Impossible de réouvrir la table: '%-.64s', +"Utilisation incorrecte de la valeur NULL", +"Erreur '%-.64s' provenant de regexp", +"Mélanger les colonnes GROUP (MIN(),MAX(),COUNT()...) avec des colonnes normales est interdit s'il n'y a pas de clause GROUP BY", +"Un tel droit n'est pas défini pour l'utilisateur '%-.32s' sur l'hôte '%-.64s'", +"La commande '%-.16s' est interdite à l'utilisateur: '%-.32s@%-.64s' sur la table '%-.64s'", +"La commande '%-.16s' est interdite à l'utilisateur: '%-.32s@%-.64s' sur la colonne '%-.64s' de la table '%-.64s'", +"Commande GRANT/REVOKE incorrecte. Consultez le manuel.", +"L'hôte ou l'utilisateur donné en argument à GRANT est trop long", +"La table '%-64s.%s' n'existe pas", +"Un tel droit n'est pas défini pour l'utilisateur '%-.32s' sur l'hôte '%-.64s' sur la table '%-.64s'", +"Cette commande n'existe pas dans cette version de MySQL", +"Erreur de syntaxe", +"La tâche 'delayed insert' n'a pas pu obtenir le verrou démandé sur la table %-.64s", +"Trop de tâche 'delayed' en cours", +"Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.64s' (%s)", +"Paquet plus grand que 'max_allowed_packet' reçu", +"Erreur de lecture reçue du pipe de connection", +"Erreur reçue de fcntl() ", +"Paquets reçus dans le désordre", +"Impossible de décompresser le paquet reçu", +"Erreur de lecture des paquets reçus" +"Timeout en lecture des paquets reçus", +"Erreur d'écriture des paquets envoyés", +"Timeout d'écriture des paquets envoyés", +"La chaîne résultat est plus grande que max_allowed_packet", +"Ce type de table ne supporte pas les colonnes BLOB/TEXT", +"Ce type de table ne supporte pas les colonnes AUTO_INCREMENT", +"INSERT DELAYED ne peut être utilisé avec la table '%-.64s', car elle est verrouée avec LOCK TABLES", +"Nom de colonne '%-.100s' incorrect", +"Le handler de la table ne peut indexé la colonne '%-.64s'", +"Toutes les tables de la table de type MERGE n'ont pas la même définition", +"Écriture impossible à cause d'un index UNIQUE sur la table '%-.64s'", +"La colonne '%-.64s' de type BLOB est utilisée dans une définition d'index sans longueur d'index", +"Toutes les parties d'un index PRIMARY KEY doivent être NOT NULL; Si vous avez besoin d'un NULL dans l'index, utilisez un index UNIQUE", +"Le résultat contient plus d'un enregistrement", +"Ce type de table nécessite une clé primaire (PRIMARY KEY)", +"Cette version de MySQL n'est pas compilée avec le support RAID", +"Vous êtes en mode 'safe update' et vous essayez de faire un UPDATE sans clause WHERE utilisant un index", +"L'index '%-.64s' n'existe pas sur la table '%-.64s'", +"Impossible d'ouvrir la table", +"Ce type de table ne supporte pas les check/repair", +"Vous n'êtes pas autorisé à exécute cette commande dans une transaction", +"Erreur %d lors du COMMIT", +"Erreur %d lors du ROLLBACK", +"Erreur %d lors du FLUSH_LOGS", +"Erreur %d lors du CHECKPOINT", +"Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.32s' hôte: `%-.64s' (%-.64s)", +"Ce type de table ne supporte pas les copies binaires", +"Le 'binlog' a été fermé pendant l'exécution du FLUSH MASTER", +"La reconstruction de l'index de la table copiée '%-.64s' a échoué", +"Erreur reçue du maître: '%-.64s'", +"Erreur de lecture réseau reçue du maître", +"Erreur d'écriture réseau reçue du maître", +"Impossible de trouver un index FULLTEXT correspondant à cette liste de colonnes", +"Impossible d'exécuter la commande car vous avez des tables verrouillées ou une transaction active", +"Variable système '%-.64' inconnue", +"La table '%-.64s' est marquée 'crashed' et devrait être réparée", +"La table '%-.64s' est marquée 'crashed' et le dernier 'repair' a échoué", +"Attention: certaines tables ne supportant pas les transactions ont été changées et elles ne pourront pas être restituées", +"Cette transaction à commandes multiples nécessite plus de 'max_binlog_cache_size' octets de stockage, augmentez cette variable de mysqld et réessayez', +"Cette opération ne peut être réalisée avec un esclave actif, faites SLAVE STOP d'abord", +"Cette opération nécessite un esclave actif, configurez les esclaves et faites SLAVE START", +"Le server n'est pas configuré comme un esclave, changez le fichier de configuration ou utilisez CHANGE MASTER TO", +"Impossible d'initialiser les structures d'information de maître, vérifiez les permissions sur master.info", +"Impossible de créer une tâche esclave, vérifiez les ressources système", +"L'utilisateur %-.64s possède déjà plus de 'max_user_connections' connections actives", +"Seules les expressions constantes sont autorisées avec SET", +"Timeout sur l'obtention du verrou", +"Le nombre total de verrou dépasse la taille de la table des verrous", +"Un verrou en update ne peut être acquit pendant une transaction READ UNCOMMITTED", +"DROP DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture", +"CREATE DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture", +"Mauvais arguments à %s", +"%-.32s@%-.64s n'est pas autorisé à créer de nouveaux utilisateurs", +"Définition de table incorrecte : toutes les tables MERGE doivent être dans la même base de donnée", +"Deadlock découvert en essayant d'obtenir les verrous : essayez de redémarrer la transaction", +"Le type de table utilisé ne supporte pas les index FULLTEXT", +"Impossible d'ajouter des contraintes d'index externe", +"Impossible d'ajouter un enregistrement fils : une constrainte externe l'empèche", +"Impossible de supprimer un enregistrement père : une constrainte externe l'empèche", -- cgit v1.2.1 From c55430b3f3e7f9a647da2eec650a150d1c976a5f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 May 2002 20:35:58 +0300 Subject: Fixes for gcc 3.1 Fixed bug in new code for regexp LIKE NULL BUILD/SETUP.sh: Fixes for gcc 3.1 BUILD/compile-solaris-sparc-debug: Fixes for gcc 3.1 BUILD/compile-solaris-sparc-purify: Fixes for gcc 3.1 BUILD/compile-solaris-sparc: Fixes for gcc 3.1 Docs/manual.texi: Fixed typo include/violite.h: Fixes for gcc 3.1 mysql-test/r/func_concat.result: Updated test results sql/item_cmpfunc.cc: Fixed bug in new code for regexp LIKE NULL --- sql/item_cmpfunc.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index c21ad18f08e..d95dbf8ef97 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1280,6 +1280,9 @@ bool Item_func_like::fix_fields(THD *thd,struct st_table_list *tlist) if (args[1]->const_item() && !(specialflag & SPECIAL_NO_NEW_FUNC)) { String* res2 = args[1]->val_str(&tmp_value2); + if (!res2) + return 0; // Null argument + const size_t len = res2->length(); const char* first = res2->ptr(); const char* last = first + len - 1; -- cgit v1.2.1 From 45138fe426b364ef670e071ab98a69a61caeb4b2 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 May 2002 00:05:05 +0300 Subject: Changed mysqlbinlog, mysqlmanager-pwgen, mysqlmanagerc, mysqltest, thread_test and isamchk to use my_getopt. Fixed a bug in my_getopt. client/mysqlbinlog.cc: Changed mysqlbinlog.cc to use my_getopt. client/mysqlmanager-pwgen.c: Changed mysqlmanager-pwgen to use my_getopt. client/mysqlmanagerc.c: Changed mysqlmanagerc to use my_getopt. client/mysqltest.c: Changed mysqltest to use my_getopt. client/thread_test.c: Changed thread_test to use my_getopt. isam/isamchk.c: Changed isamchk to use my_getopt. mysys/my_getopt.c: Fixed a bug in printing options when option didn't have a comment. Added startup initializing and printing for 'GET_BOOL' type variables. sql/mysql_priv.h: Changed type. sql/mysqld.cc: Fixed a bug in --local-infile option. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/mysql_priv.h | 2 +- sql/mysqld.cc | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'sql') diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index d1d538dd3c9..fd3111f380a 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -617,7 +617,7 @@ extern pthread_cond_t COND_refresh,COND_thread_count; extern pthread_attr_t connection_attrib; extern bool opt_endinfo, using_udf_functions, locked_in_memory, opt_using_transactions, use_temp_pool, mysql_embedded; -extern bool opt_local_infile; +extern my_bool opt_local_infile; extern char f_fyllchar; extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count, ha_read_key_count, ha_read_next_count, ha_read_prev_count, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index db500879058..2a118be100a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -334,7 +334,7 @@ ulong bytes_sent = 0L, bytes_received = 0L; bool opt_endinfo,using_udf_functions,low_priority_updates, locked_in_memory; bool opt_using_transactions, using_update_log, opt_warnings=0; -bool opt_local_infile=1; +my_bool opt_local_infile=1; bool volatile abort_loop,select_thread_in_use,grant_option; bool volatile ready_to_exit,shutdown_in_progress; ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */ @@ -2974,7 +2974,7 @@ static struct my_option my_long_options[] = {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0)", (gptr*) &opt_local_infile, (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, - 0, 0, 0, 0, 0, 0}, + 1, 0, 0, 0, 0, 0}, {"log-bin", OPT_BIN_LOG, "Log queries in new binary format (for replication)", (gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STR_ALLOC, @@ -3987,9 +3987,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'o': protocol_version=PROTOCOL_VERSION-1; break; - case OPT_LOCAL_INFILE: - opt_local_infile= test(!argument || atoi(argument) != 0); - break; case OPT_SLAVE_SKIP_ERRORS: init_slave_skip_errors(argument); break; -- cgit v1.2.1 From 9230e57770277641f53d8a102438a06bd05c9e49 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 May 2002 15:11:35 +0300 Subject: A fix for the very nusty bug with when there are 2 or more fields in GROUP BY , which fields can be NULL .... --- sql/sql_select.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 06e0d94f524..6e819150692 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3824,6 +3824,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, key_part_info->null_offset= (uint) (field->null_ptr - (uchar*) table->record[0]); group->field->move_field((char*) ++group->buff); + ++group_buff; } else group->field->move_field((char*) group_buff); -- cgit v1.2.1 From 45f976576a6fb08b575822b85ef4ede8ba2e775d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 May 2002 14:06:58 +0300 Subject: Changed ft_dump, ft_eval, ft_test1, mi_test1, myisampack, gen_lex_hash, mysqlmanager from using GNU getopt to use my_getopt. Changed some files that just included old getopt.h to include my_getopt.h now. Fixed a bug in my_print_help() in my_getopt.c. Made better documentation for option -G in mysql client. client/mysql.cc: Documented --named-commands better. myisam/ft_dump.c: Changed getopt to my_getopt. myisam/ft_eval.c: Changed getopt to my_getopt. myisam/ft_test1.c: Changed getopt to my_getopt. myisam/mi_check.c: getopt.h -> my_getopt.h myisam/mi_test1.c: Changed getopt to my_getopt. myisam/myisampack.c: Changed getopt to my_getopt. mysys/my_getopt.c: Fixed a bug when printing help for option that didn't have a description. sql/gen_lex_hash.cc: Changed getopt to my_getopt. tools/mysqlmanager.c: Changed getopt to my_getopt. vio/test-ssl.c: getopt.h -> my_getopt.h vio/test-sslclient.c: getopt.h -> my_getopt.h vio/test-sslserver.c: getopt.h -> my_getopt.h vio/viotest-ssl.c: getopt.h -> my_getopt.h BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/gen_lex_hash.cc | 126 ++++++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 64 deletions(-) (limited to 'sql') diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 7ebdbcd8ba8..ba1d27f2bf6 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -22,13 +22,13 @@ #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ // Skip warnings in getopt.h #endif -#include +#include #include "mysql_version.h" #include "lex.h" -bool opt_search=0; -int opt_verbose=0; -ulong opt_count=100000; +my_bool opt_search; +int opt_verbose; +ulong opt_count; #define max_allowed_array 8000 // Don't generate bigger arrays than this #define max_symbol 32767 // Use this for 'not found' @@ -55,6 +55,35 @@ static uchar bits[how_much_and/8+1]; static uint primes[max_allowed_array+1]; static ulong hash_results[type_count][how_much_for_plus+1][total_symbols]; static ulong start_value=0; +static uint best_type; +static ulong best_t1,best_t2, best_start_value; + +static struct my_option my_long_options[] = +{ + {"help", '?', "Display help and exit", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"count", 'c', "Try count times to find a optimal hash table", + (gptr*) &opt_count, (gptr*) &opt_count, 0, GET_ULONG, REQUIRED_ARG, + 100000, 0, 0, 0, 0, 0}, + {"search", 'S', "Search after good rnd1 and rnd2 values", + (gptr*) &opt_search, (gptr*) &opt_search, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, + 0, 0}, + {"verbose", 'v', "Write some information while the program executes", + (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0, GET_INT, NO_ARG, 0, 0, 0, + 0, 0, 0}, + {"version", 'V', "Output version information and exit", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"rnd1", 'r', "Set 1 part of rnd value for hash generator", + (gptr*) &best_t1, (gptr*) &best_t1, 0, GET_ULONG, REQUIRED_ARG, 6657025L, + 0, 0, 0, 0, 0}, + {"rnd2", 'R', "Set 2 part of rnd value for hash generator", + (gptr*) &best_t2, (gptr*) &best_t2, 0, GET_ULONG, REQUIRED_ARG, 6114496L, + 0, 0, 0, 0, 0}, + {"type", 't', "Set type of char table to generate", + (gptr*) &best_type, (gptr*) &best_type, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, + 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} +}; struct rand_struct { unsigned long seed1,seed2,max_value; @@ -325,82 +354,51 @@ void print_arrays() } -static struct option long_options[] = -{ - {"count", required_argument, 0, 'c'}, - {"search", no_argument, 0, 'S'}, - {"verbose", no_argument, 0, 'v'}, - {"version", no_argument, 0, 'V'}, - {"rnd1", required_argument, 0, 'r'}, - {"rnd2", required_argument, 0, 'R'}, - {"type", required_argument, 0, 't'}, - {0, 0, 0, 0} -}; - - static void usage(int version) { - printf("%s Ver 3.3 Distrib %s, for %s (%s)\n", + printf("%s Ver 3.4 Distrib %s, for %s (%s)\n", my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); if (version) return; puts("Copyright (C) 2001 MySQL AB, by Sinisa and Monty"); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("This program generates a perfect hashing function for the sql_lex.cc"); - printf("Usage: %s [OPTIONS]\n", my_progname); - printf("\n\ --c, --count=# Try count times to find a optimal hash table\n\ --r, --rnd1=# Set 1 part of rnd value for hash generator\n\ --R, --rnd2=# Set 2 part of rnd value for hash generator\n\ --t, --type=# Set type of char table to generate\n\ --S, --search Search after good rnd1 and rnd2 values\n\ --v, --verbose Write some information while the program executes\n\ --V, --version Output version information and exit\n"); + printf("Usage: %s [OPTIONS]\n\n", my_progname); + my_print_help(my_long_options); + my_print_variables(my_long_options); +} + +static my_bool +get_one_option(int optid, const struct my_option *opt __attribute__((unused)), + char *argument __attribute__((unused))) +{ + switch(optid) { + case 'v': + opt_verbose++; + break; + case 'V': + usage(1); + exit(0); + case 'I': + case '?': + usage(0); + exit(0); + } + return 0; } -static uint best_type; -static ulong best_t1,best_t2, best_start_value; static int get_options(int argc, char **argv) { - int c,option_index=0; + int ho_error; - while ((c=getopt_long(argc,argv,"?SvVc:r:R:t:", - long_options, &option_index)) != EOF) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) { - switch(c) { - case 'c': - opt_count=atol(optarg); - break; - case 'r': - best_t1=atol(optarg); - break; - case 'R': - best_t2=atol(optarg); - break; - case 't': - best_type=atoi(optarg); - break; - case 'S': - opt_search=1; - break; - case 'v': - opt_verbose++; - break; - case 'V': usage(1); exit(0); - case 'I': - case '?': - usage(0); - exit(0); - default: - fprintf(stderr,"illegal option: -%c\n",opterr); - usage(0); - exit(1); - } + printf("%s: handle_options() failed with error %d\n", my_progname, + ho_error); + exit(1); } - argc-=optind; - argv+=optind; if (argc >= 1) { usage(0); @@ -483,7 +481,7 @@ int main(int argc,char **argv) MY_INIT(argv[0]); - start_value=1109118L; best_t1=6657025L; best_t2=6114496L; best_type=1; /* mode=4903 add=3 type: 0 */ + start_value=1109118L; /* mode=4903 add=3 type: 0 */ if (get_options(argc,(char **) argv)) exit(1); -- cgit v1.2.1 From 9dc316b6be3ff685cdc39c3565d3094991f04626 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 May 2002 15:26:47 +0300 Subject: Fixed a bug with big result sets and UNION's BitKeeper/etc/ignore: Added mysys/getopt.c mysys/getopt1.c to the ignore list --- sql/sql_class.h | 3 ++- sql/sql_insert.cc | 1 + sql/sql_union.cc | 9 +++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/sql_class.h b/sql/sql_class.h index 31da5c53bf8..fe6a7e2ed69 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -182,7 +182,7 @@ typedef struct st_copy_info { ha_rows copied; ha_rows error; enum enum_duplicates handle_duplicates; - int escape_char; + int escape_char, errorno; } COPY_INFO; @@ -666,6 +666,7 @@ class select_union :public select_result { TABLE *table; COPY_INFO info; uint save_time_stamp; + TMP_TABLE_PARAM *tmp_table_param; select_union(TABLE *table_par); ~select_union(); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index a8b80a3c435..1e00bb3f8c2 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -447,6 +447,7 @@ int write_record(TABLE *table,COPY_INFO *info) err: if (key) my_afree(key); + info->errorno= error; table->file->print_error(error,MYF(0)); return 1; } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index c8237f3ae9b..7f00ddad99f 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -132,7 +132,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) goto exit; } union_result->save_time_stamp=!describe; - + union_result->tmp_table_param=&tmp_table_param; for (sl= &lex->select_lex; sl; sl=sl->next) { lex->select=sl; @@ -253,7 +253,12 @@ bool select_union::send_data(List &values) return 0; } fill_record(table->field,values); - return write_record(table,&info) ? 1 : 0; + if ((write_record(table,&info))) + { + if (create_myisam_from_heap(table, tmp_table_param, info.errorno, 0)) + return 1; + } + return 0; } bool select_union::send_eof() -- cgit v1.2.1 From cafec2bc79f4045dd91ae404c360dca67ddfdf17 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 May 2002 20:59:50 +0200 Subject: quick fix for some optimizer glitch (it appears as ft+const bug, but it, probably, isn't) BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- sql/sql_select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c4383cbb09f..c92463d65bd 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2128,7 +2128,7 @@ get_best_combination(JOIN *join) have a 'normal' value or a NULL value. */ j->type=JT_CONST; - if (join->const_tables == tablenr) + if (join->const_tables == tablenr && !form->fulltext_searched) { join->const_tables++; join->const_table_map|=form->map; -- cgit v1.2.1 From 423bb6c2f594390701fb6e7c432e9868b0e5719b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 27 May 2002 23:21:49 +0300 Subject: Renamed stripp_sp -> strip_sp Remove end space from ENUM and SET strings mysql-test/t/type_enum.test: Test of end space in enum's Docs/manual.texi: Changelog include/my_sys.h: Renamed stripp_sp -> strip_sp mysql-test/r/type_enum.result: Test of end space in enums mysys/Makefile.am: change stripp_sp -> strip_sp mysys/mf_strip.c: change stripp_sp -> strip_sp sql/sql_db.cc: change stripp_sp -> strip_sp sql/sql_parse.cc: change stripp_sp -> strip_sp Remove end space from ENUM and SET strings --- sql/sql_db.cc | 2 +- sql/sql_parse.cc | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'sql') diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 451a48042b5..e368ef3ae94 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -320,7 +320,7 @@ bool mysql_change_db(THD *thd,const char *name) uint db_access; DBUG_ENTER("mysql_change_db"); - if (!dbname || !(length=stripp_sp(dbname))) + if (!dbname || !(length=strip_sp(dbname))) { x_free(dbname); /* purecov: inspected */ send_error(&thd->net,ER_NO_DB_ERROR); /* purecov: inspected */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 06a121ea30c..21590f743a5 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -880,7 +880,7 @@ bool do_command(THD *thd) char *db=thd->strdup(packet+1); thread_safe_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_thread_count); // null test to handle EOM - if (!db || !stripp_sp(db) || check_db_name(db)) + if (!db || !strip_sp(db) || check_db_name(db)) { net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL"); break; @@ -896,7 +896,7 @@ bool do_command(THD *thd) char *db=thd->strdup(packet+1); thread_safe_increment(com_stat[SQLCOM_DROP_DB],&LOCK_thread_count); // null test to handle EOM - if (!db || !stripp_sp(db) || check_db_name(db)) + if (!db || !strip_sp(db) || check_db_name(db)) { net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL"); break; @@ -1905,7 +1905,7 @@ mysql_execute_command(void) break; case SQLCOM_CREATE_DB: { - if (!stripp_sp(lex->name) || check_db_name(lex->name)) + if (!strip_sp(lex->name) || check_db_name(lex->name)) { net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name); break; @@ -1917,7 +1917,7 @@ mysql_execute_command(void) } case SQLCOM_DROP_DB: { - if (!stripp_sp(lex->name) || check_db_name(lex->name)) + if (!strip_sp(lex->name) || check_db_name(lex->name)) { net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name); break; @@ -2561,7 +2561,9 @@ bool add_field_to_list(char *field_name, enum_field_types type, new_field->interval=interval; new_field->length=0; for (const char **pos=interval->type_names; *pos ; pos++) - new_field->length+=(uint) strlen(*pos)+1; + { + new_field->length+=(uint) strip_sp((char*) *pos)+1; + } new_field->length--; set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1); if (default_value) @@ -2582,10 +2584,10 @@ bool add_field_to_list(char *field_name, enum_field_types type, { new_field->interval=interval; new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe - new_field->length=(uint) strlen(interval->type_names[0]); + new_field->length=(uint) strip_sp((char*) interval->type_names[0]); for (const char **pos=interval->type_names+1; *pos ; pos++) { - uint length=(uint) strlen(*pos); + uint length=(uint) strip_sp((char*) *pos); set_if_bigger(new_field->length,length); } set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1); -- cgit v1.2.1 From 39bb1a34a766824b14bca04802865cafe20660f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 May 2002 10:39:47 +0300 Subject: Small documentation change Docs/manual.texi: slave_read_timeout -> slave_net_timeout sql/mysqld.cc: Documented slave_net_timeout --- sql/mysqld.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2a118be100a..1f70829239c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3501,7 +3501,8 @@ static struct my_option my_long_options[] = (gptr*) &relay_log_space_limit, 0, GET_ULONG, REQUIRED_ARG, 0L, 0L, ULONG_MAX, 0, 1, 0}, {"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT, - "Undocumented", (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0, + "Number of seconds to wait for more data from a master/slave connection before aborting the read.", + (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0, GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, {"slow_launch_time", OPT_SLOW_LAUNCH_TIME, "If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.", -- cgit v1.2.1 From 702ae31a1afa6a043620b655872a7c41b09fb812 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 May 2002 14:04:19 +0300 Subject: ha_innobase.cc: Fix an assertion failure in ha_innobase.cc about line 302 when a user has used user level locks and closes a connection; this was reported by Jeremy Zawodny sql/ha_innobase.cc: Fix an assertion failure in ha_innobase.cc about line 302 when a user has used user level locks and closes a connection; this was reported by Jeremy Zawodny --- sql/ha_innobase.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql') diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index a741ffefbb5..5ce7869e3f8 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -649,6 +649,7 @@ innobase_close_connection( (thd->transaction.all.innobase_tid)); trx_free_for_mysql((trx_t*) (thd->transaction.all.innobase_tid)); + thd->transaction.all.innobase_tid = NULL; } return(0); -- cgit v1.2.1 From 4f725190efb6c0523ce3a898043b00d9078db03c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 May 2002 15:07:30 +0300 Subject: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. Changed some exit code names and corresponding numbers. Fixed a bug in mysqld.cc, in replication related options. Added a global flag in my_getopt, which can be set by any program that is using my_getopt, which tells whether the client should print the error message itself, or whether my_getopt should do it. The default is that my_getopt will print the error messages. client/mysql.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqladmin.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlbinlog.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlcheck.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqldump.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlimport.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlmanager-pwgen.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlmanagerc.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlshow.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqltest.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/thread_test.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/my_print_defaults.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/mysql_install.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/perror.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/resolve_stack_dump.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/resolveip.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. include/my_getopt.h: Added global (flag) variable which tells my_getopt whether to print errors or just silently exit with proper error code. include/mysys_err.h: Changed exit code names and corresponding numbers. isam/isamchk.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. isam/pack_isam.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/ft_dump.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/ft_eval.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/ft_test1.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/mi_test1.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/myisamchk.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/myisampack.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. mysys/my_getopt.c: Changed exit code names and corresponding numbers. Added a flag for checking whether my_getopt should print the error message, or whether it should be printed by the client itself. sql/gen_lex_hash.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. sql/mysqld.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. Fixed a bug when compiling in non-debug mode, some replication related options were not enabled while they should be. This made 'make test' to fail in rpl000010 when --with-debug was not used. tools/mysqlmanager.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. --- sql/gen_lex_hash.cc | 9 +++------ sql/mysqld.cc | 8 +------- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'sql') diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index ba1d27f2bf6..a4f0791d105 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -356,7 +356,7 @@ void print_arrays() static void usage(int version) { - printf("%s Ver 3.4 Distrib %s, for %s (%s)\n", + printf("%s Ver 3.5 Distrib %s, for %s (%s)\n", my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); if (version) return; @@ -394,11 +394,8 @@ static int get_options(int argc, char **argv) int ho_error; if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) - { - printf("%s: handle_options() failed with error %d\n", my_progname, - ho_error); - exit(1); - } + exit(ho_error); + if (argc >= 1) { usage(0); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2a118be100a..b8675e99b53 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3053,7 +3053,6 @@ static struct my_option my_long_options[] = */ {"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory, (gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifndef DBUG_OFF {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT, "Undocumented: Meant for debugging and testing of replication", (gptr*) &disconnect_slave_event_count, @@ -3070,7 +3069,6 @@ static struct my_option my_long_options[] = (gptr*) &opt_sporadic_binlog_dump_fail, (gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT, "Simulate memory shortage when compiled with the --with-debug=full option", 0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -4421,11 +4419,7 @@ static void get_options(int argc,char **argv) #endif if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) - { - printf("%s: handle_options() failed with error %d\n", my_progname, - ho_error); - exit(1); - } + exit(ho_error); fix_paths(); default_table_type_name=ha_table_typelib.type_names[default_table_type-1]; -- cgit v1.2.1 From a19a2d95bfa6c006da364110603122c1f4d8290e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 May 2002 15:20:36 +0300 Subject: Fixed a bug in make test, non-debug version. sql/slave.cc: Released some variables in non-debug version. These are needed in mysqld.cc my_getopt struct, which defines some options, which are used by mysql_test in a non-debug version. sql/sql_repl.cc: Released some variables in non-debug version. These are needed in mysqld.cc my_getopt struct, which defines some options, which are used by mysql_test in a non-debug version. --- sql/slave.cc | 2 -- sql/sql_repl.cc | 2 -- 2 files changed, 4 deletions(-) (limited to 'sql') diff --git a/sql/slave.cc b/sql/slave.cc index b473d8ab1e3..8a0c95ba49c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -48,12 +48,10 @@ ulong relay_log_space_limit = 0; /* TODO: fix variables to access ulonglong // can re-use them on slave start // TODO: move the vars below under MASTER_INFO -#ifndef DBUG_OFF int disconnect_slave_event_count = 0, abort_slave_event_count = 0; static int events_till_disconnect = -1; int events_till_abort = -1; static int stuck_count = 0; -#endif typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 398ff443ad4..b6c7c98a4cf 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -27,11 +27,9 @@ extern const char* any_db; -#ifndef DBUG_OFF int max_binlog_dump_events = 0; // unlimited bool opt_sporadic_binlog_dump_fail = 0; static int binlog_dump_count = 0; -#endif int check_binlog_magic(IO_CACHE* log, const char** errmsg) { -- cgit v1.2.1 From 634cc5a221ee2835d536a715bf6944350a2ecf6c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 May 2002 15:21:06 +0300 Subject: Some fixes for user resources management --- sql/sql_parse.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'sql') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 123a95070b9..4b4c085814a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -160,7 +160,7 @@ static int get_or_create_user_conn(THD *thd, const char *user, uc->connections = 1; uc->questions=uc->updates=uc->conn_per_hour=0; uc->user_resources=*mqh; - if (mqh->connections > max_user_connections) + if (max_user_connections && mqh->connections > max_user_connections) uc->user_resources.connections = max_user_connections; uc->intime=thd->thr_create_time; if (hash_insert(&hash_user_connections, (byte*) uc)) @@ -298,7 +298,7 @@ static int check_for_max_user_connections(USER_CONN *uc) goto end; } uc->connections++; -if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections) + if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections) { net_printf(¤t_thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_connections", (long) uc->user_resources.connections); @@ -317,12 +317,7 @@ static void decrease_user_connections(USER_CONN *uc) */ DBUG_ENTER("decrease_user_connections"); - if (mqh_used) - { - if (uc->conn_per_hour) - uc->conn_per_hour--; - } - else if (!--uc->connections) + if (!mqh_used && uc->connections && !--uc->connections) { /* Last connection for user; Delete it */ (void) pthread_mutex_lock(&LOCK_user_conn); -- cgit v1.2.1 From d9d8b4642d185d317309d8371aa92fc3c4355d50 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 May 2002 15:29:42 +0300 Subject: Fixed a bug. sql/slave.h: Fixed a bug in option handling. sql/sql_repl.h: Fixed a bug in option handling. --- sql/slave.h | 2 -- sql/sql_repl.h | 2 -- 2 files changed, 4 deletions(-) (limited to 'sql') diff --git a/sql/slave.h b/sql/slave.h index 34df17f2851..16735891815 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -415,9 +415,7 @@ extern bool do_table_inited, ignore_table_inited, wild_do_table_inited, wild_ignore_table_inited; extern bool table_rules_on; -#ifndef DBUG_OFF extern int disconnect_slave_event_count, abort_slave_event_count ; -#endif // the master variables are defaults read from my.cnf or command line extern uint master_port, master_connect_retry, report_port; diff --git a/sql/sql_repl.h b/sql/sql_repl.h index 360fd50a1e3..b15c72a0bde 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -21,10 +21,8 @@ extern uint32 server_id; extern bool server_id_supplied; extern I_List binlog_do_db, binlog_ignore_db; -#ifndef DBUG_OFF extern int max_binlog_dump_events; extern bool opt_sporadic_binlog_dump_fail; -#endif #define KICK_SLAVE(thd) thd->awake(0 /* do not prepare to die*/); -- cgit v1.2.1 From 1119c9a7736e8aafb8a3fe5b58b48214b8dac4e1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 May 2002 21:20:28 +0300 Subject: A very nasty bug in multi-table deletes & updates --- sql/sql_parse.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4b4c085814a..3f2d4808cbe 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1792,6 +1792,7 @@ mysql_execute_command(void) tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege); if ((res=open_and_lock_tables(thd,tables))) break; + thd->select_limit=HA_POS_ERROR; if (!setup_fields(thd,tables,select_lex->item_list,1,0,0) && !setup_fields(thd,tables,lex->value_list,0,0,0) && ! thd->fatal_error && (result=new multi_update(thd,tables,select_lex->item_list,lex->duplicates, @@ -2741,7 +2742,7 @@ void mysql_init_multi_delete(LEX *lex) { lex->sql_command = SQLCOM_DELETE_MULTI; mysql_init_select(lex); - lex->select->select_limit=HA_POS_ERROR; + lex->select->select_limit=lex->thd->select_limit=HA_POS_ERROR; lex->auxilliary_table_list=lex->select_lex.table_list; lex->select->table_list.elements=0; lex->select->table_list.first=0; -- cgit v1.2.1 From 55938d2995aa095d1ea4ebace021bdac4da47255 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 30 May 2002 17:31:25 -0700 Subject: Fixed bug: load table from master w/empty master would hang. Now it properly returns error. Added respective test case. sql/repl_failsafe.cc: fixed bug: load table from master w/ empty master would hang. Now it properly returns error. --- sql/repl_failsafe.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql') diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 257418d1682..fab1491fc2b 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -608,6 +608,9 @@ int show_slave_hosts(THD* thd) int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi) { + if (!mi->host || !*mi->host) /* empty host */ + return 1; + if (!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0, mi->port, 0, 0)) { -- cgit v1.2.1 From f6b6b2623311b5423bcf7b790c6cbd78bbe62042 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 31 May 2002 13:35:20 +0300 Subject: Fixed a problem with --skip-networking. This fix should be merged into 4.0 and 4.1 --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9ac6ea6fff8..08d0f381534 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1121,7 +1121,7 @@ void end_thread(THD *thd, bool put_in_cache) inline void kill_broken_server() { /* hack to get around signals ignored in syscalls for problem OS's */ - if (unix_sock == INVALID_SOCKET || ip_sock ==INVALID_SOCKET) + if (unix_sock == INVALID_SOCKET || (!opt_disable_networking && ip_sock ==INVALID_SOCKET)) { select_thread_in_use = 0; kill_server((void*)MYSQL_KILL_SIGNAL); /* never returns */ -- cgit v1.2.1 From 574000209abac9b33d9dabee8e86d4b7b38b6c7c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 31 May 2002 15:22:38 +0300 Subject: Portability fixes for SCO and HPUX Change TRUNCATE(number) to truncate towards zero for negative numbers Fix NULL handling for DESCRIBE table_name Docs/manual.texi: Update of TRUNCATE() information configure.in: Fix for HPUX extra/resolveip.c: Fix for SCO include/my_net.h: Fix for HPUX libmysql/libmysql.c: Removed warning on HPUX 10.20 mysql-test/r/func_math.result: Test of new TRUNCATE handling mysql-test/t/func_math.test: Test of new TRUNCATE handling mysys/my_gethostbyname.c: Portability fix sql/item_func.cc: Change TRUNCATE(number) to truncate towards zero for negative numbers sql/sql_show.cc: Fix NULL handling for DESCRIBE table_name --- sql/item_func.cc | 7 ++++++- sql/sql_show.cc | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/item_func.cc b/sql/item_func.cc index 9180cccabcf..b73436afbcf 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -601,7 +601,12 @@ double Item_func_round::val() log_10[abs_dec] : pow(10.0,(double) abs_dec)); if (truncate) - return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp; + { + if (value >= 0) + return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp; + else + return dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp; + } return dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8cfac1675b0..5db2df85fbf 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -431,6 +431,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, TABLE *table; handler *file; char tmp[MAX_FIELD_WIDTH]; + Item *item; DBUG_ENTER("mysqld_show_fields"); DBUG_PRINT("enter",("db: %s table: %s",table_list->db, table_list->real_name)); @@ -449,7 +450,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, field_list.push_back(new Item_empty_string("Type",40)); field_list.push_back(new Item_empty_string("Null",1)); field_list.push_back(new Item_empty_string("Key",3)); - field_list.push_back(new Item_empty_string("Default",NAME_LEN)); + field_list.push_back(item=new Item_empty_string("Default",NAME_LEN)); + item->maybe_null=1; field_list.push_back(new Item_empty_string("Extra",20)); if (verbose) field_list.push_back(new Item_empty_string("Privileges",80)); -- cgit v1.2.1 From bd39612d4ddf9d773e3b53844478e31f23c9da55 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 31 May 2002 16:56:02 -0700 Subject: fixed 'load table from master' hang when host is empty added respective test case sql/slave.cc: fixed load table from master hang when host is empty --- sql/slave.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql') diff --git a/sql/slave.cc b/sql/slave.cc index 946cf483e4b..c7a048e8452 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -451,6 +451,12 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi) goto err; } + if (!mi->host || !*mi->host) + { + nx_errno = ER_BAD_HOST_ERROR; + goto err; + } + safe_connect(thd, mysql, mi); if (slave_killed(thd)) goto err; -- cgit v1.2.1 From f1444392d887d9e9a7131911817814828562705e Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Jun 2002 17:04:16 +0300 Subject: Fixed bug in wait_for_relay_log_space() Added checking of sem_init() in configure. client/mysqltest.c: Cleanup configure.in: Added checking of sem_init sql/hostname.cc: Portability fix sql/slave.cc: Fixed bug in wait_for_relay_log_space() --- sql/hostname.cc | 5 ++++- sql/slave.cc | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/hostname.cc b/sql/hostname.cc index 5359f876522..bd4ec06c083 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -57,8 +57,11 @@ void hostname_cache_refresh() bool hostname_cache_init() { + host_entry *tmp; + uint offset= (uint) ((char*) (&tmp->ip) - (char*) &tmp); (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW); - if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE,offsetof(host_entry,ip), + + if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset, sizeof(struct in_addr),NULL, (void (*)(void*)) free))) return 1; diff --git a/sql/slave.cc b/sql/slave.cc index b473d8ab1e3..19e093a75d2 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1118,11 +1118,11 @@ static inline int add_relay_log(RELAY_LOG_INFO* rli,LOG_INFO* linfo) static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli) { - bool slave_killed; - LINT_INIT(slave_killed); + bool slave_killed=0; MASTER_INFO* mi = rli->mi; const char* save_proc_info; THD* thd = mi->io_thd; + DBUG_ENTER("wait_for_relay_log_space"); pthread_mutex_lock(&rli->log_space_lock); save_proc_info = thd->proc_info; -- cgit v1.2.1