* 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
This commit is contained in:
Sergei Golubchik 2013-01-23 16:19:37 +01:00
parent e3f08e7e0b
commit 5205188200
15 changed files with 16 additions and 33 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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 */
}

View File

@ -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)

View File

@ -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",

View File

@ -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

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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));

View File

@ -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

View File

@ -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

View File

@ -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