diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_myisam.cc | 8 | ||||
-rw-r--r-- | sql/mysqlbinlog.cc | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 33 | ||||
-rw-r--r-- | sql/share/swedish/errmsg.OLD | 1 | ||||
-rw-r--r-- | sql/sql_base.cc | 5 | ||||
-rw-r--r-- | sql/sql_parse.cc | 22 | ||||
-rw-r--r-- | sql/sql_show.cc | 9 |
7 files changed, 52 insertions, 28 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 21cfab6b701..223e14b06c7 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -483,6 +483,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) char fixed_name[FN_REFLEN]; const char *old_proc_info=thd->proc_info; MYISAM_SHARE* share = file->s; + ha_rows rows= file->state->records; DBUG_ENTER("ha_myisam::repair"); param.table_name = table->table_name; @@ -559,6 +560,13 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) T_STATISTICS ? UPDATE_STAT : 0)); info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE | HA_STATUS_CONST); + if (rows != file->state->records) + { + char llbuff[22],llbuff2[22]; + mi_check_print_warning(¶m,"Number of rows changed from %s to %s", + llstr(rows,llbuff), + llstr(file->state->records,llbuff2)); + } } else { diff --git a/sql/mysqlbinlog.cc b/sql/mysqlbinlog.cc index 0fe9ab21987..087d1029afb 100644 --- a/sql/mysqlbinlog.cc +++ b/sql/mysqlbinlog.cc @@ -388,7 +388,9 @@ int main(int argc, char** argv) if(use_remote) { +#ifndef __WIN__ init_thr_alarm(10); // need to do this manually +#endif mysql = safe_connect(); } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 88b60ef92ad..810cd3e3b17 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -170,6 +170,7 @@ static struct rand_struct sql_rand; static int cleanup_done; static char **defaults_argv,time_zone[30]; static const char *default_table_type_name; +static char glob_hostname[FN_REFLEN]; #ifdef HAVE_OPENSSL static bool opt_use_ssl = FALSE; @@ -356,6 +357,7 @@ static void close_connections(void) #if defined(AIX_3_2) || defined(HAVE_DEC_3_2_THREADS) if (ip_sock != INVALID_SOCKET) { + DBUG_PRINT("error",("closing TCP/IP and socket files")); VOID(shutdown(ip_sock,2)); VOID(closesocket(ip_sock)); VOID(shutdown(unix_sock,2)); @@ -607,12 +609,15 @@ void clean_up(void) free_defaults(defaults_argv); my_free(mysql_tmpdir,MYF(0)); x_free(opt_bin_logname); +#ifndef __WIN__ (void) my_delete(pidfile_name,MYF(0)); // This may not always exist - my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); +#endif + my_thread_end(); /* Tell main we are ready */ (void) pthread_mutex_lock(&LOCK_thread_count); ready_to_exit=1; + /* do the broadcast inside the lock to ensure that my_end() is not called */ (void) pthread_cond_broadcast(&COND_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count); } /* clean_up */ @@ -926,8 +931,8 @@ void end_thread(THD *thd, bool put_in_cache) DBUG_PRINT("info", ("sending a broadcast")) /* Tell main we are ready */ - (void) pthread_cond_broadcast(&COND_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count); + (void) pthread_cond_broadcast(&COND_thread_count); DBUG_PRINT("info", ("unlocked thread_count mutex")) #ifdef ONE_THREAD if (!(test_flags & TEST_NO_THREADS)) // For debugging under Linux @@ -1308,7 +1313,6 @@ int main(int argc, char **argv) #endif { DEBUGGER_OFF; - char hostname[FN_REFLEN]; my_umask=0660; // Default umask for new files my_umask_dir=0700; // Default umask for new directories @@ -1332,9 +1336,9 @@ int main(int argc, char **argv) #endif #endif - if (gethostname(hostname,sizeof(hostname)-4) < 0) - strmov(hostname,"mysql"); - strmov(pidfile_name,hostname); + if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0) + strmov(glob_hostname,"mysql"); + strmov(pidfile_name,glob_hostname); strmov(strcend(pidfile_name,'.'),".pid"); // Add extension #ifdef DEMO_VERSION strcat(server_version,"-demo"); @@ -1488,9 +1492,9 @@ int main(int argc, char **argv) /* Setup log files */ if (opt_log) - open_log(&mysql_log, hostname, opt_logname, ".log", LOG_NORMAL); + open_log(&mysql_log, glob_hostname, opt_logname, ".log", LOG_NORMAL); if (opt_update_log) - open_log(&mysql_update_log, hostname, opt_update_logname, "", + open_log(&mysql_update_log, glob_hostname, opt_update_logname, "", LOG_NEW); if (opt_bin_log) { @@ -1499,12 +1503,12 @@ int main(int argc, char **argv) if (!opt_bin_logname) { char tmp[FN_REFLEN]; - strnmov(tmp,hostname,FN_REFLEN-5); + strnmov(tmp,glob_hostname,FN_REFLEN-5); strmov(strcend(tmp,'.'),"-bin"); opt_bin_logname=my_strdup(tmp,MYF(MY_WME)); } mysql_bin_log.set_index_file_name(opt_binlog_index_name); - open_log(&mysql_bin_log, hostname, opt_bin_logname, "-bin", + open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin", LOG_BIN); } else @@ -1512,7 +1516,7 @@ int main(int argc, char **argv) } if (opt_slow_log) - open_log(&mysql_slow_log, hostname, opt_slow_logname, "-slow.log", + open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log", LOG_NORMAL); if (ha_init()) { @@ -1711,10 +1715,7 @@ int main(int argc, char **argv) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); } (void) pthread_mutex_unlock(&LOCK_thread_count); -#ifndef __WIN__ - (void) my_delete(pidfile_name,MYF(0)); // Not neaded anymore -#endif - my_thread_end(); + my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); exit(0); return(0); /* purecov: deadcode */ } @@ -2089,8 +2090,8 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) #ifdef __NT__ pthread_mutex_lock(&LOCK_thread_count); handler_count--; - pthread_cond_signal(&COND_handler_count); pthread_mutex_unlock(&LOCK_thread_count); + pthread_cond_signal(&COND_handler_count); #endif DBUG_RETURN(0); } diff --git a/sql/share/swedish/errmsg.OLD b/sql/share/swedish/errmsg.OLD index f1a8062e390..78dfa51a806 100644 --- a/sql/share/swedish/errmsg.OLD +++ b/sql/share/swedish/errmsg.OLD @@ -197,5 +197,4 @@ "Okänd system variabel '%-.64'", "Tabell '%-.64s' är crashad och bör repareras med REPAIR TABLE", "Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades", -#ER_WARNING_NOT_COMPLETE_ROLLBACK "Warning: Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK", diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f582b4a85af..75add1e7a5f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -669,12 +669,11 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, DBUG_RETURN(0); key_length= (uint) (strmov(strmov(key,db)+1,table_name)-key)+1; int4store(key + key_length, thd->slave_proxy_id); - key_length += 4; for (table=thd->temporary_tables; table ; table=table->next) { - if (table->key_length == key_length && - !memcmp(table->table_cache_key,key,key_length)) + if (table->key_length == key_length+4 && + !memcmp(table->table_cache_key,key,key_length+4)) { if (table->query_id == thd->query_id) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c54bf0dc9c1..bfa8e2e1ae2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1404,8 +1404,11 @@ mysql_execute_command(void) #endif break; } - case SQLCOM_DELETE: case SQLCOM_TRUNCATE: + lex->where=0; + lex->select_limit=HA_POS_ERROR; + /* Fall through */ + case SQLCOM_DELETE: { if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege)) goto error; /* purecov: inspected */ @@ -1589,7 +1592,10 @@ mysql_execute_command(void) } } else + { + thd->options&= ~(ulong) (OPTION_STATUS_NO_TRANS_UPDATE); thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT; + } } send_ok(&thd->net); break; @@ -1755,9 +1761,17 @@ mysql_execute_command(void) } break; case SQLCOM_BEGIN: - thd->options|= OPTION_BEGIN; - thd->server_status|= SERVER_STATUS_IN_TRANS; - send_ok(&thd->net); + if (end_active_trans(thd)) + { + res= -1; + } + else + { + thd->options= ((thd->options & (ulong) (OPTION_STATUS_NO_TRANS_UPDATE)) | + OPTION_BEGIN); + thd->server_status|= SERVER_STATUS_IN_TRANS; + send_ok(&thd->net); + } break; case SQLCOM_COMMIT: /* diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a9e43198d5a..c5f1eec7cde 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -23,7 +23,8 @@ #include "sql_select.h" // For select_describe #include "sql_acl.h" #include <my_dir.h> -extern "C" pthread_mutex_t THR_LOCK_keycache; + +/* extern "C" pthread_mutex_t THR_LOCK_keycache; */ static const char *grant_names[]={ "select","insert","update","delete","create","drop","reload","shutdown", @@ -988,7 +989,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables) if (send_fields(thd,field_list,1)) DBUG_RETURN(1); /* purecov: inspected */ - pthread_mutex_lock(&THR_LOCK_keycache); + /* pthread_mutex_lock(&THR_LOCK_keycache); */ pthread_mutex_lock(&LOCK_status); for (i=0; variables[i].name; i++) { @@ -1037,13 +1038,13 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables) } } pthread_mutex_unlock(&LOCK_status); - pthread_mutex_unlock(&THR_LOCK_keycache); + /* pthread_mutex_unlock(&THR_LOCK_keycache); */ send_eof(&thd->net); DBUG_RETURN(0); err: pthread_mutex_unlock(&LOCK_status); - pthread_mutex_unlock(&THR_LOCK_keycache); + /* pthread_mutex_unlock(&THR_LOCK_keycache); */ DBUG_RETURN(1); } |