diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-01-23 16:19:37 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-01-23 16:19:37 +0100 |
commit | 52051882002c1b88a427d50fb343a9ed3614ffe0 (patch) | |
tree | 6da97d315d36c2a8a557a3227612c3aaf9aabee1 | |
parent | e3f08e7e0bbc56cd401bb1031827571498c15904 (diff) | |
download | mariadb-git-52051882002c1b88a427d50fb343a9ed3614ffe0.tar.gz |
cleanup:
* remove unused mysql_option
* don't allocate 5GB of memory in the mtr tests
* restore the behavior in dynamic_column_offset_byte(), put the ifdef correctly
* prefer __attribute__((unused)) to #ifdef
* prefer UNINIT_VAR to LINT_INIT
* make most Warning_info users blissfully unaware of the postponed initialization
* use my_offsetof instead of offsetof where the compiler thinks the latter is incorrect
-rw-r--r-- | include/mysql.h | 4 | ||||
-rw-r--r-- | include/mysql.h.pp | 4 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test | 2 | ||||
-rw-r--r-- | mysys/ma_dyncol.c | 4 | ||||
-rw-r--r-- | sql-common/client.c | 7 | ||||
-rw-r--r-- | sql/slave.cc | 4 | ||||
-rw-r--r-- | sql/sp_head.cc | 2 | ||||
-rw-r--r-- | sql/sql_admin.cc | 2 | ||||
-rw-r--r-- | sql/sql_error.h | 2 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/sys_vars.cc | 4 | ||||
-rw-r--r-- | sql/table.cc | 4 | ||||
-rw-r--r-- | storage/federated/ha_federated.cc | 5 | ||||
-rw-r--r-- | support-files/compiler_warnings.supp | 1 |
15 files changed, 16 insertions, 33 deletions
diff --git a/include/mysql.h b/include/mysql.h index 1268280395e..fa62026b44a 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -167,7 +167,7 @@ enum mysql_option MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH, - MYSQL_PROGRESS_CALLBACK, MYSQL_THREAD_SPECIFIC_MALLOC, + MYSQL_PROGRESS_CALLBACK, /* MariaDB options */ MYSQL_OPT_NONBLOCK=6000 }; @@ -194,7 +194,7 @@ struct st_mysql_options { unsigned long max_allowed_packet; my_bool use_ssl; /* if to use SSL or not */ my_bool compress,named_pipe; - my_bool thread_specific_malloc; + my_bool unused1; my_bool unused2; my_bool unused3; my_bool unused4; diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 84510a69edb..331183180c0 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -262,7 +262,7 @@ enum mysql_option MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH, - MYSQL_PROGRESS_CALLBACK, MYSQL_THREAD_SPECIFIC_MALLOC, + MYSQL_PROGRESS_CALLBACK, MYSQL_OPT_NONBLOCK=6000 }; struct st_mysql_options_extention; @@ -282,7 +282,7 @@ struct st_mysql_options { unsigned long max_allowed_packet; my_bool use_ssl; my_bool compress,named_pipe; - my_bool thread_specific_malloc; + my_bool unused1; my_bool unused2; my_bool unused3; my_bool unused4; diff --git a/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test index b55388d7c4f..58098f4c879 100644 --- a/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test +++ b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test @@ -6,7 +6,7 @@ # The test would allocate and initialize 5GB of memory # if compiled with debug. It can take a lot of time # of for paging/swapping. -#--source include/not_debug.inc +--source include/not_debug.inc # # Bug#27322 failure to allocate transaction_prealloc_size causes crash diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index ec94c17dfdb..8a224f1c5e8 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -342,10 +342,8 @@ static my_bool type_and_offset_store_num(uchar *place, size_t offset_size, int3store(place, val); break; case 4: -#if SIZEOF_SIZE_T > 4 if (offset >= 0x1fffffff) /* all 1 value is reserved */ return TRUE; -#endif int4store(place, val); break; default: @@ -488,8 +486,8 @@ static size_t dynamic_column_offset_bytes_named(size_t data_length) return 4; #if SIZEOF_SIZE_T > 4 if (data_length < 0xfffffffffull) /* all 1 value is reserved */ - return 5; #endif + return 5; return MAX_OFFSET_LENGTH_NM + 1; /* For an error generation */ } diff --git a/sql-common/client.c b/sql-common/client.c index 0423b44e26f..e4c4c2ad4a1 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -3292,9 +3292,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, if (mysql->options.extension && mysql->options.extension->async_context) net->vio->async_context= mysql->options.extension->async_context; - if (my_net_init(net, net->vio, - MYF(mysql->options.thread_specific_malloc ? - MY_THREAD_SPECIFIC : 0))) + if (my_net_init(net, net->vio, MYF(0))) { vio_delete(net->vio); net->vio = 0; @@ -4222,9 +4220,6 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) mysql->options.extension->report_progress= (void (*)(const MYSQL *, uint, uint, double, const char *, uint)) arg; break; - case MYSQL_THREAD_SPECIFIC_MALLOC: - mysql->options.thread_specific_malloc= *(uint*) arg; - break; case MYSQL_OPT_NONBLOCK: if (mysql->options.extension && (ctxt = mysql->options.extension->async_context) != 0) diff --git a/sql/slave.cc b/sql/slave.cc index 9e552e64a9e..da10169d97b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2425,9 +2425,7 @@ static int init_slave_thread(THD* thd, Master_info *mi, SLAVE_THD_TYPE thd_type) { DBUG_ENTER("init_slave_thread"); -#if !defined(DBUG_OFF) - int simulate_error= 0; -#endif + int simulate_error __attribute__((unused))= 0; DBUG_EXECUTE_IF("simulate_io_slave_error_on_init", simulate_error|= (1 << SLAVE_THD_IO);); DBUG_EXECUTE_IF("simulate_sql_slave_error_on_init", diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 57e7877cc34..0dec9b5f145 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1224,7 +1224,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer; Object_creation_ctx *saved_creation_ctx; Warning_info *saved_warning_info; - Warning_info warning_info(thd->warning_info->warn_id(), false, true); + Warning_info warning_info(thd->warning_info->warn_id(), false); /* Just reporting a stack overrun error diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index ba1ea01efcc..e6bbef482a7 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -398,7 +398,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, because it's already known that the table is badly damaged. */ - Warning_info wi(thd->query_id, false, true); + Warning_info wi(thd->query_id, false); Warning_info *wi_saved= thd->warning_info; thd->warning_info= &wi; diff --git a/sql/sql_error.h b/sql/sql_error.h index 17ec3aa7b56..f018387eb3b 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -363,7 +363,7 @@ private: public: Warning_info(ulonglong warn_id_arg, bool allow_unlimited_warnings, - bool initialize); + bool initialize=true); ~Warning_info(); /* Allocate memory for structures */ diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index e2398536783..71b4a0cf817 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2963,7 +2963,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length) param= stmt->param_array[param_number]; Diagnostics_area new_stmt_da, *save_stmt_da= thd->stmt_da; - Warning_info new_warnning_info(thd->query_id, false, true); + Warning_info new_warnning_info(thd->query_id, false); Warning_info *save_warinig_info= thd->warning_info; thd->stmt_da= &new_stmt_da; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 5a414ad7b48..33e31913e41 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -7905,7 +7905,7 @@ static bool do_fill_table(THD *thd, // Warning_info, so "useful warnings" get rejected. In order to avoid // that problem we create a Warning_info instance, which is capable of // storing "unlimited" number of warnings. - Warning_info wi(thd->query_id, true, true); + Warning_info wi(thd->query_id, true); Warning_info *wi_saved= thd->warning_info; thd->warning_info= &wi; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index d55daa2cb28..d0b39f2b9b0 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3422,7 +3422,7 @@ Sys_slave_skip_counter("sql_slave_skip_counter", "Skip the next N events from the master log", SESSION_VAR(slave_skip_counter), NO_CMD_LINE, - offsetof(Master_info, rli.slave_skip_counter), + my_offsetof(Master_info, rli.slave_skip_counter), VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1), ON_UPDATE(update_slave_skip_counter)); @@ -3441,7 +3441,7 @@ Sys_max_relay_log_size( "max_relay_log_size", "set to max_binlog_size", SESSION_VAR(max_relay_log_size), CMD_LINE(REQUIRED_ARG), - offsetof(Master_info, rli.max_relay_log_size), + my_offsetof(Master_info, rli.max_relay_log_size), VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0), BLOCK_SIZE(IO_SIZE), ON_UPDATE(update_max_relay_log_size)); diff --git a/sql/table.cc b/sql/table.cc index 3755f0d25ff..117345ad25d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2341,13 +2341,11 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, uint records, i, bitmap_size; bool error_reported= FALSE; uchar *record, *bitmaps; - Field **field_ptr, **vfield_ptr, **dfield_ptr; + Field **field_ptr, **UNINIT_VAR(vfield_ptr), **UNINIT_VAR(dfield_ptr); uint8 save_context_analysis_only= thd->lex->context_analysis_only; DBUG_ENTER("open_table_from_share"); DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str, share->table_name.str, (long) outparam)); - LINT_INIT(dfield_ptr); - LINT_INIT(vfield_ptr); thd->lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_VIEW; // not a view diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 262e0c8de7c..6cfd95b97b6 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -3137,7 +3137,6 @@ int ha_federated::real_connect() { char buffer[FEDERATED_QUERY_BUFFER_SIZE]; String sql_query(buffer, sizeof(buffer), &my_charset_bin); - int int_arg; DBUG_ENTER("ha_federated::real_connect"); /* @@ -3156,10 +3155,6 @@ int ha_federated::real_connect() DBUG_RETURN(-1); } - /* Ensure that memory is registered for the system, not for the THD */ - int_arg= 0; - mysql_options(mysql,MYSQL_THREAD_SPECIFIC_MALLOC, &int_arg); - /* BUG# 17044 Federated Storage Engine is not UTF8 clean Add set names to whatever charset the table is at open diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index 008ad0870c0..84651bdfac5 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -195,7 +195,6 @@ ma_packrec\.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 550 .* : .*no matching operator delete found; memory will not be freed if initialization throws an exception.* ctype-simple\.c : .*unary minus operator applied to unsigned type, result still unsigned.* sql/sys_vars\.cc : invalid access to non-static data member -sql/sys_vars\.cc : perhaps the .*offsetof.* macro was used incorrectly string3\.h : memset used with constant zero length parameter |