diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innodb.cc | 2 | ||||
-rw-r--r-- | sql/ha_innodb.h | 3 | ||||
-rw-r--r-- | sql/item_func.cc | 12 | ||||
-rw-r--r-- | sql/log.cc | 9 | ||||
-rw-r--r-- | sql/log_event.cc | 75 | ||||
-rw-r--r-- | sql/log_event.h | 7 | ||||
-rw-r--r-- | sql/mysqld.cc | 2 | ||||
-rw-r--r-- | sql/net_serv.cc | 2 | ||||
-rw-r--r-- | sql/repl_failsafe.cc | 20 | ||||
-rw-r--r-- | sql/slave.cc | 123 | ||||
-rw-r--r-- | sql/slave.h | 1 | ||||
-rw-r--r-- | sql/sql_acl.cc | 16 | ||||
-rw-r--r-- | sql/sql_parse.cc | 5 | ||||
-rw-r--r-- | sql/sql_repl.cc | 13 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 | ||||
-rw-r--r-- | sql/sql_udf.cc | 14 |
16 files changed, 166 insertions, 140 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 7b8afe7b8fe..64c9ecbcb7a 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -101,7 +101,7 @@ char* innobase_unix_file_flush_method = NULL; /* Below we have boolean-valued start-up parameters, and their default values */ -my_bool innobase_flush_log_at_trx_commit = FALSE; +uint innobase_flush_log_at_trx_commit = 0; my_bool innobase_log_archive = FALSE; my_bool innobase_use_native_aio = FALSE; my_bool innobase_fast_shutdown = TRUE; diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index 2addd957c8c..d70a58c75f1 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -170,6 +170,7 @@ class ha_innobase: public handler extern bool innodb_skip; extern uint innobase_init_flags, innobase_lock_type; +extern uint innobase_flush_log_at_trx_commit; extern ulong innobase_cache_size; extern char *innobase_home, *innobase_tmpdir, *innobase_logdir; extern long innobase_lock_scan_time; @@ -182,7 +183,7 @@ extern char *innobase_data_home_dir, *innobase_data_file_path; extern char *innobase_log_group_home_dir, *innobase_log_arch_dir; extern char *innobase_unix_file_flush_method; /* The following variables have to be my_bool for SHOW VARIABLES to work */ -extern my_bool innobase_flush_log_at_trx_commit, innobase_log_archive, +extern my_bool innobase_log_archive, innobase_use_native_aio, innobase_fast_shutdown; extern TYPELIB innobase_lock_typelib; diff --git a/sql/item_func.cc b/sql/item_func.cc index 1bf94ae75d0..609e0042704 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2334,7 +2334,7 @@ Item *get_system_var(enum_var_type var_type, LEX_STRING name) THD *thd=current_thd; Item *item; sys_var *var; - char buff[MAX_SYS_VAR_LENGTH+3]; + char buff[MAX_SYS_VAR_LENGTH+3+8], *pos; if (!(var= find_sys_var(name.str))) { @@ -2346,8 +2346,14 @@ Item *get_system_var(enum_var_type var_type, LEX_STRING name) thd->safe_to_cache_query=0; buff[0]='@'; buff[1]='@'; - memcpy(buff+2, var->name, var->name_length+1); - item->set_name(buff,var->name_length+2); // Will allocate name + pos=buff+2; + if (var_type == OPT_SESSION) + pos=strmov(pos,"session."); + else if (var_type == OPT_GLOBAL) + pos=strmov(pos,"global."); + memcpy(pos, var->name, var->name_length+1); + // set_name() will allocate the name + item->set_name(buff,(uint) (pos-buff)+var->name_length); return item; } diff --git a/sql/log.cc b/sql/log.cc index e42d9ffa2fa..ccd3954e172 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -389,12 +389,12 @@ err: the NEXT log file name in the index file. log_name Filename to find in the index file. Is a null pointer if we want to read the first entry - need_mutex Set this to 1 if the parent doesn't already have a + need_lock Set this to 1 if the parent doesn't already have a lock on LOCK_index NOTE - On systems without the truncate function the file will end with one ore - more empty lines + On systems without the truncate function the file will end with one or + more empty lines. These will be ignored when reading the file. RETURN VALUES 0 ok @@ -1388,6 +1388,7 @@ void MYSQL_LOG:: wait_for_update(THD* thd) This can be set to 0 if we are going to do call open at once after close, in which case we don't want to close the index file. + We only write a 'stop' event to the log if exiting is set */ void MYSQL_LOG::close(bool exiting) @@ -1396,7 +1397,7 @@ void MYSQL_LOG::close(bool exiting) DBUG_PRINT("enter",("exiting: %d", (int) exiting)); if (is_open()) { - if (log_type == LOG_BIN && !no_auto_events) + if (log_type == LOG_BIN && !no_auto_events && exiting) { Stop_log_event s; s.set_log_pos(this); diff --git a/sql/log_event.cc b/sql/log_event.cc index 1f7a4013d80..ec5b7c4b5a5 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -690,7 +690,10 @@ void Rotate_log_event::print(FILE* file, bool short_form, char* last_db) if (new_log_ident) my_fwrite(file, (byte*) new_log_ident, (uint)ident_len, MYF(MY_NABP | MY_WME)); - fprintf(file, " pos: %s\n", llstr(pos, buf)); + fprintf(file, " pos: %s", llstr(pos, buf)); + if (flags & LOG_EVENT_FORCED_ROTATE_F) + fprintf(file," forced by master"); + fputc('\n', file); fflush(file); } @@ -730,20 +733,22 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len, buf += header_size; if (old_format) { - ident_len = (uchar)(event_len - OLD_HEADER_LEN); + ident_len = (uint)(event_len - OLD_HEADER_LEN); pos = 4; ident_offset = 0; } else { - ident_len = (uchar)(event_len - ROTATE_EVENT_OVERHEAD); + ident_len = (uint)(event_len - ROTATE_EVENT_OVERHEAD); pos = uint8korr(buf + R_POS_OFFSET); ident_offset = ROTATE_HEADER_LEN; } - if (!(new_log_ident = (char*) my_memdup((byte*) buf + ident_offset, - (uint) ident_len, MYF(MY_WME)))) + set_if_smaller(ident_len,FN_REFLEN-1); + if (!(new_log_ident= (char*) my_strdup_with_length((byte*) buf + + ident_offset, + (uint) ident_len, + MYF(MY_WME)))) return; - alloced = 1; } @@ -1614,7 +1619,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) int expected_error,actual_error = 0; init_sql_alloc(&thd->mem_root, 8192,0); thd->db = rewrite_db((char*)db); - DBUG_ASSERT(q_len == strlen(query)); /* InnoDB internally stores the master log position it has processed so far; @@ -1643,6 +1647,8 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) if (ignored_error_code((expected_error = error_code)) || !check_expected_error(thd,rli,expected_error)) { + mysql_log.write(thd,COM_QUERY,"%s",thd->query); + DBUG_PRINT("query",("%s",thd->query)); mysql_parse(thd, thd->query, q_len); if ((expected_error != (actual_error = thd->net.last_errno)) && expected_error && @@ -1861,71 +1867,34 @@ int Stop_log_event::exec_event(struct st_relay_log_info* rli) Got a rotate log even from the master IMPLEMENTATION - - Rotate the log file if the name of the log file changed - (In practice this should always be the case) + This is mainly used so that we can later figure out the logname and + position for the master. - TODO - - Investigate/Test if we can't ignore all rotate log events - that we get from the master (and not even write it to the local - binary log). + We can't rotate the slave as this will cause infinitive rotations + in a A -> B -> A setup. RETURN VALUES - 0 ok - 1 Impossible new log file name (rotate log event is ignored) -*/ + 0 ok + */ int Rotate_log_event::exec_event(struct st_relay_log_info* rli) { - bool rotate_binlog = 0, write_slave_event = 0; char* log_name = rli->master_log_name; DBUG_ENTER("Rotate_log_event::exec_event"); pthread_mutex_lock(&rli->data_lock); - /* - TODO: probably needs re-write - rotate local binlog only if the name of remote has changed - */ - if (!*log_name || (memcmp(log_name, new_log_ident, ident_len) || - log_name[ident_len] != 0)) - { - write_slave_event = (!(flags & LOG_EVENT_FORCED_ROTATE_F) && - mysql_bin_log.is_open()); - rotate_binlog = (*log_name && write_slave_event); - if (ident_len >= sizeof(rli->master_log_name)) - { - // This should be impossible - pthread_mutex_unlock(&rli->data_lock); - DBUG_RETURN(1); - } - memcpy(log_name, new_log_ident, ident_len); - log_name[ident_len] = 0; - } + memcpy(log_name, new_log_ident, ident_len+1); rli->master_log_pos = pos; rli->relay_log_pos += get_event_len(); - if (rotate_binlog) - { - mysql_bin_log.new_file(); - rli->master_log_pos = BIN_LOG_HEADER_SIZE; - } DBUG_PRINT("info", ("master_log_pos: %d", (ulong) rli->master_log_pos)); - pthread_cond_broadcast(&rli->data_cond); pthread_mutex_unlock(&rli->data_lock); + pthread_cond_broadcast(&rli->data_cond); flush_relay_log_info(rli); - - if (write_slave_event) - { - Slave_log_event s(thd, rli); - if (s.master_host) - { - s.set_log_pos(&mysql_bin_log); - s.server_id = ::server_id; - mysql_bin_log.write(&s); - } - } DBUG_RETURN(0); } + int Intvar_log_event::exec_event(struct st_relay_log_info* rli) { switch (type) { diff --git a/sql/log_event.h b/sql/log_event.h index b69643c366a..5f7aa4ad586 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -522,16 +522,15 @@ class Rotate_log_event: public Log_event { public: const char* new_log_ident; - uchar ident_len; ulonglong pos; + uint ident_len; bool alloced; #ifndef MYSQL_CLIENT Rotate_log_event(THD* thd_arg, const char* new_log_ident_arg, uint ident_len_arg = 0,ulonglong pos_arg = 4) : Log_event(thd_arg), new_log_ident(new_log_ident_arg), - ident_len(ident_len_arg ? ident_len_arg : - (uint) strlen(new_log_ident_arg)), pos(pos_arg), - alloced(0) + pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg : + (uint) strlen(new_log_ident_arg)), alloced(0) {} void pack_info(String* packet); int exec_event(struct st_relay_log_info* rli); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 172ed0a2968..75e6368712a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3039,7 +3039,7 @@ struct my_option my_long_options[] = "Set to 0 if you don't want to flush logs", (gptr*) &innobase_flush_log_at_trx_commit, (gptr*) &innobase_flush_log_at_trx_commit, - 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, + 0, GET_INT, OPT_ARG, 0, 0, 2, 0, 0, 0}, {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD, "With which method to flush data", (gptr*) &innobase_unix_file_flush_method, (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, diff --git a/sql/net_serv.cc b/sql/net_serv.cc index bb7100f31be..122793b07a7 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -237,6 +237,7 @@ my_net_write(NET *net,const char *packet,ulong len) buff[3]= (uchar) net->pkt_nr++; if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE)) return 1; + DBUG_DUMP("packet_header",(char*) buff,NET_HEADER_SIZE); return net_write_buff(net,packet,len); } @@ -615,6 +616,7 @@ my_real_read(NET *net, ulong *complen) ("Packets out of order (Found: %d, expected %u)", (int) net->buff[net->where_b + 3], net->pkt_nr)); + DBUG_DUMP("packet_header",(char*) net->buff+net->where_b, 4); #ifdef EXTRA_DEBUG fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n", (int) net->buff[net->where_b + 3], diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 232c3de2570..81627dceb0e 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -236,7 +236,7 @@ static int find_target_pos(LEX_MASTER_INFO *mi, IO_CACHE *log, char *errmsg) return 1; } - if (ev->log_pos == log_pos && ev->server_id == target_server_id) + if (ev->log_pos >= log_pos && ev->server_id == target_server_id) { delete ev; mi->pos = my_b_tell(log); @@ -261,23 +261,24 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg) int error = 1; int cmp_res; LINT_INIT(cmp_res); + DBUG_ENTER("translate_master"); if (!mysql_bin_log.is_open()) { strmov(errmsg,"Binary log is not open"); - return 1; + DBUG_RETURN(1); } if (!server_id_supplied) { strmov(errmsg, "Misconfigured master - server id was not set"); - return 1; + DBUG_RETURN(1); } if (mysql_bin_log.find_log_pos(&linfo, NullS, 1)) { strmov(errmsg,"Could not find first log"); - return 1; + DBUG_RETURN(1); } thd->current_linfo = &linfo; @@ -366,7 +367,7 @@ err: if (last_file >= 0 && last_file != file) (void) my_close(last_file, MYF(MY_WME)); - return error; + DBUG_RETURN(error); } @@ -423,12 +424,9 @@ int show_new_master(THD* thd) if (translate_master(thd, lex_mi, errmsg)) { if (errmsg[0]) - net_printf(&thd->net, ER_ERROR_WHEN_EXECUTING_COMMAND, - "SHOW NEW MASTER", errmsg); - else - send_error(&thd->net, 0); - - DBUG_RETURN(1); + my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), + "SHOW NEW MASTER", errmsg); + DBUG_RETURN(-1); } else { diff --git a/sql/slave.cc b/sql/slave.cc index 7a1a1e2a6ef..7cc37d5f691 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1468,6 +1468,8 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, int event_count = 0; ulong init_abort_pos_wait; DBUG_ENTER("wait_for_pos"); + DBUG_PRINT("enter",("master_log_name: '%s' pos: %ld", + master_log_name, (ulong) master_log_pos)); pthread_mutex_lock(&data_lock); // abort only if master info changes during wait @@ -1498,6 +1500,7 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, if (pos_reached || thd->killed) break; + DBUG_PRINT("info",("Waiting for master update")); const char* msg = thd->enter_cond(&data_cond, &data_lock, "Waiting for master update"); pthread_cond_wait(&data_cond, &data_lock); @@ -2308,21 +2311,44 @@ err: } /* - We assume we already locked mi->data_lock + Start using a new binary log on the master + + SYNOPSIS + process_io_rotate() + mi master_info for the slave + rev The rotate log event read from the binary log + + DESCRIPTION + Updates the master info and relay data with the place in the next binary + log where we should start reading. + + NOTES + We assume we already locked mi->data_lock + + RETURN VALUES + 0 ok + 1 Log event is illegal */ -static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev) +static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) { + int return_val= 1; DBUG_ENTER("process_io_rotate"); + safe_mutex_assert_owner(&mi->data_lock); if (unlikely(!rev->is_valid())) DBUG_RETURN(1); - DBUG_ASSERT(rev->ident_len < sizeof(mi->master_log_name)); - memcpy(mi->master_log_name,rev->new_log_ident, - rev->ident_len); - mi->master_log_name[rev->ident_len] = 0; - mi->master_log_pos = rev->pos; - DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); + + memcpy(mi->master_log_name, rev->new_log_ident, rev->ident_len+1); + mi->master_log_pos= rev->pos; + + pthread_mutex_lock(&mi->rli.data_lock); + memcpy(mi->rli.master_log_name, rev->new_log_ident, rev->ident_len+1); + mi->rli.master_log_pos= rev->pos; + pthread_mutex_unlock(&mi->rli.data_lock); + + DBUG_PRINT("info", ("master_log_pos: '%s' %d", + mi->master_log_name, (ulong) mi->master_log_pos)); #ifndef DBUG_OFF /* If we do not do this, we will be getting the first @@ -2335,23 +2361,24 @@ static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev) } /* - TODO: verify the issue with stop events, see if we need them at all - in the relay log - TODO: test this code before release - it has to be tested on a separte - setup with 3.23 master + TODO: + Test this code before release - it has to be tested on a separate + setup with 3.23 master */ static int queue_old_event(MASTER_INFO *mi, const char *buf, ulong event_len) { const char *errmsg = 0; - bool inc_pos = 1; - bool processed_stop_event = 0; - char* tmp_buf = 0; + ulong inc_pos; + bool ignore_event= 0; + char *tmp_buf = 0; + RELAY_LOG_INFO *rli= &mi->rli; DBUG_ENTER("queue_old_event"); - /* if we get Load event, we need to pass a non-reusable buffer - to read_log_event, so we do a trick + /* + If we get Load event, we need to pass a non-reusable buffer + to read_log_event, so we do a trick */ if (buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) { @@ -2377,54 +2404,52 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, pthread_mutex_lock(&mi->data_lock); 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; + inc_pos= event_len; + break; case ROTATE_EVENT: if (unlikely(process_io_rotate(mi,(Rotate_log_event*)ev))) { delete ev; pthread_mutex_unlock(&mi->data_lock); - DBUG_ASSERT(!tmp_buf); DBUG_RETURN(1); } mi->ignore_stop_event=1; - inc_pos = 0; - break; - case STOP_EVENT: - processed_stop_event=1; + inc_pos= 0; break; case CREATE_FILE_EVENT: { + /* We come here when and only when tmp_buf != 0 */ + DBUG_ASSERT(tmp_buf); int error = process_io_create_file(mi,(Create_file_log_event*)ev); delete ev; mi->master_log_pos += event_len; DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); pthread_mutex_unlock(&mi->data_lock); - DBUG_ASSERT(tmp_buf); my_free((char*)tmp_buf, MYF(0)); DBUG_RETURN(error); } default: mi->ignore_stop_event=0; + inc_pos= event_len; break; } - if (likely(!processed_stop_event || !mi->ignore_stop_event)) + if (likely(!ignore_event)) { - if (unlikely(mi->rli.relay_log.append(ev))) + if (unlikely(rli->relay_log.append(ev))) { delete ev; pthread_mutex_unlock(&mi->data_lock); - DBUG_ASSERT(!tmp_buf); DBUG_RETURN(1); } - mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total); + rli->relay_log.harvest_bytes_written(&rli->log_space_total); } delete ev; - if (likely(inc_pos)) - mi->master_log_pos += event_len; + mi->master_log_pos+= inc_pos; DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); - if (unlikely(processed_stop_event)) - mi->ignore_stop_event=1; pthread_mutex_unlock(&mi->data_lock); - DBUG_ASSERT(!tmp_buf); DBUG_RETURN(0); } @@ -2435,48 +2460,52 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) { - int error=0; - bool inc_pos = 1; - bool processed_stop_event = 0; + int error= 0; + ulong inc_pos; + bool ignore_event= 0; + RELAY_LOG_INFO *rli= &mi->rli; DBUG_ENTER("queue_event"); if (mi->old_format) DBUG_RETURN(queue_old_event(mi,buf,event_len)); pthread_mutex_lock(&mi->data_lock); - + /* TODO: figure out if other events in addition to Rotate require special processing */ switch (buf[EVENT_TYPE_OFFSET]) { case STOP_EVENT: - processed_stop_event=1; + ignore_event= mi->ignore_stop_event; + mi->ignore_stop_event= 0; + inc_pos= event_len; break; 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); - inc_pos=0; - mi->ignore_stop_event=1; + } + mi->ignore_stop_event= 1; + inc_pos= 0; break; } default: - mi->ignore_stop_event=0; + mi->ignore_stop_event= 0; + inc_pos= event_len; break; } - if (likely((!processed_stop_event || !mi->ignore_stop_event) && - !(error = mi->rli.relay_log.appendv(buf,event_len,0)))) + if (likely(!ignore_event && + !(error= rli->relay_log.appendv(buf,event_len,0)))) { - if (likely(inc_pos)) - mi->master_log_pos += event_len; + mi->master_log_pos+= inc_pos; DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); - mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total); + rli->relay_log.harvest_bytes_written(&rli->log_space_total); } - if (unlikely(processed_stop_event)) - mi->ignore_stop_event=1; pthread_mutex_unlock(&mi->data_lock); DBUG_RETURN(error); } diff --git a/sql/slave.h b/sql/slave.h index b527aceb432..cbcd2957476 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -312,6 +312,7 @@ typedef struct st_master_info } MASTER_INFO; + int queue_event(MASTER_INFO* mi,const char* buf,ulong event_len); typedef struct st_table_rule_ent diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 519ac0e7ce2..c44fe2d053d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1310,18 +1310,24 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, if (table->fields >= 31) /* From 4.0.0 we have more fields */ { /* We write down SSL related ACL stuff */ - table->field[25]->store("",0); - table->field[26]->store("",0); - table->field[27]->store("",0); switch (thd->lex.ssl_type) { case SSL_TYPE_ANY: table->field[24]->store("ANY",3); + table->field[25]->store("",0); + table->field[26]->store("",0); + table->field[27]->store("",0); break; case SSL_TYPE_X509: table->field[24]->store("X509",4); + table->field[25]->store("",0); + table->field[26]->store("",0); + table->field[27]->store("",0); break; case SSL_TYPE_SPECIFIED: table->field[24]->store("SPECIFIED",9); + table->field[25]->store("",0); + table->field[26]->store("",0); + table->field[27]->store("",0); if (thd->lex.ssl_cipher) table->field[25]->store(thd->lex.ssl_cipher, strlen(thd->lex.ssl_cipher)); @@ -1332,8 +1338,8 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, table->field[27]->store(thd->lex.x509_subject, strlen(thd->lex.x509_subject)); break; - default: - table->field[24]->store("",0); + case SSL_TYPE_NOT_SPECIFIED: + break; // Nothing to do } USER_RESOURCES mqh = thd->lex.mqh; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e291334a29d..2973e7bd1b1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1356,7 +1356,12 @@ mysql_execute_command(void) { if (check_global_access(thd, REPL_SLAVE_ACL)) goto error; +#ifndef WORKING_NEW_MASTER + net_printf(&thd->net, ER_NOT_SUPPORTED_YET, "SHOW NEW MASTER"); + res= 1; +#else res = show_new_master(thd); +#endif break; } case SQLCOM_SHOW_SLAVE_HOSTS: diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 628b1775778..47b258d9ed2 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -910,6 +910,11 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, const char* log_file_name2, ulonglong log_pos2) { int res; + /* + TODO: Change compare function to work with file name of type + '.999 and .1000' + */ + if ((res = strcmp(log_file_name1, log_file_name2))) return res; if (log_pos1 > log_pos2) @@ -919,6 +924,7 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, return -1; } + int show_binlog_events(THD* thd) { DBUG_ENTER("show_binlog_events"); @@ -1010,15 +1016,16 @@ err: if (errmsg) { - net_printf(&thd->net, ER_ERROR_WHEN_EXECUTING_COMMAND, - "SHOW BINLOG EVENTS", errmsg); - DBUG_RETURN(1); + my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), + "SHOW BINLOG EVENTS", errmsg); + DBUG_RETURN(-1); } send_eof(&thd->net); DBUG_RETURN(0); } + int show_binlog_info(THD* thd) { DBUG_ENTER("show_binlog_info"); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0482313481d..021f3f07ad5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -627,7 +627,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, if (!(key_info->flags & HA_NULL_PART_KEY)) unique_key=1; key_info->key_length=(uint16) key_length; - uint max_key_length= max(file->max_key_length(), MAX_KEY_LENGTH); + uint max_key_length= min(file->max_key_length(), MAX_KEY_LENGTH); if (key_length > max_key_length && key->type != Key::FULLTEXT) { my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length); diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 8791f547ea6..cd85b3dbaf2 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -285,12 +285,14 @@ udf_func *find_udf(const char *name,uint length,bool mark_used) /* TODO: This should be changed to reader locks someday! */ pthread_mutex_lock(&THR_LOCK_udf); - udf=(udf_func*) hash_search(&udf_hash,(byte*) name, - length ? length : (uint) strlen(name)); - if (!udf->dlhandle) - udf=0; // Could not be opened - else if (mark_used) - udf->usage_count++; + if ((udf=(udf_func*) hash_search(&udf_hash,(byte*) name, + length ? length : (uint) strlen(name)))) + { + if (!udf->dlhandle) + udf=0; // Could not be opened + else if (mark_used) + udf->usage_count++; + } pthread_mutex_unlock(&THR_LOCK_udf); DBUG_RETURN(udf); } |