diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/Makefile.am | 2 | ||||
-rw-r--r-- | sql/client_settings.h | 21 | ||||
-rw-r--r-- | sql/field.h | 15 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 2 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 7 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 13 | ||||
-rw-r--r-- | sql/item_strfunc.h | 10 | ||||
-rw-r--r-- | sql/log.cc | 12 | ||||
-rw-r--r-- | sql/log_event.cc | 59 | ||||
-rw-r--r-- | sql/log_event.h | 119 | ||||
-rw-r--r-- | sql/mysql_priv.h | 4 | ||||
-rw-r--r-- | sql/mysqld.cc | 306 | ||||
-rw-r--r-- | sql/protocol.cc | 3 | ||||
-rw-r--r-- | sql/repl_failsafe.cc | 21 | ||||
-rw-r--r-- | sql/set_var.cc | 21 | ||||
-rw-r--r-- | sql/set_var.h | 9 | ||||
-rw-r--r-- | sql/share/charsets/Index.xml | 4 | ||||
-rw-r--r-- | sql/share/english/errmsg.txt | 6 | ||||
-rw-r--r-- | sql/slave.cc | 128 | ||||
-rw-r--r-- | sql/slave.h | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 14 | ||||
-rw-r--r-- | sql/sql_client.cc | 45 | ||||
-rw-r--r-- | sql/sql_insert.cc | 15 | ||||
-rw-r--r-- | sql/sql_parse.cc | 1 | ||||
-rw-r--r-- | sql/sql_select.cc | 5 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 6 |
26 files changed, 535 insertions, 315 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am index 7c98f1a9315..fd02cc906d7 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -84,7 +84,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ slave.cc sql_repl.cc sql_union.cc sql_derived.cc \ - client.c mini_client_errors.c pack.c\ + client.c sql_client.cc mini_client_errors.c pack.c\ stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\ gstream.cc spatial.cc sql_help.cc protocol_cursor.cc gen_lex_hash_SOURCES = gen_lex_hash.cc diff --git a/sql/client_settings.h b/sql/client_settings.h index 206f00ba3fe..5a16fdd1c2f 100644 --- a/sql/client_settings.h +++ b/sql/client_settings.h @@ -17,20 +17,19 @@ #include <thr_alarm.h> -extern char *mysql_unix_port; - -#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG \ - | CLIENT_LOCAL_FILES | CLIENT_SECURE_CONNECTION) - +#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \ + CLIENT_SECURE_CONNECTION | CLIENT_TRANSACTIONS | \ + CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION) #define init_sigpipe_variables #define set_sigpipe(mysql) #define reset_sigpipe(mysql) - -extern ulong slave_net_timeout; - -#ifdef HAVE_SMEM +#define read_user_name(A) {} +#define mysql_rpl_query_type(A,B) MYSQL_RPL_ADMIN +#define mysql_master_send_query(A, B, C) 1 +#define mysql_slave_send_query(A, B, C) 1 +#define mysql_rpl_probe(mysql) 0 #undef HAVE_SMEM -#endif - #define CLI_MYSQL_USE_RESULT NULL +#undef _CUSTOMCONFIG_ + diff --git a/sql/field.h b/sql/field.h index 4456eb36731..a72ccfa8354 100644 --- a/sql/field.h +++ b/sql/field.h @@ -37,7 +37,11 @@ class Field void operator=(Field &); public: static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } - static void operator delete(void *ptr_arg, size_t size) {} /*lint -e715 */ + static void operator delete(void *ptr_arg, size_t size) { +#ifdef PEDANTIC_SAFEMALLOC + bfill(ptr_arg, size, 0x8F); +#endif + } char *ptr; // Position to field in record uchar *null_ptr; // Byte where null_bit is @@ -46,7 +50,7 @@ public: LEX_STRING comment; ulong query_id; // For quick test of used fields /* Field is part of the following keys */ - key_map key_start,part_of_key,part_of_sortkey; + key_map key_start,part_of_key,part_of_sortkey; enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL, CHECK,EMPTY,UNKNOWN_FIELD,CASEDN,NEXT_NUMBER,INTERVAL_FIELD, BIT_FIELD, TIMESTAMP_FIELD,CAPITALIZE,BLOB_FIELD}; @@ -130,6 +134,7 @@ public: virtual void sort_string(char *buff,uint length)=0; virtual bool optimize_range(uint idx); virtual bool store_for_compare() { return 0; } + virtual void free() {} Field *new_field(MEM_ROOT *root, struct st_table *new_table) { Field *tmp= (Field*) memdup_root(root,(char*) this,size_of()); @@ -933,11 +938,11 @@ public: int pack_cmp(const char *b, uint key_length); uint packed_col_length(const char *col_ptr, uint length); uint max_packed_col_length(uint max_length); - inline void free() { value.free(); } + void free() { value.free(); } inline void clear_temporary() { bzero((char*) &value,sizeof(value)); } friend void field_conv(Field *to,Field *from); uint size_of() const { return sizeof(*this); } - bool has_charset(void) const + bool has_charset(void) const { return charset() == &my_charset_bin ? FALSE : TRUE; } }; @@ -945,7 +950,7 @@ public: class Field_geom :public Field_blob { public: enum geometry_type geom_type; - + Field_geom(char *ptr_arg, uchar *null_ptr_arg, uint null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg,uint blob_pack_length, diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 74036edf605..d4997f78a9e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1652,7 +1652,9 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) { List_iterator<Item> li(list); Item *item; +#ifndef EMBEDDED_LIBRARY char buff[sizeof(char*)]; // Max local vars in function +#endif used_tables_cache=0; const_item_cache=0; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 4438b902011..549839b4f96 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -263,13 +263,6 @@ class Item_func_strcmp :public Item_bool_func2 public: Item_func_strcmp(Item *a,Item *b) :Item_bool_func2(a,b) {} longlong val_int(); - void fix_length_and_dec() - { - max_length=2; - /* QQ: COERCIBILITY */ - cmp_charset= args[0]->binary() || args[1]->binary() ? - &my_charset_bin : args[0]->charset(); - } optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "strcmp"; } }; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index e5b73e7670f..d660f7c472c 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -702,6 +702,7 @@ String *Item_func_reverse::val_str(String *str) void Item_func_reverse::fix_length_and_dec() { + set_charset(args[0]->charset(),args[0]->coercibility); max_length = args[0]->max_length; } @@ -860,6 +861,14 @@ null: void Item_func_insert::fix_length_and_dec() { + if (set_charset(args[0]->charset(), args[0]->coercibility, + args[3]->charset(), args[3]->coercibility)) + { + my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0), + args[0]->charset()->name,coercion_name(args[0]->coercibility), + args[3]->charset()->name,coercion_name(args[3]->coercibility), + func_name()); + } max_length=args[0]->max_length+args[3]->max_length; if (max_length > MAX_BLOB_WIDTH) { @@ -1521,6 +1530,7 @@ String *Item_func_user::val_str(String *str) void Item_func_soundex::fix_length_and_dec() { + set_charset(args[0]->charset(), args[0]->coercibility); max_length=args[0]->max_length; set_if_bigger(max_length,4); } @@ -1552,7 +1562,7 @@ String *Item_func_soundex::val_str(String *str) { String *res =args[0]->val_str(str); char last_ch,ch; - CHARSET_INFO *cs= &my_charset_latin1; + CHARSET_INFO *cs= charset(); if ((null_value=args[0]->null_value)) return 0; /* purecov: inspected */ @@ -2538,6 +2548,7 @@ String *Item_func_quote::val_str(String *str) } *to= '\''; str->length(new_length); + str->set_charset(charset()); return str; null: diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index a70c9b39255..26c69668b0a 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -536,8 +536,8 @@ public: const char *func_name() const { return "load_file"; } void fix_length_and_dec() { - set_charset(&my_charset_bin); - maybe_null=1; + set_charset(&my_charset_bin, COER_COERCIBLE); + maybe_null=1; max_length=MAX_BLOB_WIDTH; } }; @@ -571,7 +571,11 @@ public: Item_func_quote(Item *a) :Item_str_func(a) {} const char *func_name() const { return "quote"; } String *val_str(String *); - void fix_length_and_dec() { max_length= args[0]->max_length * 2 + 2; } + void fix_length_and_dec() + { + set_charset(args[0]->charset(), args[0]->coercibility); + max_length= args[0]->max_length * 2 + 2; + } }; class Item_func_conv_charset :public Item_str_func diff --git a/sql/log.cc b/sql/log.cc index 0ccb40c5246..dd544dcac93 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -209,9 +209,9 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, #ifdef EMBEDDED_LIBRARY sprintf(buff, "%s, Version: %s, embedded library\n", my_progname, server_version); #elif __NT__ - sprintf(buff, "%s, Version: %s, started with:\nTCP Port: %d, Named Pipe: %s\n", my_progname, server_version, mysql_port, mysql_unix_port); + sprintf(buff, "%s, Version: %s, started with:\nTCP Port: %d, Named Pipe: %s\n", my_progname, server_version, mysqld_port, mysqld_unix_port); #else - sprintf(buff, "%s, Version: %s, started with:\nTcp port: %d Unix socket: %s\n", my_progname,server_version,mysql_port,mysql_unix_port); + sprintf(buff, "%s, Version: %s, started with:\nTcp port: %d Unix socket: %s\n", my_progname,server_version,mysqld_port,mysqld_unix_port); #endif end=strmov(strend(buff),"Time Id Command Argument\n"); if (my_b_write(&log_file, (byte*) buff,(uint) (end-buff)) || @@ -966,14 +966,6 @@ void MYSQL_LOG::new_file(bool need_lock) THD* thd = current_thd; Rotate_log_event r(thd,new_name+dirname_length(new_name)); r.set_log_pos(this); - - /* - Because this log rotation could have been initiated by a master of - the slave running with log-bin, we set the flag on rotate - event to prevent infinite log rotation loop - */ - if (thd->slave_thread) - r.flags|= LOG_EVENT_FORCED_ROTATE_F; r.write(&log_file); bytes_written += r.get_event_len(); } diff --git a/sql/log_event.cc b/sql/log_event.cc index 3d500ede462..98a877616e0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1057,7 +1057,8 @@ int Start_log_event::write_data(IO_CACHE* file) The master started IMPLEMENTATION - - To handle the case where the master died without a stop event, + - To handle the case where the master died without having time to write DROP + TEMPORARY TABLE, DO RELEASE_LOCK (prepared statements' deletion is TODO), we clean up all temporary tables + locks that we got. However, we don't clean temporary tables if the master was 3.23 (this is because a 3.23 master writes a Start_log_event at every @@ -1065,11 +1066,20 @@ int Start_log_event::write_data(IO_CACHE* file) on the slave when FLUSH LOGS is issued on the master). TODO - - Remove all active user locks + - Remove all active user locks. + Guilhem 2003-06: this is true but not urgent: the worst it can cause is + the use of a bit of memory for a user lock which will not be used + anymore. If the user lock is later used, the old one will be released. In + other words, no deadlock problem. - If we have an active transaction at this point, the master died in the middle while writing the transaction to the binary log. In this case we should stop the slave. - + Guilhem 2003-06: I don't think we should. As the binlog is written before + the table changes are committed, rollback has occured on the master; we + should rather rollback on the slave and go on. If we don't rollback, and + the next query is not BEGIN, then it will be considered as part of the + unfinished transaction, and so will be rolled back at next BEGIN, which is + a bug. */ #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) @@ -1079,6 +1089,11 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli) if (!rli->mi->old_format) { + /* + If the master died before writing the COMMIT to the binlog, rollback; + otherwise it does not hurt to rollback. + */ + ha_rollback(thd); /* If 4.0 master, all temporary tables have been deleted on the master; if 3.23 master, this is far from sure. @@ -1703,8 +1718,6 @@ void Rotate_log_event::pack_info(Protocol *protocol) b_pos+= ident_len; b_pos= strmov(b_pos, ";pos="); b_pos=longlong10_to_str(pos, b_pos, 10); - if (flags & LOG_EVENT_FORCED_ROTATE_F) - b_pos= strmov(b_pos ,"; forced by master"); protocol->store(buf, b_pos-buf, &my_charset_bin); my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); } @@ -1728,8 +1741,6 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db) my_fwrite(file, (byte*) new_log_ident, (uint)ident_len, MYF(MY_NABP | MY_WME)); fprintf(file, " pos: %s", llstr(pos, buf)); - if (flags & LOG_EVENT_FORCED_ROTATE_F) - fprintf(file," forced by master"); fputc('\n', file); fflush(file); } @@ -2399,29 +2410,21 @@ void Stop_log_event::print(FILE* file, bool short_form, char* last_db) /* Stop_log_event::exec_event() - The master stopped. Clean up all temporary tables + locks that the - master may have set. - - TODO - - Remove all active user locks + The master stopped. + We used to clean up all temporary tables but this is useless as, as the master + has shut down properly, it has written all DROP TEMPORARY TABLE and DO + RELEASE_LOCK (prepared statements' deletion is TODO). + We used to clean up slave_load_tmpdir, but this is useless as it has been + cleared at the end of LOAD DATA INFILE. + So we have nothing to do here. + The place were we must do this cleaning is in Start_log_event::exec_event(), + not here. Because if we come here, the master was sane. */ #ifndef MYSQL_CLIENT int Stop_log_event::exec_event(struct st_relay_log_info* rli) { /* - do not clean up immediately after rotate event; - QQ: this should be a useless test: the only case when it is false is when - shutdown occurred just after FLUSH LOGS. It has nothing to do with Rotate? - By the way, immediately after a Rotate the I/O thread does not write - the Stop to the relay log, so we won't come here in that case. - */ - if (rli->group_master_log_pos > BIN_LOG_HEADER_SIZE) - { - close_temporary_tables(thd); - cleanup_load_tmpdir(); - } - /* We do not want to update master_log pos because we get a rotate event before stop, so by now group_master_log_name is set to the next log. If we updated it, we will have incorrect master coordinates and this @@ -2965,10 +2968,10 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) goto err; } /* - We want to disable binary logging in slave thread because we need the file - events to appear in the same order as they do on the master relative to - other events, so that we can preserve ascending order of log sequence - numbers - needed to handle failover . + We are going to create a Load_log_event to finally load into the table. + This event should not go into the binlog: in the binlog we only want the + Create_file, Append_blocks and Execute_load. We disable binary logging and + restore the thread's options just after finishing the load. */ save_options = thd->options; thd->options &= ~ (ulong) (OPTION_BIN_LOG); diff --git a/sql/log_event.h b/sql/log_event.h index 1d2fc741fa8..bd5e1a82be4 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -34,15 +34,21 @@ #define LOG_READ_TOO_LARGE -7 #define LOG_EVENT_OFFSET 4 + #define BINLOG_VERSION 3 /* We could have used SERVER_VERSION_LENGTH, but this introduces an obscure dependency - if somebody decided to change SERVER_VERSION_LENGTH - this would have broke the replication protocol + this would have broken the replication protocol */ #define ST_SERVER_VER_LEN 50 +/* + These are flags and structs to handle all the LOAD DATA INFILE options (LINES + TERMINATED etc). +*/ + #define DUMPFILE_FLAG 0x1 #define OPT_ENCLOSED_FLAG 0x2 #define REPLACE_FLAG 0x4 @@ -121,11 +127,17 @@ struct sql_ex_info See the #defines below for the format specifics. + The events which really update data are Query_log_event and + Load_log_event/Create_file_log_event/Execute_load_log_event (these 3 act + together to replicate LOAD DATA INFILE, with the help of + Append_block_log_event which prepares temporary files to load into the table). + ****************************************************************************/ +#define LOG_EVENT_HEADER_LEN 19 /* the fixed header length */ +#define OLD_HEADER_LEN 13 /* the fixed header length in 3.23 */ + /* event-specific post-header sizes */ -#define LOG_EVENT_HEADER_LEN 19 -#define OLD_HEADER_LEN 13 #define QUERY_HEADER_LEN (4 + 4 + 1 + 2) #define LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4) #define START_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4) @@ -135,7 +147,10 @@ struct sql_ex_info #define EXEC_LOAD_HEADER_LEN 4 #define DELETE_FILE_HEADER_LEN 4 -/* event header offsets */ +/* + Event header offsets; + these point to places inside the fixed header. +*/ #define EVENT_TYPE_OFFSET 4 #define SERVER_ID_OFFSET 5 @@ -149,7 +164,7 @@ struct sql_ex_info #define ST_SERVER_VER_OFFSET 2 #define ST_CREATED_OFFSET (ST_SERVER_VER_OFFSET + ST_SERVER_VER_LEN) -/* slave event post-header */ +/* slave event post-header (this event is never written) */ #define SL_MASTER_PORT_OFFSET 8 #define SL_MASTER_POS_OFFSET 0 @@ -197,14 +212,20 @@ struct sql_ex_info #define R_POS_OFFSET 0 #define R_IDENT_OFFSET 8 +/* CF to DF handle LOAD DATA INFILE */ + +/* CF = "Create File" */ #define CF_FILE_ID_OFFSET 0 #define CF_DATA_OFFSET CREATE_FILE_HEADER_LEN +/* AB = "Append Block" */ #define AB_FILE_ID_OFFSET 0 #define AB_DATA_OFFSET APPEND_BLOCK_HEADER_LEN +/* EL = "Execute Load" */ #define EL_FILE_ID_OFFSET 0 +/* DF = "Delete File" */ #define DF_FILE_ID_OFFSET 0 #define QUERY_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+QUERY_HEADER_LEN) @@ -217,13 +238,31 @@ struct sql_ex_info #define EXEC_LOAD_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+EXEC_LOAD_HEADER_LEN) #define APPEND_BLOCK_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+APPEND_BLOCK_HEADER_LEN) - +/* 4 bytes which all binlogs should begin with */ #define BINLOG_MAGIC "\xfe\x62\x69\x6e" +/* + The 2 flags below were useless : + - the first one was never set + - the second one was set in all Rotate events on the master, but not used for + anything useful. + So they are now removed and their place may later be reused for other + flags. Then one must remember that Rotate events in 4.x have + LOG_EVENT_FORCED_ROTATE_F set, so one should not rely on the value of the + replacing flag when reading a Rotate event. + I keep the defines here just to remember what they were. +*/ +#ifdef TO_BE_REMOVED #define LOG_EVENT_TIME_F 0x1 -#define LOG_EVENT_FORCED_ROTATE_F 0x2 -#define LOG_EVENT_THREAD_SPECIFIC_F 0x4 /* query depends on thread - (for example: TEMPORARY TABLE) */ +#define LOG_EVENT_FORCED_ROTATE_F 0x2 +#endif +/* + If the query depends on the thread (for example: TEMPORARY TABLE). + Currently this is used by mysqlbinlog to know it must print + SET @@PSEUDO_THREAD_ID=xx; before the query (it would not hurt to print it + for every query but this would be slow). +*/ +#define LOG_EVENT_THREAD_SPECIFIC_F 0x4 enum Log_event_type { @@ -258,30 +297,81 @@ struct st_relay_log_info; class Log_event { public: + /* + The offset in the log where this event originally appeared (it is preserved + in relay logs, making SHOW SLAVE STATUS able to print coordinates of the + event in the master's binlog). Note: when a transaction is written by the + master to its binlog (wrapped in BEGIN/COMMIT) the log_pos of all the + queries it contains is the one of the BEGIN (this way, when one does SHOW + SLAVE STATUS it sees the offset of the BEGIN, which is logical as rollback + may occur), except the COMMIT query which has its real offset. + */ my_off_t log_pos; - char *temp_buf; + /* + A temp buffer for read_log_event; it is later analysed according to the + event's type, and its content is distributed in the event-specific fields. + */ + char *temp_buf; + /* + Timestamp on the master(for debugging and replication of NOW()/TIMESTAMP). + It is important for queries and LOAD DATA INFILE. This is set at the event's + creation time, except for Query and Load (et al.) events where this is set + at the query's execution time, which guarantees good replication (otherwise, + we could have a query and its event with different timestamps). + */ time_t when; + /* The number of seconds the query took to run on the master. */ ulong exec_time; + /* + The master's server id (is preserved in the relay log; used to prevent from + infinite loops in circular replication). + */ uint32 server_id; uint cached_event_len; + + /* + Some 16 flags. Only one is really used now; look above for + LOG_EVENT_TIME_F, LOG_EVENT_FORCED_ROTATE_F, LOG_EVENT_THREAD_SPECIFIC_F + for notes. + */ uint16 flags; + bool cache_stmt; #ifndef MYSQL_CLIENT THD* thd; Log_event(THD* thd_arg, uint16 flags_arg, bool cache_stmt); Log_event(); + /* + read_log_event() functions read an event from a binlog or relay log; used by + SHOW BINLOG EVENTS, the binlog_dump thread on the master (reads master's + binlog), the slave IO thread (reads the event sent by binlog_dump), the + slave SQL thread (reads the event from the relay log). + */ // if mutex is 0, the read will proceed without mutex static Log_event* read_log_event(IO_CACHE* file, pthread_mutex_t* log_lock, bool old_format); static int read_log_event(IO_CACHE* file, String* packet, pthread_mutex_t* log_lock); + /* set_log_pos() is used to fill log_pos with tell(log). */ void set_log_pos(MYSQL_LOG* log); + /* + init_show_field_list() prepares the column names and types for the output of + SHOW BINLOG EVENTS; it is used only by SHOW BINLOG EVENTS. + */ static void init_show_field_list(List<Item>* field_list); #ifdef HAVE_REPLICATION int net_send(Protocol *protocol, const char* log_name, my_off_t pos); + /* + pack_info() is used by SHOW BINLOG EVENTS; as print() it prepares and sends + a string to display to the user, so it resembles print(). + */ virtual void pack_info(Protocol *protocol); + /* + The SQL slave thread calls exec_event() to execute the event; this is where + the slave's data is modified. + */ virtual int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ virtual const char* get_db() @@ -291,6 +381,7 @@ public: #else // avoid having to link mysqlbinlog against libpthread static Log_event* read_log_event(IO_CACHE* file, bool old_format); + /* print*() functions are used by mysqlbinlog */ virtual void print(FILE* file, bool short_form = 0, char* last_db = 0) = 0; void print_timestamp(FILE* file, time_t *ts = 0); void print_header(FILE* file); @@ -336,6 +427,7 @@ public: } static Log_event* read_log_event(const char* buf, int event_len, const char **error, bool old_format); + /* returns the human readable name of the event's type */ const char* get_type_str(); }; @@ -403,6 +495,8 @@ public: /***************************************************************************** Slave Log Event class + Note that this class is currently not used at all; no code writes a + Slave_log_event (though some code in repl_failsafe.cc reads Slave_log_event). ****************************************************************************/ class Slave_log_event: public Log_event @@ -593,7 +687,7 @@ public: Rand Log Event class - Logs random seed used by the next RAND() + Logs random seed used by the next RAND(), and by PASSWORD() in 4.1. ****************************************************************************/ class Rand_log_event: public Log_event @@ -626,6 +720,9 @@ class Rand_log_event: public Log_event User var Log Event class + Every time a query uses the value of a user variable, a User_var_log_event is + written before the Query_log_event, to set the user variable. + ****************************************************************************/ class User_var_log_event: public Log_event { diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 0508d0aa986..432ca533c6a 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -732,7 +732,7 @@ extern ulong specialflag, current_pid; extern ulong expire_logs_days; extern my_bool relay_log_purge; extern uint test_flags,select_errors,ha_open_options; -extern uint protocol_version,dropping_tables; +extern uint protocol_version, mysqld_port, dropping_tables; extern uint delay_key_write_options; extern bool opt_endinfo, using_udf_functions, locked_in_memory; extern bool opt_using_transactions, mysql_embedded; @@ -747,7 +747,7 @@ extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern my_bool opt_readonly; extern my_bool opt_enable_named_pipe; extern my_bool opt_old_passwords, use_old_passwords; -extern char *shared_memory_base_name; +extern char *shared_memory_base_name, *mysqld_unix_port; extern bool opt_enable_shared_memory; extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3f3b2ee7c9f..39fff130d10 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -35,6 +35,7 @@ #include <nisam.h> #include <thr_alarm.h> #include <ft_global.h> +#include <errmsg.h> #define mysqld_charset &my_charset_latin1 @@ -254,7 +255,7 @@ my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam; my_bool opt_readonly, use_temp_pool, relay_log_purge; volatile bool mqh_used = 0; -uint mysql_port, test_flags, select_errors, dropping_tables, ha_open_options; +uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options; uint delay_key_write_options, protocol_version; uint volatile thread_count, thread_running, kill_cached_threads, wake_thread; @@ -303,7 +304,7 @@ char mysql_real_data_home[FN_REFLEN], char *language_ptr, *default_collation_name, *default_character_set_name; char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home; char server_version[SERVER_VERSION_LENGTH]=MYSQL_SERVER_VERSION; -char *mysql_unix_port, *opt_mysql_tmpdir; +char *mysqld_unix_port, *opt_mysql_tmpdir; char *my_bind_addr_str; const char **errmesg; /* Error messages */ const char *myisam_recover_options_str="OFF"; @@ -561,7 +562,7 @@ static void close_connections(void) { (void) shutdown(unix_sock,2); (void) closesocket(unix_sock); - (void) unlink(mysql_unix_port); + (void) unlink(mysqld_unix_port); unix_sock= INVALID_SOCKET; } #endif @@ -670,7 +671,7 @@ static void close_server_sock() DBUG_PRINT("info",("calling closesocket on unix/IP socket")); VOID(closesocket(tmp_sock)); #endif - VOID(unlink(mysql_unix_port)); + VOID(unlink(mysqld_unix_port)); } DBUG_VOID_RETURN; #endif @@ -961,24 +962,24 @@ static void clean_up_mutexes() static void set_ports() { char *env; - if (!mysql_port && !opt_disable_networking) + if (!mysqld_port && !opt_disable_networking) { // Get port if not from commandline struct servent *serv_ptr; - mysql_port = MYSQL_PORT; - if ((serv_ptr = getservbyname("mysql", "tcp"))) - mysql_port = ntohs((u_short) serv_ptr->s_port); /* purecov: inspected */ + mysqld_port= MYSQL_PORT; + if ((serv_ptr= getservbyname("mysql", "tcp"))) + mysqld_port= ntohs((u_short) serv_ptr->s_port); /* purecov: inspected */ if ((env = getenv("MYSQL_TCP_PORT"))) - mysql_port = (uint) atoi(env); /* purecov: inspected */ + mysqld_port= (uint) atoi(env); /* purecov: inspected */ } - if (!mysql_unix_port) + if (!mysqld_unix_port) { #ifdef __WIN__ - mysql_unix_port = (char*) MYSQL_NAMEDPIPE; + mysqld_unix_port= (char*) MYSQL_NAMEDPIPE; #else - mysql_unix_port = (char*) MYSQL_UNIX_ADDR; + mysqld_unix_port= (char*) MYSQL_UNIX_ADDR; #endif if ((env = getenv("MYSQL_UNIX_PORT"))) - mysql_unix_port = env; /* purecov: inspected */ + mysqld_unix_port= env; /* purecov: inspected */ } } @@ -1088,9 +1089,9 @@ static void server_init(void) set_ports(); - if (mysql_port != 0 && !opt_disable_networking && !opt_bootstrap) + if (mysqld_port != 0 && !opt_disable_networking && !opt_bootstrap) { - DBUG_PRINT("general",("IP Socket is %d",mysql_port)); + DBUG_PRINT("general",("IP Socket is %d",mysqld_port)); ip_sock = socket(AF_INET, SOCK_STREAM, 0); if (ip_sock == INVALID_SOCKET) { @@ -1101,14 +1102,14 @@ static void server_init(void) bzero((char*) &IPaddr, sizeof(IPaddr)); IPaddr.sin_family = AF_INET; IPaddr.sin_addr.s_addr = my_bind_addr; - IPaddr.sin_port = (unsigned short) htons((unsigned short) mysql_port); + IPaddr.sin_port = (unsigned short) htons((unsigned short) mysqld_port); (void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg)); if (bind(ip_sock, my_reinterpret_cast(struct sockaddr *) (&IPaddr), sizeof(IPaddr)) < 0) { DBUG_PRINT("error",("Got error: %d from bind",socket_errno)); 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); + sql_print_error("Do you already have another mysqld server running on port: %d ?",mysqld_port); unireg_abort(1); } if (listen(ip_sock,(int) back_log) < 0) @@ -1123,10 +1124,10 @@ static void server_init(void) #ifdef __NT__ /* create named pipe */ - if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap && + if (Service.IsNT() && mysqld_unix_port[0] && !opt_bootstrap && opt_enable_named_pipe) { - sprintf(szPipeName, "\\\\.\\pipe\\%s", mysql_unix_port ); + sprintf(szPipeName, "\\\\.\\pipe\\%s", mysqld_unix_port ); ZeroMemory( &saPipeSecurity, sizeof(saPipeSecurity) ); ZeroMemory( &sdPipeDescriptor, sizeof(sdPipeDescriptor) ); if ( !InitializeSecurityDescriptor(&sdPipeDescriptor, @@ -1172,9 +1173,9 @@ static void server_init(void) /* ** Create the UNIX socket */ - if (mysql_unix_port[0] && !opt_bootstrap) + if (mysqld_unix_port[0] && !opt_bootstrap) { - DBUG_PRINT("general",("UNIX Socket is %s",mysql_unix_port)); + DBUG_PRINT("general",("UNIX Socket is %s",mysqld_unix_port)); if ((unix_sock= socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { @@ -1183,8 +1184,8 @@ static void server_init(void) } bzero((char*) &UNIXaddr, sizeof(UNIXaddr)); UNIXaddr.sun_family = AF_UNIX; - strmov(UNIXaddr.sun_path, mysql_unix_port); - (void) unlink(mysql_unix_port); + strmov(UNIXaddr.sun_path, mysqld_unix_port); + (void) unlink(mysqld_unix_port); (void) setsockopt(unix_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg, sizeof(arg)); umask(0); @@ -1192,12 +1193,12 @@ static void server_init(void) sizeof(UNIXaddr)) < 0) { sql_perror("Can't start server : Bind on unix socket"); /* purecov: tested */ - sql_print_error("Do you already have another mysqld server running on socket: %s ?",mysql_unix_port); + sql_print_error("Do you already have another mysqld server running on socket: %s ?",mysqld_unix_port); unireg_abort(1); /* purecov: tested */ } umask(((~my_umask) & 0666)); #if defined(S_IFSOCK) && defined(SECURE_SOCKETS) - (void) chmod(mysql_unix_port,S_IFSOCK); /* Fix solaris 2.6 bug */ + (void) chmod(mysqld_unix_port,S_IFSOCK); /* Fix solaris 2.6 bug */ #endif if (listen(unix_sock,(int) back_log) < 0) sql_print_error("Warning: listen() on Unix socket failed with error %d", @@ -2024,6 +2025,7 @@ static int init_common_variables(const char *conf_file_name, int argc, #endif unireg_init(opt_specialflag); /* Set up extern variabels */ init_errmessage(); /* Read error messages from file */ + init_client_errs(); lex_init(); item_init(); set_var_init(); @@ -2426,7 +2428,7 @@ The server will not act as a slave."); (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore #endif if (unix_sock != INVALID_SOCKET) - unlink(mysql_unix_port); + unlink(mysqld_unix_port); exit(1); } if (!opt_noacl) @@ -2458,8 +2460,8 @@ The server will not act as a slave."); create_maintenance_thread(); printf(ER(ER_READY),my_progname,server_version, - ((unix_sock == INVALID_SOCKET) ? (char*) "" : mysql_unix_port), - mysql_port); + ((unix_sock == INVALID_SOCKET) ? (char*) "" : mysqld_unix_port), + mysqld_port); fflush(stdout); #if defined(__NT__) || defined(HAVE_SMEM) @@ -3463,108 +3465,108 @@ enum options struct my_option my_long_options[] = { - {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0, + {"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", OPT_BDB_HOME, "Berkeley home directory", (gptr*) &berkeley_home, + {"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)", + "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", + {"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, + "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, + {"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, + "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", + {"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 */ {"bdb", OPT_BDB, "Enable Berkeley DB (if this version of MySQL supports it). \ -Disable with --skip-bdb (will save memory)", +Disable with --skip-bdb (will save memory).", (gptr*) &opt_bdb, (gptr*) &opt_bdb, 0, GET_BOOL, NO_ARG, 1, 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)", + "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", + "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", + {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.", (gptr*) &my_bind_addr_str, (gptr*) &my_bind_addr_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts", 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}, - {"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows", + {"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows.", (gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef __WIN__ {"standalone", OPT_STANDALONE, - "Dummy option to start as a standalone program (NT)", 0, 0, 0, GET_NO_ARG, + "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, + {"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, + "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, + {"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, + "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", + "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_character_set_name, (gptr*) &default_character_set_name, + {"default-character-set", 'C', "Set the default character set.", + (gptr*) &default_character_set_name, (gptr*) &default_character_set_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation", + {"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation.", (gptr*) &default_collation_name, (gptr*) &default_collation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"default-table-type", OPT_TABLE_TYPE, - "Set the default table type for tables", 0, 0, + "Set the default table type for tables.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE", + {"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.", 0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL, - "Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead)", + "Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"enable-locking", OPT_ENABLE_LOCK, - "Deprecated option, use --external-locking instead", + "Deprecated option, use --external-locking instead.", (gptr*) &opt_external_locking, (gptr*) &opt_external_locking, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef __NT__ - {"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (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", + {"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}, #ifdef HAVE_SMEM @@ -3574,23 +3576,23 @@ Disable with --skip-bdb (will save memory)", #endif {"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, + {"flush", OPT_FLUSH, "Flush tables to disk between SQL commands.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, { "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN, "The maximum length of the result of function group_concat.", - (gptr*) &global_system_variables.group_concat_max_len, + (gptr*) &global_system_variables.group_concat_max_len, (gptr*) &max_system_variables.group_concat_max_len, 0, GET_ULONG, REQUIRED_ARG, 1024, 4, (long) ~0, 0, 1, 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, + {"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", + "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", OPT_INNODB_DATA_HOME_DIR, - "The common part for Innodb table spaces", (gptr*) &innobase_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, @@ -3598,53 +3600,52 @@ Disable with --skip-bdb (will save memory)", (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, + "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, + "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 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second)", + "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).", (gptr*) &innobase_flush_log_at_trx_commit, (gptr*) &innobase_flush_log_at_trx_commit, 0, GET_UINT, OPT_ARG, 1, 0, 2, 0, 0, 0}, {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD, - "With which method to flush data", (gptr*) &innobase_unix_file_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, + "Speeds up server shutdown process.", (gptr*) &innobase_fast_shutdown, (gptr*) &innobase_fast_shutdown, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT, - "Percentage of dirty pages allowed in bufferpool", (gptr*) &srv_max_buf_pool_modified_pct, + "Percentage of dirty pages allowed in bufferpool.", (gptr*) &srv_max_buf_pool_modified_pct, (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0}, - #endif /* End HAVE_INNOBASE_DB */ - {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, + {"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", + {"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, + {"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", + "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)", + "Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).", (gptr*) &opt_local_infile, (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"log-bin", OPT_BIN_LOG, - "Log update queries in binary format", + "Log update queries in binary format.", (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", + "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", + {"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, @@ -3652,18 +3653,18 @@ Disable with --skip-bdb (will save memory)", (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", + "Log slow queries to this log file. Defaults logging to hostname-slow.log file.", (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, + "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. 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", + "INSERT/DELETE/UPDATE has lower priority than selects.", (gptr*) &global_system_variables.low_priority_updates, (gptr*) &max_system_variables.low_priority_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -3679,7 +3680,7 @@ Disable with --skip-bdb (will save memory)", "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", + "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, @@ -3723,61 +3724,61 @@ Does nothing yet.", "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}, - {"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory, + {"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}, #ifdef HAVE_REPLICATION {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT, - "Option used by mysql-test for debugging and testing of replication", + "Option used by mysql-test 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, - "Option used by mysql-test for debugging and testing of replication", + "Option used by mysql-test 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, - "Option used by mysql-test for debugging and testing of replication", + "Option used by mysql-test for debugging and testing of replication.", (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, - "Option used by mysql-test for debugging and testing of replication", + "Option used by mysql-test for debugging and testing of replication.", (gptr*) &opt_sporadic_binlog_dump_fail, (gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ {"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT, - "Simulate memory shortage when compiled with the --with-debug=full option", + "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", + {"new", 'n', "Use very new possible 'unsafe' functions.", (gptr*) &global_system_variables.new_mode, (gptr*) &max_system_variables.new_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef NOT_YET - {"no-mix-table-types", OPT_NO_MIX_TYPE, "Don't allow commands with uses two different table types", + {"no-mix-table-types", OPT_NO_MIX_TYPE, "Don't allow commands with uses two different table types.", (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 client/server protocol", + {"old-protocol", 'o', "Use the old (3.20) protocol client/server 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, - "Use old LOAD DATA format in the binary log (don't save data in file)", + "Use old LOAD DATA format in the binary log (don't save data in file).", (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", OPT_ONE_THREAD, - "Only use one thread (for debugging under Linux)", 0, 0, 0, GET_NO_ARG, + "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", + {"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}, - {"log-error", OPT_ERROR_LOG_FILE, "Log error file", + {"log-error", OPT_ERROR_LOG_FILE, "Log error file.", (gptr*) &log_error_file_ptr, (gptr*) &log_error_file_ptr, 0, GET_STR, OPT_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, "For debugging", 0, 0, 0, GET_NO_ARG, + {"port", 'P', "Port number to use for connection.", (gptr*) &mysqld_port, + (gptr*) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"reckless-slave", OPT_RECKLESS_SLAVE, "Used for debugging.", 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.%.", @@ -3786,7 +3787,7 @@ Does nothing yet.", "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", + "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.%. ", @@ -3798,37 +3799,37 @@ Does nothing yet.", "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", + "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", 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, + {"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", + {"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", + {"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented.", (gptr*) &rpl_recovery_rank, (gptr*) &rpl_recovery_rank, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"relay-log", OPT_RELAY_LOG, - "The location and name to use for relay logs", + {"relay-log", OPT_RELAY_LOG, + "The location and name to use for relay logs.", (gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"relay-log-index", OPT_RELAY_LOG_INDEX, + {"relay-log-index", OPT_RELAY_LOG_INDEX, "The location and name to use for the file that keeps a list of the last \ -relay logs", +relay logs.", (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}, - {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for 4.0 and older clients)", + {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for 4.0 and older clients).", (gptr*) &opt_old_passwords, (gptr*) &opt_old_passwords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef TO_BE_DELETED {"safe-show-database", OPT_SAFE_SHOW_DB, @@ -3836,11 +3837,11 @@ relay logs", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"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", + "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", + "Uniquely identifies the server instance in the community of replication partners.", (gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"set-variable", 'O', @@ -3848,15 +3849,15 @@ relay logs", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared_memory_base_name",OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name, + "Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif {"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO, - "Show user and password in SHOW SLAVE STATUS", + "Show user and password in SHOW SLAVE STATUS.", (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-", + "Use concurrent insert with MyISAM. Disable with --skip-concurrent-insert.", (gptr*) &myisam_concurrent_insert, (gptr*) &myisam_concurrent_insert, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"skip-grant-tables", OPT_SKIP_GRANT, @@ -3864,20 +3865,20 @@ relay logs", (gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"innodb", OPT_INNODB, "Enable InnoDB (if this version of MySQL supports it). \ -Disable with --skip-innodb (will save memory)", +Disable with --skip-innodb (will save memory).", (gptr*) &opt_innodb, (gptr*) &opt_innodb, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"isam", OPT_ISAM, "Enable isam (if this version of MySQL supports it). \ -Disable with --skip-isam", +Disable with --skip-isam.", (gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"skip-locking", OPT_SKIP_LOCK, - "Deprecated option, use --skip-external-locking instead", + "Deprecated option, use --skip-external-locking instead.", 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, + {"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'", + "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, @@ -3885,36 +3886,36 @@ Disable with --skip-isam", {"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, + "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, + "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. Depricated option. Use --skip-symbolic-links instead", + {"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Depricated option. Use --skip-symbolic-links instead.", 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, + {"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, "The location and name of the file that remembers where the SQL replication \ -thread is in the relay logs", +thread is in the relay logs.", (gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_REPLICATION - {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, + {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "The location where the slave should put its temporary files when \ -replicating a LOAD DATA INFILE command", +replicating a LOAD DATA INFILE command.", (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", + "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}, #endif - {"socket", OPT_SOCKET, "Socket file to use for connection", - (gptr*) &mysql_unix_port, (gptr*) &mysql_unix_port, 0, GET_STR, + {"socket", OPT_SOCKET, "Socket file to use for connection.", + (gptr*) &mysqld_unix_port, (gptr*) &mysqld_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.", @@ -3942,28 +3943,28 @@ replicating a LOAD DATA INFILE command", (gptr*) &opt_mysql_tmpdir, (gptr*) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"transaction-isolation", OPT_TX_ISOLATION, - "Default transaction isolation level", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, + "Default transaction isolation level.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"external-locking", OPT_USE_LOCKING, "Use system (external) locking. With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running", + {"external-locking", OPT_USE_LOCKING, "Use system (external) locking. With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running.", (gptr*) &opt_external_locking, (gptr*) &opt_external_locking, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"use-symbolic-links", 's', "Enable symbolic link support. Depricated option; Use --symbolic-links instead", + {"use-symbolic-links", 's', "Enable symbolic link support. Depricated option; Use --symbolic-links instead.", (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, IF_PURIFY(0,1), 0, 0, 0, 0, 0}, - {"--symbolic-links", 's', "Enable symbolic link support", + {"--symbolic-links", 's', "Enable symbolic link support.", (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, IF_PURIFY(0,1), 0, 0, 0, 0, 0}, - {"user", 'u', "Run mysqld daemon as user", 0, 0, 0, GET_STR, REQUIRED_ARG, + {"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG, + {"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, + {"version", 'v', "Synonym for option -V.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log-warnings", 'W', "Log some not critical warnings to the log file", + {"log-warnings", 'W', "Log some not critical warnings to the log file.", (gptr*) &global_system_variables.log_warnings, (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"warnings", 'W', "Deprecated ; Use --log-warnings instead", + {"warnings", 'W', "Deprecated ; Use --log-warnings instead.", (gptr*) &global_system_variables.log_warnings, (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -3985,7 +3986,7 @@ replicating a LOAD DATA INFILE command", (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", + {"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 */ @@ -3994,7 +3995,7 @@ replicating a LOAD DATA INFILE command", (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", + "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, @@ -4134,7 +4135,7 @@ replicating a LOAD DATA INFILE command", (gptr*) &max_insert_delayed_threads, (gptr*) &max_insert_delayed_threads, 0, GET_ULONG, REQUIRED_ARG, 20, 0, 16384, 0, 1, 0}, {"max_error_count", OPT_MAX_ERROR_COUNT, - "Max number of errors/warnings to store for a statement", + "Max number of errors/warnings to store for a statement.", (gptr*) &global_system_variables.max_error_count, (gptr*) &max_system_variables.max_error_count, 0, GET_ULONG, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 1, 65535, 0, 1, 0}, @@ -4149,12 +4150,12 @@ replicating a LOAD DATA INFILE command", (gptr*) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0}, {"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA, - "Max number of bytes in sorted records", + "Max number of bytes in sorted records.", (gptr*) &global_system_variables.max_length_for_sort_data, (gptr*) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG, REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, {"max_prepared_statements", OPT_MAX_PREP_STMT, - "Max number of prepared_statements for a thread", + "Max number of prepared_statements for a thread.", (gptr*) &global_system_variables.max_prep_stmt_count, (gptr*) &max_system_variables.max_prep_stmt_count, 0, GET_ULONG, REQUIRED_ARG, DEFAULT_PREP_STMT_COUNT, 0, ~0L, 0, 1, 0}, @@ -4182,19 +4183,19 @@ replicating a LOAD DATA INFILE command", (gptr*) &max_system_variables.bulk_insert_buff_size, 0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ~0L, 0, 1, 0}, {"myisam_block_size", OPT_MYISAM_BLOCK_SIZE, - "Block size to be used for MyISAM index pages", + "Block size to be used for MyISAM index pages.", (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", + "Used to help MySQL to decide when to use the slow but safe key cache index create method.", (gptr*) &global_system_variables.myisam_max_extra_sort_file_size, (gptr*) &max_system_variables.myisam_max_extra_sort_file_size, 0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH, 0, (ulonglong) MAX_FILE_SIZE, 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!", + "Don't use the fast sort index method to created index if the temporary file would get bigger than this.", (gptr*) &global_system_variables.myisam_max_sort_file_size, (gptr*) &max_system_variables.myisam_max_sort_file_size, 0, GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE, @@ -4278,12 +4279,12 @@ replicating a LOAD DATA INFILE command", (gptr*) &relay_log_purge, 0, GET_BOOL, NO_ARG, 1, 0, 1, 0, 1, 0}, {"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT, - "Maximum space to use for all relay logs", + "Maximum space to use for all relay logs.", (gptr*) &relay_log_space_limit, (gptr*) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L, (longlong) ULONG_MAX, 0, 1, 0}, {"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL, - "Use compression on master/slave protocol", + "Use compression on master/slave protocol.", (gptr*) &opt_slave_compressed_protocol, (gptr*) &opt_slave_compressed_protocol, 0, GET_BOOL, REQUIRED_ARG, 0, 0, 1, 0, 1, 0}, @@ -4293,7 +4294,7 @@ replicating a LOAD DATA INFILE command", GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, #endif /* HAVE_REPLICATION */ {"read-only", OPT_READONLY, - "Make all tables readonly, with the expections for replications (slave) threads and users with the SUPER privilege", + "Make all tables readonly, with the expections for replications (slave) threads and users with the SUPER privilege.", (gptr*) &opt_readonly, (gptr*) &opt_readonly, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, @@ -4329,7 +4330,7 @@ replicating a LOAD DATA INFILE command", (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", + "The number of seconds the server waits for activity on a connection before closing it.", (gptr*) &global_system_variables.net_wait_timeout, (gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, @@ -4340,13 +4341,12 @@ replicating a LOAD DATA INFILE command", REQUIRED_ARG, 0, 0, 99, 0, 1, 0}, { "default-week-format", OPT_DEFAULT_WEEK_FORMAT, "The default week format used by WEEK() functions.", - (gptr*) &global_system_variables.default_week_format, - (gptr*) &max_system_variables.default_week_format, + (gptr*) &global_system_variables.default_week_format, + (gptr*) &max_system_variables.default_week_format, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3L, 0, 1, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; - struct show_var_st status_vars[]= { {"Aborted_clients", (char*) &aborted_threads, SHOW_LONG}, {"Aborted_connects", (char*) &aborted_connects, SHOW_LONG}, @@ -4630,7 +4630,7 @@ static void mysql_init_variables(void) max_sort_char= 0; mysqld_user= mysqld_chroot= opt_init_file= opt_bin_logname = 0; errmesg= 0; - mysql_unix_port= opt_mysql_tmpdir= my_bind_addr_str= NullS; + mysqld_unix_port= opt_mysql_tmpdir= my_bind_addr_str= NullS; bzero((gptr) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list)); bzero((gptr) &com_stat, sizeof(com_stat)); @@ -5037,7 +5037,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case (int) OPT_SKIP_NETWORKING: opt_disable_networking=1; - mysql_port=0; + mysqld_port=0; break; case (int) OPT_SKIP_SHOW_DB: opt_skip_show_db=1; diff --git a/sql/protocol.cc b/sql/protocol.cc index 62573da54f9..da363a478fd 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -103,8 +103,7 @@ void send_error(THD *thd, uint sql_errno, const char *err) { /* The first # is to make the protocol backward compatible */ buff[2]= '#'; - strmov(buff+3, mysql_errno_to_sqlstate(sql_errno)); - pos= buff + 2 + SQLSTATE_LENGTH +1; + pos= strmov(buff+3, mysql_errno_to_sqlstate(sql_errno)); } length= (uint) (strmake(pos, err, MYSQL_ERRMSG_SIZE-1) - buff); err=buff; diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index bbfd7866aa2..60af9a92c76 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -450,11 +450,11 @@ int show_new_master(THD* thd) /* Asks the master for the list of its other connected slaves. - This is for failsafe replication : - in order for failsafe replication to work, the servers involved in replication - must know of each other. We accomplish this by having each slave report to the - master how to reach it, and on connection, each slave receives information - about where the other slaves are. + This is for failsafe replication: + in order for failsafe replication to work, the servers involved in + replication must know of each other. We accomplish this by having each + slave report to the master how to reach it, and on connection, each + slave receives information about where the other slaves are. SYNOPSIS update_slave_list() @@ -466,8 +466,8 @@ int show_new_master(THD* thd) hostname/port of the master, the username used by the slave to connect to the master. If the user used by the slave to connect to the master does not have the - REPLICATION SLAVE privilege, it will pop in this function because SHOW SLAVE - HOSTS will fail on the master. + REPLICATION SLAVE privilege, it will pop in this function because + SHOW SLAVE HOSTS will fail on the master. RETURN VALUES 1 error @@ -483,7 +483,6 @@ int update_slave_list(MYSQL* mysql, MASTER_INFO* mi) int port_ind; DBUG_ENTER("update_slave_list"); - if (mysql_real_query(mysql,"SHOW SLAVE HOSTS",16) || !(res = mysql_store_result(mysql))) { @@ -668,8 +667,10 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi) strmov(mysql->net.last_error, "Master is not configured"); DBUG_RETURN(1); } - mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *)&slave_net_timeout); - mysql_options(mysql, MYSQL_SET_CHARSET_NAME, (char *)default_charset_info); + mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout); + mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout); + mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname); + mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir); if (!mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, mi->port, 0, 0)) DBUG_RETURN(1); diff --git a/sql/set_var.cc b/sql/set_var.cc index ad3966f76f9..f42517a5b0e 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -168,7 +168,11 @@ sys_var_thd_ulong sys_max_error_count("max_error_count", &SV::max_error_count); sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size", &SV::max_heap_table_size); -sys_var_thd_ulong sys_pseudo_thread_id("pseudo_thread_id", +/* + sys_pseudo_thread_id has its own class (instead of sys_var_thd_ulong) because + we want a check() function. +*/ +sys_var_pseudo_thread_id sys_pseudo_thread_id("pseudo_thread_id", &SV::pseudo_thread_id); sys_var_thd_ha_rows sys_max_join_size("max_join_size", &SV::max_join_size, @@ -596,7 +600,7 @@ struct show_var_st init_vars[]= { {"open_files_limit", (char*) &open_files_limit, SHOW_LONG}, {"pid_file", (char*) pidfile_name, SHOW_CHAR}, {"log_error", (char*) log_error_file, SHOW_CHAR}, - {"port", (char*) &mysql_port, SHOW_INT}, + {"port", (char*) &mysqld_port, SHOW_INT}, {"protocol_version", (char*) &protocol_version, SHOW_INT}, {sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS}, {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS}, @@ -627,7 +631,7 @@ struct show_var_st init_vars[]= { {"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL}, {sys_slow_launch_time.name, (char*) &sys_slow_launch_time, SHOW_SYS}, #ifdef HAVE_SYS_UN_H - {"socket", (char*) &mysql_unix_port, SHOW_CHAR_PTR}, + {"socket", (char*) &mysqld_unix_port, SHOW_CHAR_PTR}, #endif {sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS}, {sys_sql_mode.name, (char*) &sys_sql_mode, SHOW_SYS}, @@ -1454,6 +1458,17 @@ byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type) return (byte*) &thd->current_insert_id; } +bool sys_var_pseudo_thread_id::check(THD *thd, set_var *var) +{ + if (thd->master_access & SUPER_ACL) + return 0; + else + { + my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); + return 1; + } +} + #ifdef HAVE_REPLICATION bool sys_var_slave_skip_counter::check(THD *thd, set_var *var) diff --git a/sql/set_var.h b/sql/set_var.h index 998d61ff2d1..5a0fbd21809 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -212,6 +212,15 @@ public: byte *value_ptr(THD *thd, enum_var_type type); }; +class sys_var_pseudo_thread_id :public sys_var_thd_ulong +{ +public: + sys_var_pseudo_thread_id(const char *name_arg, ulong SV::*offset_arg) + :sys_var_thd_ulong(name_arg, offset_arg) + {} + bool check(THD *thd, set_var *var); +}; + class sys_var_thd_ha_rows :public sys_var_thd { diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 6e091066654..c5a2ae5dfb6 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -208,7 +208,7 @@ To make maintaining easier please: <alias>windows-1251</alias> <alias>ms-cyr</alias> <alias>ms-cyrillic</alias> - <collation name="cp1251_bulgarian_ci" id="14" flag="primary"> + <collation name="cp1251_bulgarian_ci" id="14"> <order>Belarusian</order> <order>Bulgarian</order> <order>Macedonian</order> @@ -219,7 +219,7 @@ To make maintaining easier please: </collation> <collation name="cp1251_ukrainian_ci" id="23" order="Ukrainian"/> <collation name="cp1251_bin" id="50" order="Binary" flag="binary"/> - <collation name="cp1251_general_ci" id="51"> + <collation name="cp1251_general_ci" id="51" flag="primary"> <order>Belarusian</order> <order>Bulgarian</order> <order>Macedonian</order> diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index ad15d55405f..f15e063c487 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -102,7 +102,7 @@ "Can't generate a unique log-filename %-.64s.(1-999)\n", "Table '%-.64s' was locked with a READ lock and can't be updated", "Table '%-.64s' was not locked with LOCK TABLES", -"BLOB column '%-.64s' can't have a default value", +"BLOB/TEXT column '%-.64s' can't have a default value", "Incorrect database name '%-.100s'", "Incorrect table name '%-.100s'", "The SELECT would examine more rows than MAX_JOIN_SIZE. Check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is ok", @@ -119,7 +119,7 @@ "Unknown character set: '%-.64s'", "Too many tables. MySQL can only use %d tables in a join", "Too many columns", -"Too big row size. The maximum row size, not counting BLOBs, is %d. You have to change some fields to BLOBs", +"Too big row size. The maximum row size, not counting BLOBs, is %d. You have to change some fields to TEXTs or BLOBs", "Thread stack overrun: Used: %ld of a %ld stack. Use 'mysqld -O thread_stack=#' to specify a bigger stack if needed", "Cross dependency found in OUTER JOIN. Examine your ON conditions", "Column '%-.64s' is used with UNIQUE or INDEX but is not defined as NOT NULL", @@ -171,7 +171,7 @@ "The used storage engine can't index column '%-.64s'", "All tables in the MERGE table are not identically defined", "Can't write, because of unique constraint, to table '%-.64s'", -"BLOB column '%-.64s' used in key specification without a key length", +"BLOB/TEXT 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", diff --git a/sql/slave.cc b/sql/slave.cc index cc27bb96ab7..ccce8077cb8 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -71,7 +71,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi, static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, void* thread_killed_arg); static int request_table_dump(MYSQL* mysql, const char* db, const char* table); -static int create_table_from_dump(THD* thd, NET* net, const char* db, +static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, const char* table_name); static int check_master_version(MYSQL* mysql, MASTER_INFO* mi); char* rewrite_db(char* db); @@ -1049,10 +1049,10 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi) } -static int create_table_from_dump(THD* thd, NET* net, const char* db, +static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, const char* table_name) { - ulong packet_len = my_net_read(net); // read create table statement + ulong packet_len; char *query; Vio* save_vio; HA_CHECK_OPT check_opt; @@ -1060,7 +1060,9 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, int error= 1; handler *file; ulong save_options; + NET *net= &mysql->net; + packet_len= my_net_read(net); // read create table statement if (packet_len == packet_error) { send_error(thd, ER_MASTER_NET_READ); @@ -1068,32 +1070,27 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, } if (net->read_pos[0] == 255) // error from master { - net->read_pos[packet_len] = 0; - net_printf(thd, ER_MASTER, net->read_pos + 3); + char *err_msg; + err_msg= (char*) net->read_pos + ((mysql->server_capabilities & + CLIENT_PROTOCOL_41) ? + 3+SQLSTATE_LENGTH+1 : 3); + net_printf(thd, ER_MASTER, err_msg); return 1; } thd->command = COM_TABLE_DUMP; + thd->query_length= packet_len; /* Note that we should not set thd->query until the area is initalized */ - if (!(query = sql_alloc(packet_len + 1))) + if (!(query = thd->strmake((char*) net->read_pos, packet_len))) { sql_print_error("create_table_from_dump: out of memory"); net_printf(thd, ER_GET_ERRNO, "Out of memory"); return 1; } - memcpy(query, net->read_pos, packet_len); - query[packet_len]= 0; - thd->query_length= packet_len; - /* - We make the following lock in an attempt to ensure that the compiler will - not rearrange the code so that thd->query is set too soon - */ - VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query= query; - VOID(pthread_mutex_unlock(&LOCK_thread_count)); thd->current_tablenr = 0; thd->query_error = 0; thd->net.no_send_ok = 1; - + /* we do not want to log create table statement */ save_options = thd->options; thd->options &= ~(ulong) (OPTION_BIN_LOG); @@ -1185,8 +1182,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, errmsg= "Failed on table dump request"; goto err; } - if (create_table_from_dump(thd, &mysql->net, db_name, - table_name)) + if (create_table_from_dump(thd, mysql, db_name, table_name)) goto err; // create_table_from_dump will have sent the error already error = 0; @@ -1426,7 +1422,6 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname, DBUG_RETURN(0); mi->mysql=0; mi->file_id=1; - mi->ignore_stop_event=0; fn_format(fname, master_info_fname, mysql_data_home, "", 4+32); /* @@ -2746,6 +2741,8 @@ static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) /* queue_old_event() + Writes a 3.23 event to the relay log. + TODO: Test this code before release - it has to be tested on a separate setup with 3.23 master @@ -2790,8 +2787,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, ev->log_pos = mi->master_log_pos; switch (ev->get_type_code()) { case STOP_EVENT: - ignore_event= mi->ignore_stop_event; - mi->ignore_stop_event=0; + ignore_event= 1; inc_pos= event_len; break; case ROTATE_EVENT: @@ -2801,7 +2797,6 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, pthread_mutex_unlock(&mi->data_lock); DBUG_RETURN(1); } - mi->ignore_stop_event=1; inc_pos= 0; break; case CREATE_FILE_EVENT: @@ -2817,7 +2812,6 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, DBUG_RETURN(error); } default: - mi->ignore_stop_event=0; inc_pos= event_len; break; } @@ -2842,15 +2836,12 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, /* queue_event() - TODO: verify the issue with stop events, see if we need them at all - in the relay log */ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) { int error= 0; ulong inc_pos; - bool ignore_event= 0; RELAY_LOG_INFO *rli= &mi->rli; DBUG_ENTER("queue_event"); @@ -2861,39 +2852,77 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) /* TODO: figure out if other events in addition to Rotate - require special processing + require special processing. + Guilhem 2003-06 : I don't think so. */ switch (buf[EVENT_TYPE_OFFSET]) { case STOP_EVENT: - ignore_event= mi->ignore_stop_event; - mi->ignore_stop_event= 0; - inc_pos= event_len; - break; + /* + We needn't write this event to the relay log. Indeed, it just indicates a + master server shutdown. The only thing this does is cleaning. But cleaning + is already done on a per-master-thread basis (as the master server is + shutting down cleanly, it has written all DROP TEMPORARY TABLE and DO + RELEASE_LOCK; prepared statements' deletion are TODO). + + We don't even increment mi->master_log_pos, because we may be just after a + Rotate event. Btw, in a few milliseconds we are going to have a Start + event from the next binlog (unless the master is presently running without + --log-bin). + */ + goto err; case ROTATE_EVENT: { Rotate_log_event rev(buf,event_len,0); if (unlikely(process_io_rotate(mi,&rev))) { - pthread_mutex_unlock(&mi->data_lock); - DBUG_RETURN(1); + error= 1; + goto err; } - mi->ignore_stop_event= 1; + /* + Now the I/O thread has just changed its mi->master_log_name, so + incrementing mi->master_log_pos is nonsense. + */ inc_pos= 0; break; } default: - mi->ignore_stop_event= 0; inc_pos= event_len; break; } - - if (likely(!ignore_event && - !(error= rli->relay_log.appendv(buf,event_len,0)))) + + /* + If this event is originating from this server, don't queue it. + We don't check this for 3.23 events because it's simpler like this; 3.23 + will be filtered anyway by the SQL slave thread which also tests the server + id (we must also keep this test in the SQL thread, in case somebody + upgrades a 4.0 slave which has a not-filtered relay log). + + ANY event coming from ourselves can be ignored: it is obvious for queries; + for STOP_EVENT/ROTATE_EVENT/START_EVENT: these cannot come from ourselves + (--log-slave-updates would not log that) unless this slave is also its + direct master (an unsupported, useless setup!). + */ + + if (uint4korr(buf + SERVER_ID_OFFSET) == ::server_id) { + /* + Do not write it to the relay log. + We still want to increment, so that we won't re-read this event from the + master if the slave IO thread is now stopped/restarted (more efficient if + the events we are ignoring are big LOAD DATA INFILE). + */ mi->master_log_pos+= inc_pos; - DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); - rli->relay_log.harvest_bytes_written(&rli->log_space_total); - } + DBUG_PRINT("info", ("master_log_pos: %d, event originating from the same server, ignored", (ulong) mi->master_log_pos)); + } + else /* write the event to the relay log */ + if (likely(!(error= rli->relay_log.appendv(buf,event_len,0)))) + { + mi->master_log_pos+= inc_pos; + DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); + rli->relay_log.harvest_bytes_written(&rli->log_space_total); + } + +err: pthread_mutex_unlock(&mi->data_lock); DBUG_RETURN(error); } @@ -2963,17 +2992,20 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi, #ifndef DBUG_OFF events_till_disconnect = disconnect_slave_event_count; #endif - uint client_flag=0; + ulong client_flag= CLIENT_REMEMBER_OPTIONS; if (opt_slave_compressed_protocol) client_flag=CLIENT_COMPRESS; /* We will use compression */ + mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout); + mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout); + mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname); + /* This one is not strictly needed but we have it here for completeness */ + mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir); + while (!(slave_was_killed = io_slave_killed(thd,mi)) && - (reconnect ? mysql_reconnect(mysql) != 0: - !(mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, - (char *)&thd->variables.net_read_timeout), - mysql_options(mysql, MYSQL_SET_CHARSET_NAME, (char *)default_charset_info), - mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, - mi->port, 0, client_flag)))) + (reconnect ? mysql_reconnect(mysql) != 0 : + mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, + mi->port, 0, client_flag) == 0)) { /* Don't repeat last error */ if ((int)mysql_errno(mysql) != last_errno) diff --git a/sql/slave.h b/sql/slave.h index 1d00df67b22..429456eb0bb 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -308,8 +308,6 @@ typedef struct st_master_info bool old_format; /* master binlog is in 3.23 format */ volatile bool abort_slave, slave_running; volatile ulong slave_run_id; - bool ignore_stop_event; - st_master_info() :fd(-1), io_thd(0), inited(0), old_format(0),abort_slave(0), diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 49aad321702..1bdca7167e8 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3337,15 +3337,19 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list) } tables[0].table->field[0]->store(user_name->host.str,(uint) - user_name->host.length, system_charset_info); + user_name->host.length, + system_charset_info); tables[0].table->field[1]->store(user_name->user.str,(uint) - user_name->user.length, system_charset_info); + user_name->user.length, + system_charset_info); if (!tables[0].table->file->index_read_idx(tables[0].table->record[0],0, - (byte*) tables[0].table->field[0]->ptr,0, + (byte*) tables[0].table-> + field[0]->ptr,0, HA_READ_KEY_EXACT)) { int error; - if ((error = tables[0].table->file->delete_row(tables[0].table->record[0]))) + if ((error = tables[0].table->file->delete_row(tables[0].table-> + record[0]))) { tables[0].table->file->print_error(error, MYF(0)); tables[0].table->file->index_end(); @@ -3355,7 +3359,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list) } tables[0].table->file->index_end(); } -err: + VOID(pthread_mutex_unlock(&acl_cache->lock)); rw_unlock(&LOCK_grant); close_thread_tables(thd); diff --git a/sql/sql_client.cc b/sql/sql_client.cc new file mode 100644 index 00000000000..464596f0734 --- /dev/null +++ b/sql/sql_client.cc @@ -0,0 +1,45 @@ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This files defines some MySQL C API functions that are server specific +*/ + +#include <mysql_priv.h> + +/* + Function called by my_net_init() to set some check variables +*/ + +extern "C" { +void my_net_local_init(NET *net) +{ +#ifndef EMBEDDED_LIBRARY + net->max_packet= (uint) global_system_variables.net_buffer_length; + net->read_timeout= (uint) global_system_variables.net_read_timeout; + net->write_timeout=(uint) global_system_variables.net_write_timeout; + net->retry_count= (uint) global_system_variables.net_retry_count; + net->max_packet_size= max(global_system_variables.net_buffer_length, + global_system_variables.max_allowed_packet); +#endif +} +} + +extern "C" { +void mysql_once_init(void) +{ +} +} diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f65ef4b968a..091de9d406f 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -308,6 +308,11 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, } thd->row_count++; } + + /* + Now all rows are inserted. Time to update logs and sends response to + user + */ if (lock_type == TL_WRITE_DELAYED) { if (!error) @@ -341,7 +346,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, } if (id && values_list.elements != 1) thd->insert_id(id); // For update log - else if (table->next_number_field) + else if (table->next_number_field && info.copied) id=table->next_number_field->val_int(); // Return auto_increment value /* @@ -383,9 +388,15 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, thd->next_insert_id=0; // Reset this if wrongly used if (duplic != DUP_ERROR) table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); + + /* Reset value of LAST_INSERT_ID if no rows where inserted */ + if (!info.copied && thd->insert_id_used) + { + thd->insert_id(0); + id=0; + } if (error) goto abort; - if (values_list.elements == 1 && (!(thd->options & OPTION_WARNINGS) || !thd->cuted_fields)) send_ok(thd,info.copied+info.deleted,id); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index a9a29904b60..47c7026c184 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2308,7 +2308,6 @@ mysql_execute_command(THD *thd) break; } case SQLCOM_UPDATE: - TABLE_LIST *table; if (check_db_used(thd,tables)) goto error; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 61a64573eaa..248496d6b43 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4791,7 +4791,7 @@ free_tmp_table(THD *thd, TABLE *entry) (void) ha_delete_table(entry->db_type,entry->real_name); /* free blobs */ for (Field **ptr=entry->field ; *ptr ; ptr++) - delete *ptr; + (*ptr)->free(); my_free((gptr) entry->record[0],MYF(0)); free_io_cache(entry); @@ -8061,7 +8061,6 @@ void free_underlaid_joins(THD *thd, SELECT_LEX *select) bool JOIN::rollup_init() { uint i,j; - ORDER *group; Item **ref_array; tmp_table_param.quick_group= 0; // Can't create groups in tmp table @@ -8145,7 +8144,7 @@ bool JOIN::rollup_make_fields(List<Item> &all_fields, List<Item> &fields, ... */ - for (level=0 ; level < send_group_parts > 0 ; level++) + for (level=0 ; level < send_group_parts ; level++) { uint i; uint pos= send_group_parts - level -1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 91bd5a77d27..a109ca23891 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1498,7 +1498,9 @@ keys_or_index: opt_unique_or_fulltext: /* empty */ { $$= Key::MULTIPLE; } | UNIQUE_SYM { $$= Key::UNIQUE; } - | SPATIAL_SYM { $$= Key::SPATIAL; }; + | FULLTEXT_SYM { $$= Key::FULLTEXT;} + | SPATIAL_SYM { $$= Key::SPATIAL; } + ; key_alg: /* empty */ { $$= HA_KEY_ALG_UNDEF; } @@ -3850,7 +3852,7 @@ purge_option: } Item *tmp= new Item_func_unix_timestamp($2); Lex->sql_command = SQLCOM_PURGE_BEFORE; - Lex->purge_time= tmp->val_int(); + Lex->purge_time= (ulong) tmp->val_int(); } ; |