From 5aa1b53f80ca8d27c5f48da3d58a6ae134eb0785 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Aug 2005 21:02:05 -0500 Subject: [PATCH 01/27] set_var.cc: Reorder out-of-order system variables. sql/set_var.cc: Reorder out-of-order system variables. --- sql/set_var.cc | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sql/set_var.cc b/sql/set_var.cc index aa6ddb63a04..c7d7c6fce6e 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -496,18 +496,18 @@ struct show_var_st init_vars[]= { {sys_flush.name, (char*) &sys_flush, SHOW_SYS}, {sys_flush_time.name, (char*) &sys_flush_time, SHOW_SYS}, {"ft_boolean_syntax", (char*) ft_boolean_syntax, SHOW_CHAR}, - {"ft_min_word_len", (char*) &ft_min_word_len, SHOW_LONG}, {"ft_max_word_len", (char*) &ft_max_word_len, SHOW_LONG}, {"ft_max_word_len_for_sort",(char*) &ft_max_word_len_for_sort, SHOW_LONG}, + {"ft_min_word_len", (char*) &ft_min_word_len, SHOW_LONG}, {"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR_PTR}, {"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE}, {"have_crypt", (char*) &have_crypt, SHOW_HAVE}, {"have_innodb", (char*) &have_innodb, SHOW_HAVE}, {"have_isam", (char*) &have_isam, SHOW_HAVE}, - {"have_raid", (char*) &have_raid, SHOW_HAVE}, - {"have_symlink", (char*) &have_symlink, SHOW_HAVE}, {"have_openssl", (char*) &have_openssl, SHOW_HAVE}, {"have_query_cache", (char*) &have_query_cache, SHOW_HAVE}, + {"have_raid", (char*) &have_raid, SHOW_HAVE}, + {"have_symlink", (char*) &have_symlink, SHOW_HAVE}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, #ifdef HAVE_INNOBASE_DB {"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG }, @@ -515,12 +515,11 @@ struct show_var_st init_vars[]= { {"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG }, {"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR}, {"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR}, - {"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG }, - {"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG }, - {"innodb_thread_concurrency", (char*) &innobase_thread_concurrency, SHOW_LONG }, - {"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_INT}, {"innodb_fast_shutdown", (char*) &innobase_fast_shutdown, SHOW_MY_BOOL}, + {"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG }, + {"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_INT}, {"innodb_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR}, + {"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG }, {"innodb_lock_wait_timeout", (char*) &innobase_lock_wait_timeout, SHOW_LONG }, {"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR}, {"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL}, @@ -528,10 +527,11 @@ struct show_var_st init_vars[]= { {"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONG}, {"innodb_log_files_in_group", (char*) &innobase_log_files_in_group, SHOW_LONG}, {"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR}, - {"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG}, {sys_innodb_max_dirty_pages_pct.name, (char*) &sys_innodb_max_dirty_pages_pct, SHOW_SYS}, {sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS}, + {"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG}, {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS}, + {"innodb_thread_concurrency", (char*) &innobase_thread_concurrency, SHOW_LONG }, #endif {sys_interactive_timeout.name,(char*) &sys_interactive_timeout, SHOW_SYS}, {sys_join_buffer_size.name, (char*) &sys_join_buffer_size, SHOW_SYS}, @@ -544,10 +544,11 @@ struct show_var_st init_vars[]= { {"locked_in_memory", (char*) &locked_in_memory, SHOW_BOOL}, #endif {"log", (char*) &opt_log, SHOW_BOOL}, - {"log_update", (char*) &opt_update_log, SHOW_BOOL}, {"log_bin", (char*) &opt_bin_log, SHOW_BOOL}, + {"log_error", (char*) log_error_file, SHOW_CHAR}, {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL}, {"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL}, + {"log_update", (char*) &opt_update_log, SHOW_BOOL}, {sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS}, {sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS}, {sys_low_priority_updates.name, (char*) &sys_low_priority_updates, SHOW_SYS}, @@ -556,27 +557,27 @@ struct show_var_st init_vars[]= { {sys_max_allowed_packet.name,(char*) &sys_max_allowed_packet, SHOW_SYS}, {sys_max_binlog_cache_size.name,(char*) &sys_max_binlog_cache_size, SHOW_SYS}, {sys_max_binlog_size.name, (char*) &sys_max_binlog_size, SHOW_SYS}, - {sys_max_connections.name, (char*) &sys_max_connections, SHOW_SYS}, {sys_max_connect_errors.name, (char*) &sys_max_connect_errors, SHOW_SYS}, + {sys_max_connections.name, (char*) &sys_max_connections, SHOW_SYS}, {sys_max_delayed_threads.name,(char*) &sys_max_delayed_threads, SHOW_SYS}, + {sys_max_heap_table_size.name,(char*) &sys_max_heap_table_size, SHOW_SYS}, {sys_max_insert_delayed_threads.name, (char*) &sys_max_insert_delayed_threads, SHOW_SYS}, - {sys_max_heap_table_size.name,(char*) &sys_max_heap_table_size, SHOW_SYS}, {sys_max_join_size.name, (char*) &sys_max_join_size, SHOW_SYS}, {sys_max_relay_log_size.name, (char*) &sys_max_relay_log_size, SHOW_SYS}, {sys_max_seeks_for_key.name, (char*) &sys_max_seeks_for_key, SHOW_SYS}, {sys_max_sort_length.name, (char*) &sys_max_sort_length, SHOW_SYS}, - {sys_max_user_connections.name,(char*) &sys_max_user_connections, SHOW_SYS}, {sys_max_tmp_tables.name, (char*) &sys_max_tmp_tables, SHOW_SYS}, + {sys_max_user_connections.name,(char*) &sys_max_user_connections, SHOW_SYS}, {sys_max_write_lock_count.name, (char*) &sys_max_write_lock_count,SHOW_SYS}, {sys_myisam_max_extra_sort_file_size.name, (char*) &sys_myisam_max_extra_sort_file_size, SHOW_SYS}, {sys_myisam_max_sort_file_size.name, (char*) &sys_myisam_max_sort_file_size, SHOW_SYS}, + {"myisam_recover_options", (char*) &myisam_recover_options_str, SHOW_CHAR_PTR}, {sys_myisam_repair_threads.name, (char*) &sys_myisam_repair_threads, SHOW_SYS}, - {"myisam_recover_options", (char*) &myisam_recover_options_str, SHOW_CHAR_PTR}, {sys_myisam_sort_buffer_size.name, (char*) &sys_myisam_sort_buffer_size, SHOW_SYS}, #ifdef __NT__ {"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL}, @@ -588,7 +589,6 @@ struct show_var_st init_vars[]= { {sys_new_mode.name, (char*) &sys_new_mode, SHOW_SYS}, {"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}, {"protocol_version", (char*) &protocol_version, SHOW_INT}, {sys_query_alloc_block_size.name, (char*) &sys_query_alloc_block_size, @@ -608,10 +608,10 @@ struct show_var_st init_vars[]= { {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS}, {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS}, {sys_server_id.name, (char*) &sys_server_id, SHOW_SYS}, - {sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS}, {"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL}, {"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL}, {"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL}, + {sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS}, {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}, @@ -625,7 +625,6 @@ struct show_var_st init_vars[]= { {"thread_concurrency", (char*) &concurrency, SHOW_LONG}, #endif {"thread_stack", (char*) &thread_stack, SHOW_LONG}, - {sys_tx_isolation.name, (char*) &sys_tx_isolation, SHOW_SYS}, #ifdef HAVE_TZNAME {"timezone", time_zone, SHOW_CHAR}, #endif @@ -634,6 +633,7 @@ struct show_var_st init_vars[]= { {sys_trans_alloc_block_size.name, (char*) &sys_trans_alloc_block_size, SHOW_SYS}, {sys_trans_prealloc_size.name, (char*) &sys_trans_prealloc_size, SHOW_SYS}, + {sys_tx_isolation.name, (char*) &sys_tx_isolation, SHOW_SYS}, {"version", server_version, SHOW_CHAR}, {"version_comment", (char*) MYSQL_COMPILATION_COMMENT, SHOW_CHAR}, {sys_os.name, (char*) &sys_os, SHOW_SYS}, From fefb444caf125df44ee5cb5af607c85fe1f8f6f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Aug 2005 21:04:58 -0500 Subject: [PATCH 02/27] mysqld.cc: Reorder out-of-order status variables. sql/mysqld.cc: Reorder out-of-order status variables. --- sql/mysqld.cc | 64 +++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 82335e7d706..141b72b7157 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4483,6 +4483,7 @@ struct show_var_st status_vars[]= { {"Com_show_databases", (char*) (com_stat+(uint) SQLCOM_SHOW_DATABASES),SHOW_LONG}, {"Com_show_fields", (char*) (com_stat+(uint) SQLCOM_SHOW_FIELDS),SHOW_LONG}, {"Com_show_grants", (char*) (com_stat+(uint) SQLCOM_SHOW_GRANTS),SHOW_LONG}, + {"Com_show_innodb_status", (char*) (com_stat+(uint) SQLCOM_SHOW_INNODB_STATUS),SHOW_LONG}, {"Com_show_keys", (char*) (com_stat+(uint) SQLCOM_SHOW_KEYS),SHOW_LONG}, {"Com_show_logs", (char*) (com_stat+(uint) SQLCOM_SHOW_LOGS),SHOW_LONG}, {"Com_show_master_status", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG}, @@ -4492,7 +4493,6 @@ struct show_var_st status_vars[]= { {"Com_show_slave_hosts", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_HOSTS),SHOW_LONG}, {"Com_show_slave_status", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG}, {"Com_show_status", (char*) (com_stat+(uint) SQLCOM_SHOW_STATUS),SHOW_LONG}, - {"Com_show_innodb_status", (char*) (com_stat+(uint) SQLCOM_SHOW_INNODB_STATUS),SHOW_LONG}, {"Com_show_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLES),SHOW_LONG}, {"Com_show_variables", (char*) (com_stat+(uint) SQLCOM_SHOW_VARIABLES),SHOW_LONG}, {"Com_slave_start", (char*) (com_stat+(uint) SQLCOM_SLAVE_START),SHOW_LONG}, @@ -4503,11 +4503,11 @@ struct show_var_st status_vars[]= { {"Com_update_multi", (char*) (com_stat+(uint) SQLCOM_MULTI_UPDATE),SHOW_LONG}, {"Connections", (char*) &thread_id, SHOW_LONG_CONST}, {"Created_tmp_disk_tables", (char*) &created_tmp_disk_tables,SHOW_LONG}, - {"Created_tmp_tables", (char*) &created_tmp_tables, SHOW_LONG}, {"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG}, + {"Created_tmp_tables", (char*) &created_tmp_tables, SHOW_LONG}, + {"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG}, {"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG_CONST}, {"Delayed_writes", (char*) &delayed_insert_writes, SHOW_LONG}, - {"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG}, {"Flush_commands", (char*) &refresh_version, SHOW_LONG_CONST}, {"Handler_commit", (char*) &ha_commit_count, SHOW_LONG}, {"Handler_delete", (char*) &ha_delete_count, SHOW_LONG}, @@ -4526,26 +4526,26 @@ struct show_var_st status_vars[]= { {"Key_write_requests", (char*) &_my_cache_w_requests, SHOW_LONG}, {"Key_writes", (char*) &_my_cache_write, SHOW_LONG}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, - {"Not_flushed_key_blocks", (char*) &_my_blocks_changed, SHOW_LONG_CONST}, {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_CONST}, - {"Open_tables", (char*) 0, SHOW_OPENTABLES}, + {"Not_flushed_key_blocks", (char*) &_my_blocks_changed, SHOW_LONG_CONST}, {"Open_files", (char*) &my_file_opened, SHOW_LONG_CONST}, {"Open_streams", (char*) &my_stream_opened, SHOW_LONG_CONST}, + {"Open_tables", (char*) 0, SHOW_OPENTABLES}, {"Opened_tables", (char*) &opened_tables, SHOW_LONG}, - {"Questions", (char*) 0, SHOW_QUESTION}, #ifdef HAVE_QUERY_CACHE - {"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_CONST}, - {"Qcache_inserts", (char*) &query_cache.inserts, SHOW_LONG}, - {"Qcache_hits", (char*) &query_cache.hits, SHOW_LONG}, - {"Qcache_lowmem_prunes", (char*) &query_cache.lowmem_prunes, SHOW_LONG}, - {"Qcache_not_cached", (char*) &query_cache.refused, SHOW_LONG}, - {"Qcache_free_memory", (char*) &query_cache.free_memory, - SHOW_LONG_CONST}, {"Qcache_free_blocks", (char*) &query_cache.free_memory_blocks, SHOW_LONG_CONST}, + {"Qcache_free_memory", (char*) &query_cache.free_memory, + SHOW_LONG_CONST}, + {"Qcache_hits", (char*) &query_cache.hits, SHOW_LONG}, + {"Qcache_inserts", (char*) &query_cache.inserts, SHOW_LONG}, + {"Qcache_lowmem_prunes", (char*) &query_cache.lowmem_prunes, SHOW_LONG}, + {"Qcache_not_cached", (char*) &query_cache.refused, SHOW_LONG}, + {"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_CONST}, {"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_CONST}, #endif /*HAVE_QUERY_CACHE*/ + {"Questions", (char*) 0, SHOW_QUESTION}, {"Rpl_status", (char*) 0, SHOW_RPL_STATUS}, {"Select_full_join", (char*) &select_full_join_count, SHOW_LONG}, {"Select_full_range_join", (char*) &select_full_range_join_count, SHOW_LONG}, @@ -4561,35 +4561,35 @@ struct show_var_st status_vars[]= { {"Sort_rows", (char*) &filesort_rows, SHOW_LONG}, {"Sort_scan", (char*) &filesort_scan_count, SHOW_LONG}, #ifdef HAVE_OPENSSL - {"Ssl_accepts", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT}, - {"Ssl_finished_accepts", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT_GOOD}, - {"Ssl_finished_connects", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT_GOOD}, {"Ssl_accept_renegotiates", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT_RENEGOTIATE}, - {"Ssl_connect_renegotiates", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT_RENEGOTIATE}, + {"Ssl_accepts", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT}, {"Ssl_callback_cache_hits", (char*) 0, SHOW_SSL_CTX_SESS_CB_HITS}, - {"Ssl_session_cache_hits", (char*) 0, SHOW_SSL_CTX_SESS_HITS}, - {"Ssl_session_cache_misses", (char*) 0, SHOW_SSL_CTX_SESS_MISSES}, - {"Ssl_session_cache_timeouts", (char*) 0, SHOW_SSL_CTX_SESS_TIMEOUTS}, - {"Ssl_used_session_cache_entries",(char*) 0, SHOW_SSL_CTX_SESS_NUMBER}, - {"Ssl_client_connects", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT}, - {"Ssl_session_cache_overflows", (char*) 0, SHOW_SSL_CTX_SESS_CACHE_FULL}, - {"Ssl_session_cache_size", (char*) 0, SHOW_SSL_CTX_SESS_GET_CACHE_SIZE}, - {"Ssl_session_cache_mode", (char*) 0, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE}, - {"Ssl_sessions_reused", (char*) 0, SHOW_SSL_SESSION_REUSED}, - {"Ssl_ctx_verify_mode", (char*) 0, SHOW_SSL_CTX_GET_VERIFY_MODE}, - {"Ssl_ctx_verify_depth", (char*) 0, SHOW_SSL_CTX_GET_VERIFY_DEPTH}, - {"Ssl_verify_mode", (char*) 0, SHOW_SSL_GET_VERIFY_MODE}, - {"Ssl_verify_depth", (char*) 0, SHOW_SSL_GET_VERIFY_DEPTH}, - {"Ssl_version", (char*) 0, SHOW_SSL_GET_VERSION}, {"Ssl_cipher", (char*) 0, SHOW_SSL_GET_CIPHER}, {"Ssl_cipher_list", (char*) 0, SHOW_SSL_GET_CIPHER_LIST}, + {"Ssl_client_connects", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT}, + {"Ssl_connect_renegotiates", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT_RENEGOTIATE}, + {"Ssl_ctx_verify_depth", (char*) 0, SHOW_SSL_CTX_GET_VERIFY_DEPTH}, + {"Ssl_ctx_verify_mode", (char*) 0, SHOW_SSL_CTX_GET_VERIFY_MODE}, {"Ssl_default_timeout", (char*) 0, SHOW_SSL_GET_DEFAULT_TIMEOUT}, + {"Ssl_finished_accepts", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT_GOOD}, + {"Ssl_finished_connects", (char*) 0, SHOW_SSL_CTX_SESS_CONNECT_GOOD}, + {"Ssl_session_cache_hits", (char*) 0, SHOW_SSL_CTX_SESS_HITS}, + {"Ssl_session_cache_misses", (char*) 0, SHOW_SSL_CTX_SESS_MISSES}, + {"Ssl_session_cache_mode", (char*) 0, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE}, + {"Ssl_session_cache_overflows", (char*) 0, SHOW_SSL_CTX_SESS_CACHE_FULL}, + {"Ssl_session_cache_size", (char*) 0, SHOW_SSL_CTX_SESS_GET_CACHE_SIZE}, + {"Ssl_session_cache_timeouts", (char*) 0, SHOW_SSL_CTX_SESS_TIMEOUTS}, + {"Ssl_sessions_reused", (char*) 0, SHOW_SSL_SESSION_REUSED}, + {"Ssl_used_session_cache_entries",(char*) 0, SHOW_SSL_CTX_SESS_NUMBER}, + {"Ssl_verify_depth", (char*) 0, SHOW_SSL_GET_VERIFY_DEPTH}, + {"Ssl_verify_mode", (char*) 0, SHOW_SSL_GET_VERIFY_MODE}, + {"Ssl_version", (char*) 0, SHOW_SSL_GET_VERSION}, #endif /* HAVE_OPENSSL */ {"Table_locks_immediate", (char*) &locks_immediate, SHOW_LONG}, {"Table_locks_waited", (char*) &locks_waited, SHOW_LONG}, {"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_CONST}, - {"Threads_created", (char*) &thread_created, SHOW_LONG_CONST}, {"Threads_connected", (char*) &thread_count, SHOW_INT_CONST}, + {"Threads_created", (char*) &thread_created, SHOW_LONG_CONST}, {"Threads_running", (char*) &thread_running, SHOW_INT_CONST}, {"Uptime", (char*) 0, SHOW_STARTTIME}, {NullS, NullS, SHOW_LONG} From 472b002b7510544018a0a254b6e0fd936e20835b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Aug 2005 12:08:04 -0500 Subject: [PATCH 03/27] set_var.cc: Reorder out-of-order system variables. sql/set_var.cc: Reorder out-of-order system variables. --- sql/set_var.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/set_var.cc b/sql/set_var.cc index c7d7c6fce6e..f12b81f0682 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -472,10 +472,10 @@ struct show_var_st init_vars[]= { {"basedir", mysql_home, SHOW_CHAR}, #ifdef HAVE_BERKELEY_DB {"bdb_cache_size", (char*) &berkeley_cache_size, SHOW_LONG}, - {"bdb_log_buffer_size", (char*) &berkeley_log_buffer_size, SHOW_LONG}, {"bdb_home", (char*) &berkeley_home, SHOW_CHAR_PTR}, - {"bdb_max_lock", (char*) &berkeley_max_lock, SHOW_LONG}, + {"bdb_log_buffer_size", (char*) &berkeley_log_buffer_size, SHOW_LONG}, {"bdb_logdir", (char*) &berkeley_logdir, SHOW_CHAR_PTR}, + {"bdb_max_lock", (char*) &berkeley_max_lock, SHOW_LONG}, {"bdb_shared_data", (char*) &berkeley_shared_data, SHOW_BOOL}, {"bdb_tmpdir", (char*) &berkeley_tmpdir, SHOW_CHAR_PTR}, {"bdb_version", (char*) DB_VERSION_STRING, SHOW_CHAR}, From 67278665d09ac53d670c77ab5562e88f9a1c3731 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Aug 2005 22:35:48 -0500 Subject: [PATCH 04/27] fulltext_var.result: Update test result. mysql-test/r/fulltext_var.result: Update test result. --- mysql-test/r/fulltext_var.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/fulltext_var.result b/mysql-test/r/fulltext_var.result index dda8e332fba..ef666cb4577 100644 --- a/mysql-test/r/fulltext_var.result +++ b/mysql-test/r/fulltext_var.result @@ -1,7 +1,7 @@ show variables like "ft\_%"; Variable_name Value ft_boolean_syntax + -><()~*:""&| -ft_min_word_len 4 ft_max_word_len 254 ft_max_word_len_for_sort 20 +ft_min_word_len 4 ft_stopword_file (built-in) From 969391784f305027466d0d79b271311f22bc583b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 31 Aug 2005 13:03:24 +0500 Subject: [PATCH 05/27] bug#9948 changed client-charset behavior in 4.1.x libmysql, which issue BC prob sql_parse.cc: mysqld.cc: Added --skip-client-character-set-handshake. When this option is activated, client side character set (which is sent in handshake) is ignored, and server side default-character-set value is used for character_set_client and character_set_results, thus reprodicing 4.0 behaviour. sql/mysqld.cc: bug#9948 changed client-charset behavior in 4.1.x libmysql, which issue BC prob Added --skip-client-character-set-handshake, to reproduce 4.0 behaviour. sql/sql_parse.cc: bug#9948 changed client-charset behavior in 4.1.x libmysql, which issue BC prob Added --skip-client-character-set-handshake, to reproduce 4.0 behaviour. --- sql/mysqld.cc | 7 +++++++ sql/sql_parse.cc | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 865f494bbc9..59b733b594c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -271,6 +271,7 @@ arg_cmp_func Arg_comparator::comparator_matrix[4][2] = bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; bool opt_error_log= IF_WIN(1,0); bool opt_disable_networking=0, opt_skip_show_db=0; +bool opt_skip_character_set_client_handshake= 0; bool lower_case_table_names_used= 0; bool server_id_supplied = 0; bool opt_endinfo,using_udf_functions, locked_in_memory; @@ -4216,6 +4217,7 @@ enum options_mysqld OPT_EXPIRE_LOGS_DAYS, OPT_GROUP_CONCAT_MAX_LEN, OPT_DEFAULT_COLLATION, + OPT_CHARACTER_SET_CLIENT_HANDSHAKE, OPT_INIT_CONNECT, OPT_INIT_SLAVE, OPT_SECURE_AUTH, @@ -4753,6 +4755,11 @@ Can't be set to 1 if --log-slave-updates is used.", "Show user and password in SHOW SLAVE HOSTS on this master", (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"skip-character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE, + "Don't use client side character set value sent during handshake.", + (gptr*) &opt_skip_character_set_client_handshake, + (gptr*) &opt_skip_character_set_client_handshake, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-grant-tables", OPT_SKIP_GRANT, "Start without grant tables. This gives all users FULL ACCESS to all tables!", (gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index caf76b19eb2..b8eae3aac74 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -811,11 +811,13 @@ static int check_connection(THD *thd) DBUG_PRINT("info", ("client_character_set: %d", (uint) net->read_pos[8])); /* Use server character set and collation if + - opt_skip_character_set_client_handshake is set - client has not specified a character set - client character set is the same as the servers - client character set doesn't exists in server */ - if (!(thd->variables.character_set_client= + if (opt_skip_character_set_client_handshake || + !(thd->variables.character_set_client= get_charset((uint) net->read_pos[8], MYF(0))) || !my_strcasecmp(&my_charset_latin1, global_system_variables.character_set_client->name, From 4eff41f5921d59b76f369952080914fd2e5b3110 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 31 Aug 2005 12:13:22 +0200 Subject: [PATCH 06/27] Clone of 4.0.26 is taken, increase version number. --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 83685009ee6..c473fb21dbd 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 4.0.26) +AM_INIT_AUTOMAKE(mysql, 4.0.27) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From 6189933e782a1bf79d3aee8ff1807e762dbc701c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Sep 2005 11:40:21 -0700 Subject: [PATCH 07/27] delete row now pulls error message from remote server. Added test cases with archive (where delete & update will always fail) http://bugs.mysql.com/bug.php?id=12659 sql/ha_federated.cc: populate the error buffer with error message from remote system --- mysql-test/r/federated_archive.result | 48 ++++++++++++++++++++++ mysql-test/t/federated_archive.test | 58 +++++++++++++++++++++++++++ sql/ha_federated.cc | 2 + 3 files changed, 108 insertions(+) create mode 100644 mysql-test/r/federated_archive.result create mode 100644 mysql-test/t/federated_archive.test diff --git a/mysql-test/r/federated_archive.result b/mysql-test/r/federated_archive.result new file mode 100644 index 00000000000..f0eded42c38 --- /dev/null +++ b/mysql-test/r/federated_archive.result @@ -0,0 +1,48 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +stop slave; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP TABLE IF EXISTS federated.archive_table; +CREATE TABLE federated.archive_table ( +`id` int(4) NOT NULL, +`name` varchar(54) default NULL +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(4) NOT NULL, +`name` varchar(54) default NULL, +PRIMARY KEY (`id`) +) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/archive_table'; +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'bar'); +SELECT * FROM federated.t1; +id name +1 foo +2 bar +DELETE FROM federated.t1 WHERE id = 1; +ERROR HY000: There was a problem processing the query on the foreign data source. Data source error: ': 1031 : Table storage engine for 'archive_table' doesn't have t' +SELECT * FROM federated.t1; +id name +1 foo +2 bar +UPDATE federated.t1 SET name='baz' WHERE id = 1; +ERROR HY000: There was a problem processing the query on the foreign data source. Data source error: ': 1031 : Table storage engine for 'archive_table' doesn't have t' +SELECT * FROM federated.t1; +id name +1 foo +2 bar +DROP TABLE federated.t1; +DROP TABLE federated.archive_table; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/t/federated_archive.test b/mysql-test/t/federated_archive.test new file mode 100644 index 00000000000..facddebf558 --- /dev/null +++ b/mysql-test/t/federated_archive.test @@ -0,0 +1,58 @@ +source include/have_archive.inc; +source include/federated.inc; + + +connection slave; +--disable_warnings +DROP TABLE IF EXISTS federated.archive_table; +--enable_warnings + +CREATE TABLE federated.archive_table ( + `id` int(4) NOT NULL, + `name` varchar(54) default NULL + ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; + + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.t1; +--enable_warnings + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(4) NOT NULL, + `name` varchar(54) default NULL, + PRIMARY KEY (`id`) + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/archive_table'; + +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'bar'); + +SELECT * FROM federated.t1; + +--error 1430 +DELETE FROM federated.t1 WHERE id = 1; + +SELECT * FROM federated.t1; + + +--error 1430 +UPDATE federated.t1 SET name='baz' WHERE id = 1; + +SELECT * FROM federated.t1; + + +# --error 1430 +# TRUNCATE federated.t1; +# +# SELECT * from federated.t1; + +DROP TABLE federated.t1; +connection slave; +DROP TABLE federated.archive_table; + + +source include/federated_cleanup.inc; + diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 639f09d10ca..96cb81fe3ec 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -1960,6 +1960,8 @@ int ha_federated::delete_row(const byte *buf) { int error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE; char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; + my_sprintf(error_buffer, (error_buffer, ": %d : %s", + mysql_errno(mysql), mysql_error(mysql))); my_error(error_code, MYF(0), error_buffer); DBUG_RETURN(error_code); } From a59a44410899029ca01787553c3a42d6008f6bbc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Sep 2005 17:07:05 -0700 Subject: [PATCH 08/27] Backport of JimW's localhost patch to 4.1 tree. Handle systems like default FC4 where 127.0.0.1 doesn't always map to 'localhost' first. (Bug #11822) sql/hostname.cc: Short-circuit ip_to_hostname() lookup for INADDR_LOOPBACK to allways return 'localhost'. sql/sql_parse.cc: Push special handling of 127.0.0.1 into ip_to_hostname(). --- sql/hostname.cc | 10 +++++++++- sql/sql_parse.cc | 30 ++++++++++-------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/sql/hostname.cc b/sql/hostname.cc index 39223556024..32e1d84fac3 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -130,15 +130,23 @@ void reset_host_errors(struct in_addr *in) VOID(pthread_mutex_unlock(&hostname_cache->lock)); } +/* Deal with systems that don't defined INADDR_LOOPBACK */ +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK 0x7f000001UL +#endif my_string ip_to_hostname(struct in_addr *in, uint *errors) { uint i; host_entry *entry; DBUG_ENTER("ip_to_hostname"); + *errors= 0; + + /* We always treat the loopback address as "localhost". */ + if (in->s_addr == htonl(INADDR_LOOPBACK)) + DBUG_RETURN((char *)my_localhost); /* Check first if we have name in cache */ - *errors=0; if (!(specialflag & SPECIAL_NO_HOST_CACHE)) { VOID(pthread_mutex_lock(&hostname_cache->lock)); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 297ea8fbd67..99a64e845ef 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -696,29 +696,19 @@ static int check_connection(THD *thd) return (ER_OUT_OF_RESOURCES); thd->host_or_ip= thd->ip; vio_in_addr(net->vio,&thd->remote.sin_addr); -#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread) - /* Fast local hostname resolve for Win32 */ - if (!strcmp(thd->ip,"127.0.0.1")) + if (!(specialflag & SPECIAL_NO_RESOLVE)) { - thd->host= (char*) my_localhost; - thd->host_or_ip= my_localhost; - } - else -#endif - { - if (!(specialflag & SPECIAL_NO_RESOLVE)) + vio_in_addr(net->vio,&thd->remote.sin_addr); + thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); + /* Cut very long hostnames to avoid possible overflows */ + if (thd->host) { - vio_in_addr(net->vio,&thd->remote.sin_addr); - thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); - /* Cut very long hostnames to avoid possible overflows */ - if (thd->host) - { - thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; - thd->host_or_ip= thd->host; - } - if (connect_errors > max_connect_errors) - return(ER_HOST_IS_BLOCKED); + if (thd->host != my_localhost) + thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; + thd->host_or_ip= thd->host; } + if (connect_errors > max_connect_errors) + return(ER_HOST_IS_BLOCKED); } DBUG_PRINT("info",("Host: %s ip: %s", thd->host ? thd->host : "unknown host", From a0ea35da309df6c82ea91784f89e53cda0a153b1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Sep 2005 12:09:35 +0200 Subject: [PATCH 09/27] BUG#12983 TRASH macro confliciting with TRASH in my_sys.h mysys/my_alloc.c: Rename TRASH to TRASH_MEM and use the TRASH macro from my_sys.h --- mysys/my_alloc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 5a78eb17c96..fd5a4908572 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -221,11 +221,7 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) #endif } -#ifdef SAFEMALLOC -#define TRASH(X) bfill(((char*)(X) + ((X)->size-(X)->left)), (X)->left, 0xa5) -#else -#define TRASH /* no-op */ -#endif +#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left) /* Mark all data in blocks free for reusage */ @@ -239,7 +235,7 @@ static inline void mark_blocks_free(MEM_ROOT* root) for (next= root->free; next; next= *(last= &next->next)) { next->left= next->size - ALIGN_SIZE(sizeof(USED_MEM)); - TRASH(next); + TRASH_MEM(next); } /* Combine the free and the used list */ @@ -249,7 +245,7 @@ static inline void mark_blocks_free(MEM_ROOT* root) for (; next; next= next->next) { next->left= next->size - ALIGN_SIZE(sizeof(USED_MEM)); - TRASH(next); + TRASH_MEM(next); } /* Now everything is set; Indicate that nothing is used anymore */ @@ -310,7 +306,7 @@ void free_root(MEM_ROOT *root, myf MyFlags) { root->free=root->pre_alloc; root->free->left=root->pre_alloc->size-ALIGN_SIZE(sizeof(USED_MEM)); - TRASH(root->pre_alloc); + TRASH_MEM(root->pre_alloc); root->free->next=0; } root->block_num= 4; From e93e346a244d06b0bdb91d8c83b4da46a2406ac9 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Sep 2005 12:33:25 +0200 Subject: [PATCH 10/27] Remove extra ; mysql-test/t/openssl_1.test: Remove extra delimiter ; --- mysql-test/t/openssl_1.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 3698ab54ec1..3f398a91834 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -20,22 +20,22 @@ connect (con4,localhost,ssl_user4,,); connection con1; select * from t1; ---error 1044; +--error 1044 delete from t1; connection con2; select * from t1; ---error 1044; +--error 1044 delete from t1; connection con3; select * from t1; ---error 1044; +--error 1044 delete from t1; connection con4; select * from t1; ---error 1044; +--error 1044 delete from t1; connection default; From e10b50e6f13206ec8fc320518d4460ca39a12ed2 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Sep 2005 16:50:32 +0200 Subject: [PATCH 11/27] Bug#12959 mysqltest crashes if testcase passed with -x option client/mysqltest.c: Fixes for mysqltest -x mysql-test/t/mysqltest.test: Test mysqltest -x mysql-test/include/mysqltest-x.inc: New BitKeeper file ``mysql-test/include/mysqltest-x.inc'' --- client/mysqltest.c | 12 +++++++----- mysql-test/include/mysqltest-x.inc | 2 ++ mysql-test/t/mysqltest.test | 13 +++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 mysql-test/include/mysqltest-x.inc diff --git a/client/mysqltest.c b/client/mysqltest.c index 33702e9d1d2..78d873468c4 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2169,8 +2169,10 @@ int read_line(char *buf, int size) if (feof(cur_file->file)) { found_eof: - if (cur_file->file != stdin) + if (cur_file->file != stdin){ my_fclose(cur_file->file, MYF(0)); + cur_file->file= 0; + } my_free((gptr)cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR)); cur_file->file_name= 0; lineno--; @@ -2556,10 +2558,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), argument= buff; } fn_format(buff, argument, "", "", 4); - DBUG_ASSERT(cur_file->file == 0); + DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0); if (!(cur_file->file= my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME)))) - die("Could not open %s: errno = %d", argument, errno); + die("Could not open %s: errno = %d", buff, errno); + cur_file->file_name= my_strdup(buff, MYF(MY_FAE)); break; } case 'm': @@ -3746,9 +3749,8 @@ int main(int argc, char **argv) embedded_server_args, (char**) embedded_server_groups)) die("Can't initialize MySQL server"); - if (cur_file == file_stack) + if (cur_file == file_stack && cur_file->file == 0) { - DBUG_ASSERT(cur_file->file == 0); cur_file->file= stdin; cur_file->file_name= my_strdup("", MYF(MY_WME)); } diff --git a/mysql-test/include/mysqltest-x.inc b/mysql-test/include/mysqltest-x.inc new file mode 100644 index 00000000000..dd1468aed07 --- /dev/null +++ b/mysql-test/include/mysqltest-x.inc @@ -0,0 +1,2 @@ +echo Output from mysqltest-x.inc; + diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index bfb1919e75c..4c23f915503 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -792,6 +792,19 @@ select "a" as col1, "c" as col2; --error 1 --exec echo "save_master_pos; sync_with_master a;" | $MYSQL_TEST 2>&1 + +# ---------------------------------------------------------------------------- +# Test mysqltest arguments +# ---------------------------------------------------------------------------- + +# -x , use the file specified after -x as the test file +--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc +--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc +--exec $MYSQL_TEST --result_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc +--error 1 +--exec $MYSQL_TEST -x non_existing_file.inc + + # ---------------------------------------------------------------------------- # TODO Test queries, especially their errormessages... so it's easy to debug # new scripts and diagnose errors From 50c44c9b529aaa694faaacf4353e1815b6133941 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Sep 2005 20:00:11 +0500 Subject: [PATCH 12/27] mysqld.cc, mysql_priv.h, sql_parse.cc: bug#9948 changed client-charset behavior in 4.1.x libmysql, which issue BC prob after review fixes sql/mysql_priv.h: bug#9948 changed client-charset behavior in 4.1.x libmysql, which issue BC prob after review fixes sql/mysqld.cc: bug#9948 changed client-charset behavior in 4.1.x libmysql, which issue BC prob after review fixes --- sql/mysql_priv.h | 1 + sql/mysqld.cc | 12 ++++++------ sql/sql_parse.cc | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 0af3ea3af63..81224bdf54d 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -931,6 +931,7 @@ extern bool opt_using_transactions, mysqld_embedded; extern bool using_update_log, opt_large_files, server_id_supplied; extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log; extern bool opt_disable_networking, opt_skip_show_db; +extern bool opt_character_set_client_handshake; extern bool volatile abort_loop, shutdown_in_progress, grant_option; extern uint volatile thread_count, thread_running, global_read_lock; extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 59b733b594c..2d232986997 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -271,7 +271,7 @@ arg_cmp_func Arg_comparator::comparator_matrix[4][2] = bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; bool opt_error_log= IF_WIN(1,0); bool opt_disable_networking=0, opt_skip_show_db=0; -bool opt_skip_character_set_client_handshake= 0; +bool opt_character_set_client_handshake= 1; bool lower_case_table_names_used= 0; bool server_id_supplied = 0; bool opt_endinfo,using_udf_functions, locked_in_memory; @@ -4297,6 +4297,11 @@ Disable with --skip-bdb (will save memory).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE, + "Don't use client side character set value sent during handshake.", + (gptr*) &opt_character_set_client_handshake, + (gptr*) &opt_character_set_client_handshake, + 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"character-set-server", '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 }, @@ -4755,11 +4760,6 @@ Can't be set to 1 if --log-slave-updates is used.", "Show user and password in SHOW SLAVE HOSTS on this master", (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE, - "Don't use client side character set value sent during handshake.", - (gptr*) &opt_skip_character_set_client_handshake, - (gptr*) &opt_skip_character_set_client_handshake, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-grant-tables", OPT_SKIP_GRANT, "Start without grant tables. This gives all users FULL ACCESS to all tables!", (gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b8eae3aac74..a52e6daa698 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -811,12 +811,12 @@ static int check_connection(THD *thd) DBUG_PRINT("info", ("client_character_set: %d", (uint) net->read_pos[8])); /* Use server character set and collation if - - opt_skip_character_set_client_handshake is set + - opt_character_set_client_handshake is not set - client has not specified a character set - client character set is the same as the servers - client character set doesn't exists in server */ - if (opt_skip_character_set_client_handshake || + if (!opt_character_set_client_handshake || !(thd->variables.character_set_client= get_charset((uint) net->read_pos[8], MYF(0))) || !my_strcasecmp(&my_charset_latin1, From 8b1751e5c35bbde1af36a104f1cf7b3c2ab4e919 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Sep 2005 22:40:13 +0200 Subject: [PATCH 13/27] BUG#12984 mysqltest.test: different output from "exec NonExistsinfComamdn" mysql-test/r/mysqltest.result: Disable test for failing --exec and --system since output can't be piped to /dev/null on all platforms mysql-test/t/mysqltest.test: Disable test for failing --exec and --system since output can't be piped to /dev/null on all platforms Avoid "echo -e" by using a temporary .sql file for tests that require more than one line. --- mysql-test/r/mysqltest.result | 2 -- mysql-test/t/mysqltest.test | 30 ++++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 9175bdc7250..ae44233aab6 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -179,7 +179,6 @@ source database echo message echo message mysqltest: At line 1: Empty variable -mysqltest: At line 1: command "';' 2> /dev/null" failed mysqltest: At line 1: Missing argument in exec MySQL "MySQL" @@ -301,7 +300,6 @@ mysqltest: At line 1: First argument to dec must be a variable (start with $) mysqltest: At line 1: End of line junk detected: "1000" mysqltest: At line 1: Missing arguments to system, nothing to do! mysqltest: At line 1: Missing arguments to system, nothing to do! -mysqltest: At line 1: system command 'NonExistsinfComamdn 2> /dev/null' failed test test2 test3 diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 4c23f915503..04fed048674 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -358,8 +358,11 @@ select 3 from t1 ; # Missing delimiter # The comment will be "sucked into" the sleep command since # delimiter is missing until after "show status" +--system echo "sleep 4" > var/log/mysqltest.sql +--system echo "# A comment" >> var/log/mysqltest.sql +--system echo "show status;" >> var/log/mysqltest.sql --error 1 ---exec echo -e "sleep 4\n # A comment\nshow status;" | $MYSQL_TEST 2>&1 +--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1 # # Extra delimiter @@ -423,8 +426,9 @@ echo ; # ---------------------------------------------------------------------------- # Illegal use of exec ---error 1 ---exec echo "--exec ';' 2> /dev/null" | $MYSQL_TEST 2>&1 +# Disabled, some shells prints the failed command regardless of pipes +#--error 1 +#--exec echo "--exec ';' 2> /dev/null" | $MYSQL_TEST 2>&1 --error 1 --exec echo "--exec " | $MYSQL_TEST 2>&1 @@ -671,8 +675,9 @@ system echo "hej" > /dev/null; --exec echo "system;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1 ---error 1 ---exec echo "system NonExistsinfComamdn 2> /dev/null;" | $MYSQL_TEST 2>&1 +# Disabled, some shells prints the failed command regardless of pipes +#--error 1 +#--exec echo "system NonExistsinfComamdn 2> /dev/null;" | $MYSQL_TEST 2>&1 --disable_abort_on_error system NonExistsinfComamdn; @@ -722,12 +727,21 @@ while ($i) --exec echo "end;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "{;" | $MYSQL_TEST 2>&1 + +--system echo "while (0)" > var/log/mysqltest.sql +--system echo "echo hej;" >> var/log/mysqltest.sql --error 1 ---exec echo -e "while (0)\necho hej;" | $MYSQL_TEST 2>&1 +--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1 + +--system echo "while (0)" > var/log/mysqltest.sql +--system echo "{echo hej;" >> var/log/mysqltest.sql --error 1 ---exec echo -e "while (0)\n{echo hej;" | $MYSQL_TEST 2>&1 +--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1 + +--system echo "while (0){" > var/log/mysqltest.sql +--system echo "echo hej;" >> var/log/mysqltest.sql --error 1 ---exec echo -e "while (0){\n echo hej;" | $MYSQL_TEST 2>&1 +--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1 # ---------------------------------------------------------------------------- # Test error messages returned from comments starting with a command From 103458544bc3c07100dac2f22c3f857f7cff2618 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 09:36:32 +0200 Subject: [PATCH 14/27] comment out innochecksum until fixed --- extra/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/Makefile.am b/extra/Makefile.am index 457fddce673..9fac05d0160 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -38,7 +38,7 @@ $(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h $(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \ - resolve_stack_dump mysql_waitpid innochecksum + resolve_stack_dump mysql_waitpid # innochecksum noinst_PROGRAMS = charset2html # Don't update the files from bitkeeper From 3ae91695de838aad59a01f7766ee1aa43470ea6f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 09:40:42 +0200 Subject: [PATCH 15/27] BUG#12959 mysqltest crashes if testcase passed with -x option - Update test cases mysql-test/t/mysqltest.test: Uncomment the mysqltest -x test. Can't get the output to end up in the result file. --- mysql-test/t/mysqltest.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 04fed048674..39c1e867f28 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -812,11 +812,11 @@ select "a" as col1, "c" as col2; # ---------------------------------------------------------------------------- # -x , use the file specified after -x as the test file ---exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc ---exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc ---exec $MYSQL_TEST --result_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc ---error 1 ---exec $MYSQL_TEST -x non_existing_file.inc +#--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1 +#--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1 +#--exec $MYSQL_TEST --result_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1 +#--error 1 +#--exec $MYSQL_TEST -x non_existing_file.inc 2>&1 # ---------------------------------------------------------------------------- From f5f896b4b96f18927864a70cbf23b09d922842fa Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 11:16:53 +0300 Subject: [PATCH 16/27] support of concurent query cache resizing (BUG#12848) sql/mysql_priv.h: initialisation moved to mysqld.cc sql/mysqld.cc: initialisation moved to mysqld.cc sql/sql_cache.cc: support of concurent query cache resizing: - resizing made atomic - check stack size after each quard mutex lock sql/sql_cache.h: initialisation moved to mysqld.cc removed uneed parameter (now it is always under guard mutex protection or called from destruction) --- sql/mysql_priv.h | 2 + sql/mysqld.cc | 1 + sql/sql_cache.cc | 116 +++++++++++++++++++++++++++++++++-------------- sql/sql_cache.h | 5 +- 4 files changed, 87 insertions(+), 37 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 9b9edd905ad..21d7afbd6cb 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -318,6 +318,7 @@ inline THD *_current_thd(void) #define query_cache_store_query(A, B) query_cache.store_query(A, B) #define query_cache_destroy() query_cache.destroy() #define query_cache_result_size_limit(A) query_cache.result_size_limit(A) +#define query_cache_init() query_cache.init() #define query_cache_resize(A) query_cache.resize(A) #define query_cache_invalidate3(A, B, C) query_cache.invalidate(A, B, C) #define query_cache_invalidate1(A) query_cache.invalidate(A) @@ -329,6 +330,7 @@ inline THD *_current_thd(void) #define query_cache_store_query(A, B) #define query_cache_destroy() #define query_cache_result_size_limit(A) +#define query_cache_init() #define query_cache_resize(A) #define query_cache_invalidate3(A, B, C) #define query_cache_invalidate1(A) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 17157d0ebe2..5d6e270150e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2461,6 +2461,7 @@ You should consider changing lower_case_table_names to 1 or 2", unireg_abort(1); } query_cache_result_size_limit(query_cache_limit); + query_cache_init(); query_cache_resize(query_cache_size); randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2); reset_floating_point_exceptions(); diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 667b6e546d3..071dac0d3c5 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -563,13 +563,18 @@ void query_cache_insert(NET *net, const char *packet, ulong length) { DBUG_ENTER("query_cache_insert"); -#ifndef DBUG_OFF - // Check if we have called query_cache.wreck() (which disables the cache) - if (query_cache.query_cache_size == 0) - DBUG_VOID_RETURN; -#endif - STRUCT_LOCK(&query_cache.structure_guard_mutex); + /* + It is very unlikely that following condition is TRUE (it is possible + only if other thread is resizing cache), so we check it only after guard + mutex lock + */ + if (unlikely(query_cache.query_cache_size == 0)) + { + STRUCT_UNLOCK(&query_cache.structure_guard_mutex); + DBUG_VOID_RETURN; + } + Query_cache_block *query_block = ((Query_cache_block*) net->query_cache_query); if (query_block) @@ -612,14 +617,20 @@ void query_cache_abort(NET *net) { DBUG_ENTER("query_cache_abort"); -#ifndef DBUG_OFF - // Check if we have called query_cache.wreck() (which disables the cache) - if (query_cache.query_cache_size == 0) - DBUG_VOID_RETURN; -#endif if (net->query_cache_query != 0) // Quick check on unlocked structure { STRUCT_LOCK(&query_cache.structure_guard_mutex); + /* + It is very unlikely that following condition is TRUE (it is possible + only if other thread is resizing cache), so we check it only after guard + mutex lock + */ + if (unlikely(query_cache.query_cache_size == 0)) + { + STRUCT_UNLOCK(&query_cache.structure_guard_mutex); + DBUG_VOID_RETURN; + } + Query_cache_block *query_block = ((Query_cache_block*) net->query_cache_query); if (query_block) // Test if changed by other thread @@ -641,14 +652,20 @@ void query_cache_end_of_result(NET *net) { DBUG_ENTER("query_cache_end_of_result"); -#ifndef DBUG_OFF - // Check if we have called query_cache.wreck() (which disables the cache) - if (query_cache.query_cache_size == 0) DBUG_VOID_RETURN; -#endif - if (net->query_cache_query != 0) // Quick check on unlocked structure { STRUCT_LOCK(&query_cache.structure_guard_mutex); + /* + It is very unlikely that following condition is TRUE (it is possible + only if other thread is resizing cache), so we check it only after guard + mutex lock + */ + if (unlikely(query_cache.query_cache_size == 0)) + { + STRUCT_UNLOCK(&query_cache.structure_guard_mutex); + DBUG_VOID_RETURN; + } + Query_cache_block *query_block = ((Query_cache_block*) net->query_cache_query); if (query_block) @@ -728,9 +745,14 @@ ulong Query_cache::resize(ulong query_cache_size_arg) DBUG_ENTER("Query_cache::resize"); DBUG_PRINT("qcache", ("from %lu to %lu",query_cache_size, query_cache_size_arg)); - free_cache(0); + DBUG_ASSERT(initialized); + STRUCT_LOCK(&structure_guard_mutex); + if (query_cache_size > 0) + free_cache(); query_cache_size= query_cache_size_arg; - DBUG_RETURN(::query_cache_size= init_cache()); + ::query_cache_size= init_cache(); + STRUCT_UNLOCK(&structure_guard_mutex); + DBUG_RETURN(::query_cache_size); } @@ -1307,7 +1329,7 @@ void Query_cache::destroy() } else { - free_cache(1); + free_cache(); pthread_mutex_destroy(&structure_guard_mutex); initialized = 0; } @@ -1336,8 +1358,6 @@ ulong Query_cache::init_cache() int align; DBUG_ENTER("Query_cache::init_cache"); - if (!initialized) - init(); approx_additional_data_size = (sizeof(Query_cache) + sizeof(gptr)*(def_query_hash_size+ def_table_hash_size)); @@ -1395,14 +1415,9 @@ ulong Query_cache::init_cache() goto err; query_cache_size -= additional_data_size; - STRUCT_LOCK(&structure_guard_mutex); - - if (!(cache = (byte *) - my_malloc_lock(query_cache_size+additional_data_size, MYF(0)))) - { - STRUCT_UNLOCK(&structure_guard_mutex); + if (!(cache= (byte *) + my_malloc_lock(query_cache_size+additional_data_size, MYF(0)))) goto err; - } DBUG_PRINT("qcache", ("cache length %lu, min unit %lu, %u bins", query_cache_size, min_allocation_unit, mem_bin_num)); @@ -1482,7 +1497,6 @@ ulong Query_cache::init_cache() queries_in_cache = 0; queries_blocks = 0; - STRUCT_UNLOCK(&structure_guard_mutex); DBUG_RETURN(query_cache_size + additional_data_size + approx_additional_data_size); @@ -1498,6 +1512,7 @@ void Query_cache::make_disabled() { DBUG_ENTER("Query_cache::make_disabled"); query_cache_size= 0; + queries_blocks= 0; free_memory= 0; bins= 0; steps= 0; @@ -1509,14 +1524,11 @@ void Query_cache::make_disabled() } -void Query_cache::free_cache(my_bool destruction) +void Query_cache::free_cache() { DBUG_ENTER("Query_cache::free_cache"); if (query_cache_size > 0) { - if (!destruction) - STRUCT_LOCK(&structure_guard_mutex); - flush_cache(); #ifndef DBUG_OFF if (bins[0].free_blocks == 0) @@ -1538,8 +1550,6 @@ void Query_cache::free_cache(my_bool destruction) make_disabled(); hash_free(&queries); hash_free(&tables); - if (!destruction) - STRUCT_UNLOCK(&structure_guard_mutex); } DBUG_VOID_RETURN; } @@ -2149,7 +2159,19 @@ Query_cache::allocate_block(ulong len, my_bool not_less, ulong min, } if (!under_guard) + { STRUCT_LOCK(&structure_guard_mutex); + /* + It is very unlikely that following condition is TRUE (it is possible + only if other thread is resizing cache), so we check it only after + guard mutex lock + */ + if (unlikely(query_cache.query_cache_size == 0)) + { + STRUCT_UNLOCK(&structure_guard_mutex); + DBUG_RETURN(0); + } + } /* Free old queries until we have enough memory to store this block */ Query_cache_block *block; @@ -2606,6 +2628,17 @@ void Query_cache::pack_cache() { DBUG_ENTER("Query_cache::pack_cache"); STRUCT_LOCK(&structure_guard_mutex); + /* + It is very unlikely that following condition is TRUE (it is possible + only if other thread is resizing cache), so we check it only after + guard mutex lock + */ + if (unlikely(query_cache_size == 0)) + { + STRUCT_UNLOCK(&structure_guard_mutex); + DBUG_VOID_RETURN; + } + DBUG_EXECUTE("check_querycache",query_cache.check_integrity(1);); byte *border = 0; @@ -2915,6 +2948,7 @@ my_bool Query_cache::join_results(ulong join_limit) STRUCT_LOCK(&structure_guard_mutex); if (queries_blocks != 0) { + DBUG_ASSERT(query_cache_size > 0); Query_cache_block *block = queries_blocks; do { @@ -3209,7 +3243,19 @@ my_bool Query_cache::check_integrity(bool not_locked) DBUG_RETURN(0); } if (!not_locked) + { STRUCT_LOCK(&structure_guard_mutex); + /* + It is very unlikely that following condition is TRUE (it is possible + only if other thread is resizing cache), so we check it only after + guard mutex lock + */ + if (unlikely(query_cache_size == 0)) + { + STRUCT_UNLOCK(&query_cache.structure_guard_mutex); + DBUG_RETURN(0); + } + } if (hash_check(&queries)) { diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 454f0318c12..854937d0158 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -310,10 +310,9 @@ protected: Following function control structure_guard_mutex by themself or don't need structure_guard_mutex */ - void init(); ulong init_cache(); void make_disabled(); - void free_cache(my_bool destruction); + void free_cache(); Query_cache_block *write_block_data(ulong data_len, gptr data, ulong header_len, Query_cache_block::block_type type, @@ -346,6 +345,8 @@ protected: uint def_query_hash_size = QUERY_CACHE_DEF_QUERY_HASH_SIZE, uint def_table_hash_size = QUERY_CACHE_DEF_TABLE_HASH_SIZE); + /* initialize cache (mutex) */ + void init(); /* resize query cache (return real query size, 0 if disabled) */ ulong resize(ulong query_cache_size); inline void result_size_limit(ulong limit){query_cache_limit=limit;} From 94c98b516aab22f13f2c5fb4a86546edd201eeba Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 15:23:03 +0500 Subject: [PATCH 17/27] mysqld.cc: after merge fix sql/mysqld.cc: after merge fix --- sql/mysqld.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 919f7c3d2e2..76ee08d73a3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -339,7 +339,6 @@ bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; bool opt_error_log= IF_WIN(1,0); bool opt_disable_networking=0, opt_skip_show_db=0; bool opt_character_set_client_handshake= 1; -bool lower_case_table_names_used= 0; bool server_id_supplied = 0; bool opt_endinfo,using_udf_functions, locked_in_memory; bool opt_using_transactions, using_update_log; From 8bb920586e85685c242e5a4cbde533cd60cf792c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 12:33:36 +0200 Subject: [PATCH 18/27] Detect comment with command using extra delimiter mysql-test/include/have_lowercase0.inc: Remove extra ; at end of command(causing it to be skipped) mysql-test/r/mysqltest.result: Update test results mysql-test/t/mysqltest.test: Add test to detect "comment with command" with extra ; delimiter Fix extra ; delimiter --- client/mysqltest.c | 16 ++++++++++++++++ mysql-test/include/have_lowercase0.inc | 4 ++-- mysql-test/r/mysqltest.result | 1 + mysql-test/t/mysqltest.test | 4 +++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index da9d165e519..212f9b64ea1 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -3901,6 +3901,22 @@ void get_query_type(struct st_query* q) q->type != Q_DISABLE_PARSING) q->type= Q_COMMENT; } + else if (q->type == Q_COMMENT_WITH_COMMAND && + q->query[q->first_word_len-1] == ';') + { + /* + Detect comment with command using extra delimiter + Ex --disable_query_log; + ^ Extra delimiter causing the command + to be skipped + */ + save= q->query[q->first_word_len-1]; + q->query[q->first_word_len-1]= 0; + type= find_type(q->query, &command_typelib, 1+2); + q->query[q->first_word_len-1]= save; + if (type > 0) + die("Extra delimiter \";\" found"); + } DBUG_VOID_RETURN; } diff --git a/mysql-test/include/have_lowercase0.inc b/mysql-test/include/have_lowercase0.inc index f967c18928b..8d3ae02f61e 100644 --- a/mysql-test/include/have_lowercase0.inc +++ b/mysql-test/include/have_lowercase0.inc @@ -1,4 +1,4 @@ --require r/lowercase0.require ---disable_query_log; +--disable_query_log show variables like "lower_case_%"; ---enable_query_log; +--enable_query_log diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 4757d8b1a03..c643a5ae647 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -152,6 +152,7 @@ mysqltest: At line 1: End of line junk detected: "6" mysqltest: At line 1: End of line junk detected: "6" mysqltest: At line 1: Missing delimiter mysqltest: At line 1: Extra delimiter ";" found +mysqltest: At line 1: Extra delimiter ";" found MySQL "MySQL" MySQL: The world''s most popular open source database diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 2a90e2be8d1..c903749839d 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -369,6 +369,8 @@ select 3 from t1 ; # --error 1 --exec echo "--sleep 4;" | $MYSQL_TEST 2>&1 +--error 1 +--exec echo "--disable_query_log;" | $MYSQL_TEST 2>&1 # Allow trailing # comment @@ -592,7 +594,7 @@ while ($num) --source var/tmp/sourced1.sql dec $num; } ---enable_abort_on_error; +--enable_abort_on_error --enable_query_log # ---------------------------------------------------------------------------- From 61a5fac1cc0e2cddcc98db8396f06b719cfcad1a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 16:19:59 +0500 Subject: [PATCH 19/27] Bug #6172 RAND(a) should only accept constant values as arguments(2nd version) Argument of RAND function can be constant value only --- mysql-test/r/func_math.result | 5 ++++ mysql-test/r/ps.result | 48 +++++++++++++++++------------------ mysql-test/t/func_math.test | 9 +++++++ mysql-test/t/ps.test | 4 +-- sql/item_func.cc | 5 ++++ 5 files changed, 43 insertions(+), 28 deletions(-) diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 80b15d1d3c8..b36902d7872 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -140,3 +140,8 @@ drop table t1; select abs(-2) * -2; abs(-2) * -2 -4 +create table t1 (i int); +insert into t1 values (1); +select rand(i) from t1; +ERROR HY000: Incorrect arguments to RAND +drop table t1; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index c17015df757..f5bf3ffa96d 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -334,39 +334,37 @@ create table t1 (a int); insert into t1 (a) values (1), (2), (3), (4); set @precision=10000000000; select rand(), -cast(rand(10)*@precision as unsigned integer), -cast(rand(a)*@precision as unsigned integer) from t1; -rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) +cast(rand(10)*@precision as unsigned integer) from t1; +rand() cast(rand(10)*@precision as unsigned integer) +- 6570515219 +- 1282061302 +- 6698761160 +- 9647622201 +prepare stmt from +"select rand(), + cast(rand(10)*@precision as unsigned integer), + cast(rand(?)*@precision as unsigned integer) from t1"; +set @var=1; +execute stmt using @var; +rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) - 6570515219 - - 1282061302 - - 6698761160 - - 9647622201 - -prepare stmt from -"select rand(), - cast(rand(10)*@precision as unsigned integer), - cast(rand(a)*@precision as unsigned integer), - cast(rand(?)*@precision as unsigned integer) from t1"; -set @var=1; -execute stmt using @var; -rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) -- 6570515219 - 4054035371 -- 1282061302 - 8716141803 -- 6698761160 - 1418603212 -- 9647622201 - 944590960 set @var=2; execute stmt using @var; -rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) -- 6570515219 1559528654 6555866465 -- 1282061302 6238114970 1223466192 -- 6698761160 6511989195 6449731873 -- 9647622201 3845601374 8578261098 +rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) +- 6570515219 6555866465 +- 1282061302 1223466192 +- 6698761160 6449731873 +- 9647622201 8578261098 set @var=3; execute stmt using @var; -rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) -- 6570515219 1559528654 9057697559 -- 1282061302 6238114970 3730790581 -- 6698761160 6511989195 1480860534 -- 9647622201 3845601374 6211931236 +rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) +- 6570515219 9057697559 +- 1282061302 3730790581 +- 6698761160 1480860534 +- 9647622201 6211931236 drop table t1; deallocate prepare stmt; create database mysqltest1; diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index ebbc594952c..c75454a96d4 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -77,4 +77,13 @@ drop table t1; # select abs(-2) * -2; +# +# Bug #6172 RAND(a) should only accept constant values as arguments +# +create table t1 (i int); +insert into t1 values (1); +--error 1210 +select rand(i) from t1; +drop table t1; + # End of 4.1 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 5a2e469fbc4..c4cb0056763 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -368,12 +368,10 @@ insert into t1 (a) values (1), (2), (3), (4); set @precision=10000000000; --replace_column 1 - 3 - select rand(), - cast(rand(10)*@precision as unsigned integer), - cast(rand(a)*@precision as unsigned integer) from t1; + cast(rand(10)*@precision as unsigned integer) from t1; prepare stmt from "select rand(), cast(rand(10)*@precision as unsigned integer), - cast(rand(a)*@precision as unsigned integer), cast(rand(?)*@precision as unsigned integer) from t1"; set @var=1; --replace_column 1 - 3 - diff --git a/sql/item_func.cc b/sql/item_func.cc index 41573406949..ebb200ec4da 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1038,6 +1038,11 @@ bool Item_func_rand::fix_fields(THD *thd, struct st_table_list *tables, used_tables_cache|= RAND_TABLE_BIT; if (arg_count) { // Only use argument once in query + if (!args[0]->const_during_execution()) + { + my_error(ER_WRONG_ARGUMENTS, MYF(0), "RAND"); + return TRUE; + } /* Allocate rand structure once: we must use thd->current_arena to create rand in proper mem_root if it's a prepared statement or From 050d992bcdb7a16cd7d75577c0d3e9ad5ed5688c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 15:41:13 +0200 Subject: [PATCH 20/27] Bug #12984 mysqltest.test: different output from "exec NonExistsinfComamdn" - Common error handling regardless of --ps-protocol or not. client/mysqltest.c: Merge normal_handle_error and run_query_stmt_handle_error to get consistent functionality and error messages regardless if --ps-protocol is used or not Call handle_error when error occured to check for expected error codes/states Call handle_no_error when no error ahs occured to check if an error was expected --- client/mysqltest.c | 239 +++++++++++++++++---------------------------- 1 file changed, 87 insertions(+), 152 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 212f9b64ea1..a01322181e0 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -481,9 +481,10 @@ my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; } static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val, int len); static void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val); -static int normal_handle_error(const char *query, struct st_query *q, - MYSQL *mysql, DYNAMIC_STRING *ds); -static int normal_handle_no_error(struct st_query *q); +static int handle_error(const char *query, struct st_query *q, + unsigned int err_errno, const char *err_error, + const char *err_sqlstate, DYNAMIC_STRING *ds); +static int handle_no_error(struct st_query *q); static void do_eval(DYNAMIC_STRING* query_eval, const char *query) { @@ -2071,11 +2072,12 @@ int connect_n_handle_errors(struct st_query *q, MYSQL* con, const char* host, if (!mysql_real_connect(con, host, user, pass, db, port, sock ? sock: 0, CLIENT_MULTI_STATEMENTS)) { - error= normal_handle_error("connect", q, con, ds); + error= handle_error("connect", q, mysql_errno(con), mysql_error(con), + mysql_sqlstate(con), ds); *create_conn= 0; goto err; } - else if (normal_handle_no_error(q)) + else if (handle_no_error(q)) { /* Fail if there was no error but we expected it. @@ -2964,8 +2966,6 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res) static int run_query_normal(MYSQL *mysql, struct st_query *q, int flags); static int run_query_stmt (MYSQL *mysql, struct st_query *q, int flags); static void run_query_stmt_handle_warnings(MYSQL *mysql, DYNAMIC_STRING *ds); -static int run_query_stmt_handle_error(char *query, struct st_query *q, - MYSQL_STMT *stmt, DYNAMIC_STRING *ds); static void run_query_display_metadata(MYSQL_FIELD *field, uint num_fields, DYNAMIC_STRING *ds); @@ -3049,12 +3049,13 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags) (!(last_result= res= mysql_store_result(mysql)) && mysql_field_count(mysql))) { - if (normal_handle_error(query, q, mysql, ds)) + if (handle_error(query, q, mysql_errno(mysql), mysql_error(mysql), + mysql_sqlstate(mysql), ds)) error= 1; goto end; } - if (normal_handle_no_error(q)) + if (handle_no_error(q)) { error= 1; goto end; @@ -3169,14 +3170,15 @@ end: /* - Handle errors which occurred after execution of conventional (non-prepared) - statement. + Handle errors which occurred after execution SYNOPSIS - normal_handle_error() + handle_error() query - query string q - query context - mysql - connection through which query was sent to server + err_errno - error number + err_error - error message + err_sqlstate - sql state ds - dynamic string which is used for output buffer NOTE @@ -3188,85 +3190,83 @@ end: 1 - Some other error was expected. */ -static int normal_handle_error(const char *query, struct st_query *q, - MYSQL *mysql, DYNAMIC_STRING *ds) +static int handle_error(const char *query, struct st_query *q, + unsigned int err_errno, const char *err_error, + const char* err_sqlstate, DYNAMIC_STRING *ds) { uint i; - - DBUG_ENTER("normal_handle_error"); + + DBUG_ENTER("handle_error"); if (q->require_file) abort_not_supported_test(); - + if (q->abort_on_error) die("query '%s' failed: %d: %s", query, - mysql_errno(mysql), mysql_error(mysql)); - else + err_errno, err_error); + + for (i= 0 ; (uint) i < q->expected_errors ; i++) { - for (i= 0 ; (uint) i < q->expected_errors ; i++) + if (((q->expected_errno[i].type == ERR_ERRNO) && + (q->expected_errno[i].code.errnum == err_errno)) || + ((q->expected_errno[i].type == ERR_SQLSTATE) && + (strcmp(q->expected_errno[i].code.sqlstate, err_sqlstate) == 0))) { - if (((q->expected_errno[i].type == ERR_ERRNO) && - (q->expected_errno[i].code.errnum == mysql_errno(mysql))) || - ((q->expected_errno[i].type == ERR_SQLSTATE) && - (strcmp(q->expected_errno[i].code.sqlstate, mysql_sqlstate(mysql)) == 0))) + if (q->expected_errors == 1) { - if (q->expected_errors == 1) - { - /* Only log error if there is one possible error */ - dynstr_append_mem(ds, "ERROR ", 6); - replace_dynstr_append(ds, mysql_sqlstate(mysql)); - dynstr_append_mem(ds, ": ", 2); - replace_dynstr_append(ds, mysql_error(mysql)); - dynstr_append_mem(ds,"\n",1); - } - /* Don't log error if we may not get an error */ - else if (q->expected_errno[0].type == ERR_SQLSTATE || - (q->expected_errno[0].type == ERR_ERRNO && - q->expected_errno[0].code.errnum != 0)) - dynstr_append(ds,"Got one of the listed errors\n"); - /* OK */ - DBUG_RETURN(0); + /* Only log error if there is one possible error */ + dynstr_append_mem(ds, "ERROR ", 6); + replace_dynstr_append(ds, err_sqlstate); + dynstr_append_mem(ds, ": ", 2); + replace_dynstr_append(ds, err_error); + dynstr_append_mem(ds,"\n",1); } + /* Don't log error if we may not get an error */ + else if (q->expected_errno[0].type == ERR_SQLSTATE || + (q->expected_errno[0].type == ERR_ERRNO && + q->expected_errno[0].code.errnum != 0)) + dynstr_append(ds,"Got one of the listed errors\n"); + /* OK */ + DBUG_RETURN(0); } - - DBUG_PRINT("info",("i: %d expected_errors: %d", i, q->expected_errors)); - - dynstr_append_mem(ds, "ERROR ",6); - replace_dynstr_append(ds, mysql_sqlstate(mysql)); - dynstr_append_mem(ds, ": ", 2); - replace_dynstr_append(ds, mysql_error(mysql)); - dynstr_append_mem(ds, "\n", 1); - - if (i) - { - if (q->expected_errno[0].type == ERR_ERRNO) - verbose_msg("query '%s' failed with wrong errno %d instead of %d...", - q->query, mysql_errno(mysql), - q->expected_errno[0].code.errnum); - else - verbose_msg("query '%s' failed with wrong sqlstate %s instead of %s...", - q->query, mysql_sqlstate(mysql), - q->expected_errno[0].code.sqlstate); - DBUG_RETURN(1); - } - - /* - If we do not abort on error, failure to run the query does not fail the - whole test case. - */ - verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql), - mysql_error(mysql)); - DBUG_RETURN(0); } - return 0; /* Keep compiler happy */ + + DBUG_PRINT("info",("i: %d expected_errors: %d", i, q->expected_errors)); + + dynstr_append_mem(ds, "ERROR ",6); + replace_dynstr_append(ds, err_sqlstate); + dynstr_append_mem(ds, ": ", 2); + replace_dynstr_append(ds, err_error); + dynstr_append_mem(ds, "\n", 1); + + if (i) + { + if (q->expected_errno[0].type == ERR_ERRNO) + verbose_msg("query '%s' failed with wrong errno %d instead of %d...", + q->query, err_errno, + q->expected_errno[0].code.errnum); + else + verbose_msg("query '%s' failed with wrong sqlstate %s instead of %s...", + q->query, err_sqlstate, + q->expected_errno[0].code.sqlstate); + DBUG_RETURN(1); + } + + /* + If we do not abort on error, failure to run the query does not fail the + whole test case. + */ + verbose_msg("query '%s' failed: %d: %s", q->query, err_errno, + err_error); + DBUG_RETURN(0); } /* - Handle absence of errors after execution of convetional statement. + Handle absence of errors after execution SYNOPSIS - normal_handle_error() + handle_no_error() q - context of query RETURN VALUE @@ -3274,9 +3274,9 @@ static int normal_handle_error(const char *query, struct st_query *q, 1 - Some error was expected from this query. */ -static int normal_handle_no_error(struct st_query *q) +static int handle_no_error(struct st_query *q) { - DBUG_ENTER("normal_handle_no_error"); + DBUG_ENTER("handle_no_error"); if (q->expected_errno[0].type == ERR_ERRNO && q->expected_errno[0].code.errnum != 0) @@ -3370,17 +3370,17 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags) { if (q->abort_on_error) { - die("unable to prepare statement '%s': " - "%s (mysql_stmt_errno=%d returned=%d)", - query, - mysql_stmt_error(stmt), mysql_stmt_errno(stmt), err); + die("query '%s' failed: %d: %s", query, + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); } else { /* Preparing is part of normal execution and some errors may be expected */ - error= run_query_stmt_handle_error(query, q, stmt, ds); + error= handle_error(query, q, mysql_stmt_errno(stmt), + mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), + ds); goto end; } } @@ -3413,7 +3413,9 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags) else { /* We got an error, maybe expected */ - error= run_query_stmt_handle_error(query, q, stmt, ds); + error= handle_error(query, q, mysql_stmt_errno(stmt), + mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), + ds); goto end; } } @@ -3449,18 +3451,16 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags) else { /* We got an error, maybe expected */ - error= run_query_stmt_handle_error(query, q, stmt, ds); + error= handle_error(query, q, mysql_stmt_errno(stmt), + mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), + ds); goto end; } } /* If we got here the statement was both executed and read succeesfully */ - - if (q->expected_errno[0].type == ERR_ERRNO && - q->expected_errno[0].code.errnum != 0) + if (handle_no_error(q)) { - verbose_msg("query '%s' succeeded - should have failed with errno %d...", - q->query, q->expected_errno[0].code.errnum); error= 1; goto end; } @@ -3740,71 +3740,6 @@ static void run_query_stmt_handle_warnings(MYSQL *mysql, DYNAMIC_STRING *ds) } -static int run_query_stmt_handle_error(char *query, struct st_query *q, - MYSQL_STMT *stmt, DYNAMIC_STRING *ds) -{ - if (q->require_file) /* FIXME don't understand this one */ - { - abort_not_supported_test(); - } - - if (q->abort_on_error) - die("query '%s' failed: %d: %s", query, - mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); - else - { - int i; - - for (i=0 ; (uint) i < q->expected_errors ; i++) - { - if (((q->expected_errno[i].type == ERR_ERRNO) && - (q->expected_errno[i].code.errnum == mysql_stmt_errno(stmt))) || - ((q->expected_errno[i].type == ERR_SQLSTATE) && - (strcmp(q->expected_errno[i].code.sqlstate, - mysql_stmt_sqlstate(stmt)) == 0))) - { - if (i == 0 && q->expected_errors == 1) - { - /* Only log error if there is one possible error */ - dynstr_append_mem(ds,"ERROR ",6); - replace_dynstr_append(ds, mysql_stmt_sqlstate(stmt)); - dynstr_append_mem(ds, ": ", 2); - replace_dynstr_append(ds,mysql_stmt_error(stmt)); - dynstr_append_mem(ds,"\n",1); - } - /* Don't log error if we may not get an error */ - else if (q->expected_errno[0].type == ERR_SQLSTATE || - (q->expected_errno[0].type == ERR_ERRNO && - q->expected_errno[0].code.errnum != 0)) - dynstr_append(ds,"Got one of the listed errors\n"); - return 0; /* Ok */ - } - } - DBUG_PRINT("info",("i: %d expected_errors: %d", i, - q->expected_errors)); - dynstr_append_mem(ds, "ERROR ",6); - replace_dynstr_append(ds, mysql_stmt_sqlstate(stmt)); - dynstr_append_mem(ds,": ",2); - replace_dynstr_append(ds, mysql_stmt_error(stmt)); - dynstr_append_mem(ds,"\n",1); - if (i) - { - verbose_msg("query '%s' failed with wrong errno %d instead of %d...", - q->query, mysql_stmt_errno(stmt), q->expected_errno[0]); - return 1; /* Error */ - } - verbose_msg("query '%s' failed: %d: %s", q->query, mysql_stmt_errno(stmt), - mysql_stmt_error(stmt)); - /* - if we do not abort on error, failure to run the query does - not fail the whole test case - */ - return 0; - } - - return 0; -} - /****************************************************************************\ * Functions to match SQL statements that can be prepared \****************************************************************************/ From 2f886b93388bc2d1076adaaad03ca0720016cb69 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 18:57:21 +0200 Subject: [PATCH 21/27] Bug #12715 Compilation of yassl/algebra.ccp fails on buildqnx2 - Workaround extra/yassl/mySTL/helpers.hpp: Workaround for QNX extra/yassl/mySTL/list.hpp: Use workaround for placement new extra/yassl/taocrypt/src/misc.cpp: Don't include --- extra/yassl/mySTL/helpers.hpp | 8 +------- extra/yassl/mySTL/list.hpp | 4 ++-- extra/yassl/taocrypt/src/misc.cpp | 1 - 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/extra/yassl/mySTL/helpers.hpp b/extra/yassl/mySTL/helpers.hpp index 8d2061fc4f1..de825c23fec 100644 --- a/extra/yassl/mySTL/helpers.hpp +++ b/extra/yassl/mySTL/helpers.hpp @@ -28,14 +28,11 @@ #define mySTL_HELPERS_HPP #include -#include // placement new - - -#ifdef __IBMCPP__ /* Workaround for the lack of operator new(size_t, void*) in IBM VA C++ 6.0 + Also used as a workaround to avoid including */ struct Dummy {}; @@ -45,9 +42,6 @@ } typedef Dummy* yassl_pointer; -#else - typedef void* yassl_pointer; -#endif namespace mySTL { diff --git a/extra/yassl/mySTL/list.hpp b/extra/yassl/mySTL/list.hpp index 8aaeefaafe8..dd8485f48a7 100644 --- a/extra/yassl/mySTL/list.hpp +++ b/extra/yassl/mySTL/list.hpp @@ -164,7 +164,7 @@ void list::push_front(T t) { void* mem = malloc(sizeof(node)); if (!mem) abort(); - node* add = new (mem) node(t); + node* add = new (reinterpret_cast(mem)) node(t); if (head_) { add->next_ = head_; @@ -210,7 +210,7 @@ void list::push_back(T t) { void* mem = malloc(sizeof(node)); if (!mem) abort(); - node* add = new (mem) node(t); + node* add = new (reinterpret_cast(mem)) node(t); if (tail_) { tail_->next_ = add; diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp index ef051332098..0b33bb38aea 100644 --- a/extra/yassl/taocrypt/src/misc.cpp +++ b/extra/yassl/taocrypt/src/misc.cpp @@ -24,7 +24,6 @@ #include "runtime.hpp" #include "misc.hpp" -#include // for NewHandler void* operator new(size_t sz, TaoCrypt::new_t) From 87544d67ccb11f163db3ec2d729bc73d5d36c6a1 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 20:19:49 +0300 Subject: [PATCH 22/27] Added possibility to use string values 'true' and 'false' case insensitively with boolean options. Added a warning if given value is invalid and skips the option handling in that case. --- mysys/my_getopt.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 68bf65b2abe..e9e20fe4024 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -342,11 +342,23 @@ int handle_options(int *argc, char ***argv, --enable-'option-name'. *optend was set to '0' if one used --disable-option */ - my_bool tmp= (my_bool) (!optend || *optend == '1'); - *((my_bool*) value)= tmp; (*argc)--; + if (!optend || *optend == '1' || + !my_strcasecmp(&my_charset_latin1, optend, "true")) + *((my_bool*) value)= (my_bool) 1; + else if (*optend == '0' || + !my_strcasecmp(&my_charset_latin1, optend, "false")) + *((my_bool*) value)= (my_bool) 0; + else + { + my_getopt_error_reporter(WARNING_LEVEL, + "%s: ignoring option '--%s' due to \ +invalid value '%s'\n", + my_progname, optp->name, optend); + continue; + } get_one_option(optp->id, optp, - tmp ? (char*) "1" : disabled_my_option); + value ? (char*) "1" : disabled_my_option); continue; } argument= optend; From b89205880f6ce80ccba6e5c43be7af77828b2342 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 21:43:06 +0400 Subject: [PATCH 23/27] Fix for Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function" OPTIMIZE TABLE statement is forbidden from usage in stored procedures/functions. NOTE: OPTIMIZE TABLE statement can be useful in stored procedures. The idea is that the user/administrator can create a stored procedure for admin tasks (optimizing, backing up, etc). This procedure can be scheduled to run automatically (by mean of internal cron (WL#1034)). So, once we can make this statement work, it is worth doing it. mysql-test/r/sp-error.result: Results for the test case for Bug#12953 added. mysql-test/t/sp-error.test: Test case for Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function" added. sql/sql_yacc.yy: Forbid "OPTIMIZE TABLE" statement from use in stored procedures/functions. --- mysql-test/r/sp-error.result | 7 +++++++ mysql-test/t/sp-error.test | 17 +++++++++++++++-- sql/sql_yacc.yy | 5 +++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 61e931e146c..1a061529fb0 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -758,3 +758,10 @@ execute stmt; ERROR 42000: FUNCTION test.bug11834_1 does not exist deallocate prepare stmt; drop function bug11834_2; +DROP FUNCTION IF EXISTS bug12953| +CREATE FUNCTION bug12953() RETURNS INT +BEGIN +OPTIMIZE TABLE t1; +RETURN 1; +END| +ERROR 0A000: OPTIMIZE TABLE is not allowed in stored procedures diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index e289748ba2f..abb927ab3b8 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1085,6 +1085,21 @@ drop function bug11834_1; execute stmt; deallocate prepare stmt; drop function bug11834_2; + +# +# Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function" +# +delimiter |; +--disable_warnings +DROP FUNCTION IF EXISTS bug12953| +--enable_warnings +--error ER_SP_BADSTATEMENT +CREATE FUNCTION bug12953() RETURNS INT +BEGIN + OPTIMIZE TABLE t1; + RETURN 1; +END| + # # BUG#NNNN: New bug synopsis # @@ -1092,5 +1107,3 @@ drop function bug11834_2; #drop procedure if exists bugNNNN| #--enable_warnings #create procedure bugNNNN... - - diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c9b41cb495b..cc286e4ff45 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3826,6 +3826,11 @@ optimize: OPTIMIZE opt_no_write_to_binlog table_or_tables { LEX *lex=Lex; + if (lex->sphead) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), "OPTIMIZE TABLE"); + YYABORT; + } lex->sql_command = SQLCOM_OPTIMIZE; lex->no_write_to_binlog= $2; lex->check_opt.init(); From 981e5226bba0bb1201d0b35f25f7ce67f19d4772 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 21:18:44 +0300 Subject: [PATCH 24/27] postmerge fix --- sql/mysqld.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 09c2eb1a769..8db4b27169a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2705,6 +2705,7 @@ static int init_server_components() query_cache_result_size_limit(query_cache_limit); query_cache_set_min_res_unit(query_cache_min_res_unit); + query_cache_init(); query_cache_resize(query_cache_size); randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2); reset_floating_point_exceptions(); From a353608359405709b39f33fdc0fafbcca3c2147f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 22:03:12 +0200 Subject: [PATCH 25/27] Backport fixes for mysqltest.test from 5.0 client/mysqltest.c: Backport from 5.0 mysql-test/t/mysqltest.test: Remove the extra ; --- client/mysqltest.c | 77 ++++++++++++++++++++++++------------- mysql-test/t/mysqltest.test | 2 +- 2 files changed, 52 insertions(+), 27 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 24e05ab084b..3e2cde92aa9 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -456,6 +456,7 @@ my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; } #endif static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val, int len); +static int handle_no_error(struct st_query *q); static void do_eval(DYNAMIC_STRING* query_eval, const char *query) { @@ -2907,22 +2908,9 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags) } - if (q->expected_errno[0].type == ERR_ERRNO && - q->expected_errno[0].code.errnum != 0) + if (handle_no_error(q)) { - /* Error code we wanted was != 0, i.e. not an expected success */ - verbose_msg("query '%s' succeeded - should have failed with errno %d...", - q->query, q->expected_errno[0].code.errnum); - error = 1; - goto end; - } - else if (q->expected_errno[0].type == ERR_SQLSTATE && - strcmp(q->expected_errno[0].code.sqlstate,"00000") != 0) - { - /* SQLSTATE we wanted was != "00000", i.e. not an expected success */ - verbose_msg("query '%s' succeeded - should have failed with sqlstate %s...", - q->query, q->expected_errno[0].code.sqlstate); - error = 1; + error= 1; goto end; } @@ -3102,10 +3090,8 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags) { if (q->abort_on_error) { - die("unable to prepare statement '%s': " - "%s (mysql_stmt_errno=%d returned=%d)", - query, - mysql_stmt_error(stmt), mysql_stmt_errno(stmt), err); + die("query '%s' failed: %d: %s", query, + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); } else { @@ -3186,12 +3172,8 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags) } /* If we got here the statement was both executed and read succeesfully */ - - if (q->expected_errno[0].type == ERR_ERRNO && - q->expected_errno[0].code.errnum != 0) + if (handle_no_error(q)) { - verbose_msg("query '%s' succeeded - should have failed with errno %d...", - q->query, q->expected_errno[0].code.errnum); error= 1; goto end; } @@ -3518,8 +3500,14 @@ static int run_query_stmt_handle_error(char *query, struct st_query *q, dynstr_append_mem(ds,"\n",1); if (i) { - verbose_msg("query '%s' failed with wrong errno %d instead of %d...", - q->query, mysql_stmt_errno(stmt), q->expected_errno[0]); + if (q->expected_errno[0].type == ERR_ERRNO) + verbose_msg("query '%s' failed with wrong errno %d instead of %d...", + q->query, mysql_stmt_errno(stmt), + q->expected_errno[0].code.errnum); + else + verbose_msg("query '%s' failed with wrong sqlstate %s instead of %s...", + q->query, mysql_stmt_sqlstate(stmt), + q->expected_errno[0].code.sqlstate); return 1; /* Error */ } verbose_msg("query '%s' failed: %d: %s", q->query, mysql_stmt_errno(stmt), @@ -3534,6 +3522,43 @@ static int run_query_stmt_handle_error(char *query, struct st_query *q, return 0; } + +/* + Handle absence of errors after execution + + SYNOPSIS + handle_no_error() + q - context of query + + RETURN VALUE + 0 - OK + 1 - Some error was expected from this query. +*/ + +static int handle_no_error(struct st_query *q) +{ + DBUG_ENTER("handle_no_error"); + + if (q->expected_errno[0].type == ERR_ERRNO && + q->expected_errno[0].code.errnum != 0) + { + /* Error code we wanted was != 0, i.e. not an expected success */ + verbose_msg("query '%s' succeeded - should have failed with errno %d...", + q->query, q->expected_errno[0].code.errnum); + DBUG_RETURN(1); + } + else if (q->expected_errno[0].type == ERR_SQLSTATE && + strcmp(q->expected_errno[0].code.sqlstate,"00000") != 0) + { + /* SQLSTATE we wanted was != "00000", i.e. not an expected success */ + verbose_msg("query '%s' succeeded - should have failed with sqlstate %s...", + q->query, q->expected_errno[0].code.sqlstate); + DBUG_RETURN(1); + } + + DBUG_RETURN(0); +} + /****************************************************************************\ * Functions to match SQL statements that can be prepared \****************************************************************************/ diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 39c1e867f28..4d3bcc037d1 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -592,7 +592,7 @@ while ($num) --source var/tmp/sourced1.sql dec $num; } ---enable_abort_on_error; +--enable_abort_on_error --enable_query_log # ---------------------------------------------------------------------------- From b025657bcab0ed0529cc0fa6c43ea87025e894a6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Sep 2005 23:32:00 -0700 Subject: [PATCH 26/27] Fixed a typo in the configure --help menu. config/ac-macros/ha_federated.m4: Fixed typo --- config/ac-macros/ha_federated.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ac-macros/ha_federated.m4 b/config/ac-macros/ha_federated.m4 index 4383a9d8d55..5c991f31666 100644 --- a/config/ac-macros/ha_federated.m4 +++ b/config/ac-macros/ha_federated.m4 @@ -6,7 +6,7 @@ AC_DEFUN([MYSQL_CHECK_FEDERATED], [ AC_ARG_WITH([federated-storage-engine], [ --with-federated-storage-engine - Enable the MySQL Storage Engine], + Enable the MySQL Federated Storage Engine], [federateddb="$withval"], [federateddb=no]) AC_MSG_CHECKING([for MySQL federated storage engine]) From 3003e5a0eb66ce221968cf8ac6199800bba1eedd Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Sep 2005 11:50:41 +0400 Subject: [PATCH 27/27] Fix for BUG#12941: in create_tmp_field(), if the passed item is an Item_ref, put newly created item into item->result_field, not *(item->ref)->result_field. mysql-test/r/view.result: Tescase for BUG#12941 mysql-test/t/view.test: Tescase for BUG#12941 --- mysql-test/r/view.result | 26 ++++++++++++++++++++++++++ mysql-test/t/view.test | 33 +++++++++++++++++++++++++++++++++ sql/sql_select.cc | 30 ++++++++++++++++++++---------- 3 files changed, 79 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index a544fb4b020..e141393176c 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2151,3 +2151,29 @@ select * from v1; strcmp(f1,'a') drop view v1; drop table t1; +create table t1 ( +r_object_id char(16) NOT NULL, +group_name varchar(32) NOT NULL +) engine = InnoDB; +create table t2 ( +r_object_id char(16) NOT NULL, +i_position int(11) NOT NULL, +users_names varchar(32) default NULL +) Engine = InnoDB; +create view v1 as select r_object_id, group_name from t1; +create view v2 as select r_object_id, i_position, users_names from t2; +create unique index r_object_id on t1(r_object_id); +create index group_name on t1(group_name); +create unique index r_object_id_i_position on t2(r_object_id,i_position); +create index users_names on t2(users_names); +insert into t1 values('120001a080000542','tstgroup1'); +insert into t2 values('120001a080000542',-1, 'guser01'); +insert into t2 values('120001a080000542',-2, 'guser02'); +select v1.r_object_id, v2.users_names from v1, v2 +where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id +order by users_names; +r_object_id users_names +120001a080000542 guser01 +120001a080000542 guser02 +drop view v1, v2; +drop table t1, t2; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 97625632618..c5984f726f4 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2018,3 +2018,36 @@ create view v1 as select strcmp(f1,'a') from t1; select * from v1; drop view v1; drop table t1; + +# +# BUG#12941 +# +create table t1 ( + r_object_id char(16) NOT NULL, + group_name varchar(32) NOT NULL +) engine = InnoDB; + +create table t2 ( + r_object_id char(16) NOT NULL, + i_position int(11) NOT NULL, + users_names varchar(32) default NULL +) Engine = InnoDB; + +create view v1 as select r_object_id, group_name from t1; +create view v2 as select r_object_id, i_position, users_names from t2; + +create unique index r_object_id on t1(r_object_id); +create index group_name on t1(group_name); +create unique index r_object_id_i_position on t2(r_object_id,i_position); +create index users_names on t2(users_names); + +insert into t1 values('120001a080000542','tstgroup1'); +insert into t2 values('120001a080000542',-1, 'guser01'); +insert into t2 values('120001a080000542',-2, 'guser02'); + +select v1.r_object_id, v2.users_names from v1, v2 +where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id +order by users_names; + +drop view v1, v2; +drop table t1, t2; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0de06ea395a..e86af23d5fa 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8054,12 +8054,17 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, bool table_cant_handle_bit_fields, uint convert_blob_length) { + Item::Type orig_type; + Item *orig_item; + if (type != Item::FIELD_ITEM && item->real_item()->type() == Item::FIELD_ITEM && (item->type() != Item::REF_ITEM || !((Item_ref *) item)->depended_from)) { + orig_item= item; item= item->real_item(); + orig_type= type; type= Item::FIELD_ITEM; } switch (type) { @@ -8075,29 +8080,34 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case Item::DEFAULT_VALUE_ITEM: { Item_field *field= (Item_field*) item; + bool orig_modify= modify_item; + Field *result; + if (orig_type == Item::REF_ITEM) + modify_item= 0; /* If item have to be able to store NULLs but underlaid field can't do it, create_tmp_field_from_field() can't be used for tmp field creation. */ if (field->maybe_null && !field->field->maybe_null()) { - Field *res= create_tmp_field_from_item(thd, item, table, NULL, + result= create_tmp_field_from_item(thd, item, table, NULL, modify_item, convert_blob_length); *from_field= field->field; - if (res && modify_item) - ((Item_field*)item)->result_field= res; - return res; - } - - if (table_cant_handle_bit_fields && - field->field->type() == FIELD_TYPE_BIT) - return create_tmp_field_from_item(thd, item, table, copy_func, + if (result && modify_item) + ((Item_field*)item)->result_field= result; + } + else if (table_cant_handle_bit_fields && field->field->type() == FIELD_TYPE_BIT) + result= create_tmp_field_from_item(thd, item, table, copy_func, modify_item, convert_blob_length); - return create_tmp_field_from_field(thd, (*from_field= field->field), + else + result= create_tmp_field_from_field(thd, (*from_field= field->field), item->name, table, modify_item ? (Item_field*) item : NULL, convert_blob_length); + if (orig_type == Item::REF_ITEM && orig_modify) + ((Item_ref*)orig_item)->set_result_field(result); + return result; } /* Fall through */ case Item::FUNC_ITEM: