diff --git a/Docs/manual.texi b/Docs/manual.texi index e005cedf144..2c4b0f71352 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46928,6 +46928,8 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.52 @itemize @bullet @item +Don't write slave-timeout reconnects to the error log. +@item Fixed bug with slave net read timeouting @item Fixed bug in ALTERing TABLE of BDB type. diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index f5b80241f9a..33bc4613ef5 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -1990,7 +1990,7 @@ ha_innobase::change_active_index( InnoDB */ { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; - KEY* key; + KEY* key=0; statistic_increment(ha_read_key_count, &LOCK_status); @@ -2011,7 +2011,7 @@ ha_innobase::change_active_index( if (!prebuilt->index) { fprintf(stderr, "InnoDB: Could not find key n:o %u with name %s from dict cache\n" - "InnoDB: for table %s\n", keynr, key->name, prebuilt->table->name); + "InnoDB: for table %s\n", keynr, key ? key->name : "NULL", prebuilt->table->name); return(1); } diff --git a/sql/slave.cc b/sql/slave.cc index b11fcc0d847..adbf3c106cc 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -55,7 +55,7 @@ inline bool slave_killed(THD* thd); static int init_slave_thread(THD* thd); static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi); static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi, - bool suppress_prints_as_normal_reconnect_after_timeout); + bool suppress_warnings); static int safe_sleep(THD* thd, int sec); static int request_table_dump(MYSQL* mysql, char* db, char* table); static int create_table_from_dump(THD* thd, NET* net, const char* db, @@ -839,13 +839,15 @@ command"); return 0; } -/* We set suppress_prints_as_normal_reconnect_after_timeout TRUE -when a normal net read timeout has caused us to try a reconnect. -We do not want to print anything to the error log in this case -because this a anormal event in an idle server. */ -static uint read_event(MYSQL* mysql, MASTER_INFO *mi, - bool* suppress_prints_as_normal_reconnect_after_timeout) +/* + We set suppress_warnings TRUE when a normal net read timeout has + caused us to try a reconnect. We do not want to print anything to + the error log in this case because this a anormal event in an idle + server. +*/ + +static uint read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings) { uint len = packet_error; @@ -855,24 +857,25 @@ static uint read_event(MYSQL* mysql, MASTER_INFO *mi, if (disconnect_slave_event_count && !(events_till_disconnect--)) return packet_error; #endif - *suppress_prints_as_normal_reconnect_after_timeout = 0; + *suppress_warnings= 0; len = mc_net_safe_read(mysql); if (len == packet_error || (long) len < 1) { - if (mc_mysql_errno(mysql) == ER_NET_READ_INTERRUPTED) { - - /* We are trying a normal reconnect after a read timeout; - we suppress prints to .err file as long as the reconnect - happens without problems */ - *suppress_prints_as_normal_reconnect_after_timeout = TRUE; + if (mc_mysql_errno(mysql) == ER_NET_READ_INTERRUPTED) + { + /* + We are trying a normal reconnect after a read timeout; + we suppress prints to .err file as long as the reconnect + happens without problems + */ + *suppress_warnings= TRUE; } - - if (!(*suppress_prints_as_normal_reconnect_after_timeout)) + else sql_print_error("Error reading packet from server: %s (\ server_errno=%d)", - mc_mysql_error(mysql), mc_mysql_errno(mysql)); + mc_mysql_error(mysql), mc_mysql_errno(mysql)); return packet_error; } @@ -1380,15 +1383,13 @@ try again, log '%s' at postion %s", RPL_LOG_NAME, while(!slave_killed(thd)) { - bool suppress_prints_as_normal_reconnect_after_timeout = 0; + bool suppress_warnings= 0; thd->proc_info = "Reading master update"; - uint event_len = read_event(mysql, &glob_mi, - &suppress_prints_as_normal_reconnect_after_timeout); + uint event_len = read_event(mysql, &glob_mi, &suppress_warnings); if(slave_killed(thd)) { - suppress_prints_as_normal_reconnect_after_timeout = 0; sql_print_error("Slave thread killed while reading event"); goto err; } @@ -1397,7 +1398,6 @@ try again, log '%s' at postion %s", RPL_LOG_NAME, { if(mc_mysql_errno(mysql) == ER_NET_PACKET_TOO_LARGE) { - suppress_prints_as_normal_reconnect_after_timeout = 0; sql_print_error("Log entry on master is longer than \ max_allowed_packet on slave. Slave thread will be aborted. If the entry is \ really supposed to be that long, restart the server with a higher value of \ @@ -1415,7 +1415,6 @@ max_allowed_packet. The current value is %ld", max_allowed_packet); if(slave_killed(thd)) { - suppress_prints_as_normal_reconnect_after_timeout = 0; sql_print_error("Slave thread killed while waiting to \ reconnect after a failed read"); goto err; @@ -1423,21 +1422,19 @@ reconnect after a failed read"); thd->proc_info = "Reconnecting after a failed read"; last_failed_pos= glob_mi.pos; - if (!suppress_prints_as_normal_reconnect_after_timeout) + if (!suppress_warnings) sql_print_error("Slave: Failed reading log event, \ reconnecting to retry, log '%s' position %s", RPL_LOG_NAME, llstr(last_failed_pos, llbuff)); if(safe_reconnect(thd, mysql, &glob_mi, - suppress_prints_as_normal_reconnect_after_timeout) + suppress_warnings) || slave_killed(thd)) { - suppress_prints_as_normal_reconnect_after_timeout = 0; sql_print_error("Slave thread killed during or after a \ reconnect done to recover from failed read"); goto err; } - suppress_prints_as_normal_reconnect_after_timeout = 0; goto connected; } // if(event_len == packet_error) @@ -1550,7 +1547,7 @@ static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi) */ static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi, - bool suppress_prints_as_normal_reconnect_after_timeout) + bool suppress_warnings) { int slave_was_killed; int last_errno= -2; // impossible error @@ -1570,7 +1567,7 @@ static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi, /* Don't repeat last error */ if (mc_mysql_errno(mysql) != last_errno) { - suppress_prints_as_normal_reconnect_after_timeout = 0; + suppress_warnings= 0; sql_print_error("Slave thread: error re-connecting to master: \ %s, last_errno=%d, retry in %d sec", mc_mysql_error(mysql), last_errno=mc_mysql_errno(mysql), @@ -1587,7 +1584,7 @@ static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi, if (!slave_was_killed) { - if (!suppress_prints_as_normal_reconnect_after_timeout) + if (!suppress_warnings) sql_print_error("Slave: reconnected to master '%s@%s:%d',\ replication resumed in log '%s' at position %s", glob_mi.user, glob_mi.host, glob_mi.port, diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 688a6055a7b..b3d63f72b8d 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -166,11 +166,12 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) if ((deleted=mysql_rm_known_files(thd, dirp, path,0)) >= 0) { - /* If there are running queries on the tables, MySQL needs to get - access to LOCK_open to end them. InnoDB on the other hand waits - for the queries to end before dropping the database. That is why we - must do the dropping with LOCK_open released. */ - + /* + If there are running queries on the tables, MySQL needs to get + access to LOCK_open to end them. InnoDB on the other hand waits + for the queries to end before dropping the database. That is why we + must do the dropping with LOCK_open released. + */ VOID(pthread_mutex_unlock(&LOCK_open)); ha_drop_database(path); VOID(pthread_mutex_lock(&LOCK_open)); diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 930e71d7678..278e98533c9 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -169,7 +169,7 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, select=make_select(table,0,0,conds,&error); if (error) DBUG_RETURN(-1); - if ((select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES), + if ((select && select->check_quick(test(thd->options & OPTION_SAFE_UPDATES), limit)) || !limit) { diff --git a/sql/sql_update.cc b/sql/sql_update.cc index e5e246b3962..6a4cdb80e5d 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -110,7 +110,7 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List &fields, table->used_keys=0; select=make_select(table,0,0,conds,&error); if (error || - (select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES), + (select && select->check_quick(test(thd->options & OPTION_SAFE_UPDATES), limit)) || !limit) {