Fixed errors and compiler warnings found by buildbot

Solaris fixes:
- Fixed that wait_timeout_func and wait_timeout tests works on solaris
- We have to compile without NO_ALARM on Solaris as Solaris doesn't support timeouts on sockets with setsockopt(.. SO_RCVTIMEO).
- Fixed that compile-solaris-amd64-debug works (before that we got a wrong ELF class: ELFCLASS64 on linkage)
- Added missing sync_with_master
Other bug fixes:
- Free memory for rpl_global_gtid_binlog_state before exit() to avoid 'accessing uninitalized mutex' error.



BUILD/FINISH.sh:
  Fixed issues on Solaris with ksh
BUILD/compile-solaris-amd64-debug:
  Added missing -m64 flag
configure.cmake:
  We have to compile without NO_ALARM on Solaris as Solaris doesn't support timeouts on sockets with setsockopt(.. SO_RCVTIMEO)
mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test:
  - Added missing sync_with_master (fix by knielsen)
sql-common/client.c:
  Added () to get rid of compiler warning
sql/item_strfunc.cc:
  Fixed compiler warning
sql/log.cc:
  Free memory for static variable rpl_global_gtid_binlog_state before exit()
  - If we are compiling with safemalloc, we would try to call sf_free() for some members after sf_terminate() was called, which would result of trying to access the uninitalized mutex 'sf_mutex'
sql/multi_range_read.cc:
  Fixed compiler warnings of converting double to ulong.
sql/opt_range.cc:
  Fixed compiler warnings of converting double to ulong or uint
  - Better to have all variables that can be number of rows as 'ha_rows'
sql/rpl_gtid.cc:
  Added rpl_binlog_state::free() to be able to free memory for static objects before exit()
sql/rpl_gtid.h:
  Added rpl_binlog_state::free() to be able to free memory for static objects before exit()
sql/set_var.cc:
  Fixed compiler warning
sql/sql_join_cache.cc:
  Fixed compiler warnings of converting double to uint
sql/sql_show.cc:
  Added cast to get rid of compiler warning
sql/sql_statistics.cc:
  Remove code that didn't do anything.
  (store_record() with record[0] is a no-op)
storage/xtradb/os/os0file.c:
  Added  __attribute__ ((unused))
support-files/compiler_warnings.supp:
  Ignore warnings from atomic_add_64_nv
  (was not able to fix this with a cast as the macro is a bit different between systems)
vio/viosocket.c:
  Added more DBUG_PRINT
This commit is contained in:
Michael Widenius 2013-05-05 21:39:31 +03:00
parent 5aa0d185ca
commit 5333dafa84
18 changed files with 73 additions and 41 deletions

View File

@ -42,8 +42,7 @@ path=`dirname $0`
if [ -z "$just_clean" ]
then
commands="$commands
CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" \
$configure"
CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" $configure"
fi
if [ -z "$just_configure" -a -z "$just_clean" ]

View File

@ -20,7 +20,7 @@ path=`dirname $0`
extra_flags="$amd64_cflags -D__sun -m64 -mtune=athlon64 $debug_cflags"
extra_configs="$amd64_configs $debug_configs $max_configs --with-libevent"
LDFLAGS="-lmtmalloc -R/usr/sfw/lib/64"
LDFLAGS="-m64 -lmtmalloc -R/usr/sfw/lib/64"
export LDFLAGS
. "$path/FINISH.sh"

View File

@ -951,12 +951,15 @@ CHECK_CXX_SOURCE_COMPILES("
# they are silently ignored. For those OS's we will not attempt
# to use SO_SNDTIMEO and SO_RCVTIMEO even if it is said to work.
# See Bug#29093 for the problem with SO_SND/RCVTIMEO on HP/UX.
# Solaris11 has a similar problem
# To use alarm is simple, simply avoid setting anything.
IF(WIN32)
SET(HAVE_SOCKET_TIMEOUT 1)
ELSEIF(CMAKE_SYSTEM MATCHES "HP-UX")
SET(HAVE_SOCKET_TIMEOUT 0)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
SET(HAVE_SOCKET_TIMEOUT 0)
ELSEIF(CMAKE_CROSSCOMPILING)
SET(HAVE_SOCKET_TIMEOUT 0)
ELSE()

View File

@ -48,6 +48,7 @@ let $binlog_file=LAST;
source include/show_binlog_events.inc;
connection server_1;
--sync_with_master
source include/stop_slave.inc;
source include/wait_for_slave_to_stop.inc;
reset slave all;

View File

@ -3420,8 +3420,11 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
strmov(mysql->server_version,(char*) net->read_pos+1);
mysql->port=port;
/* remove the rpl hack from the version string, see RPL_VERSION_HACK comment */
if (mysql->server_capabilities & CLIENT_PLUGIN_AUTH &&
/*
remove the rpl hack from the version string, see RPL_VERSION_HACK
comment
*/
if ((mysql->server_capabilities & CLIENT_PLUGIN_AUTH) &&
strncmp(mysql->server_version, RPL_VERSION_HACK,
sizeof(RPL_VERSION_HACK) - 1) == 0)
mysql->server_version+= sizeof(RPL_VERSION_HACK) - 1;

View File

@ -3866,7 +3866,10 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref)
vals= (DYNAMIC_COLUMN_VALUE *) alloc_root(thd->mem_root,
sizeof(DYNAMIC_COLUMN_VALUE) *
(arg_count / 2));
for (i= 0; i + 1 < arg_count && args[i]->result_type() == INT_RESULT; i+= 2);
for (i= 0;
i + 1 < arg_count && args[i]->result_type() == INT_RESULT;
i+= 2)
;
if (i + 1 < arg_count)
{
names= TRUE;

View File

@ -119,7 +119,6 @@ static MYSQL_BIN_LOG::xid_count_per_binlog *
static bool start_binlog_background_thread();
static rpl_binlog_state rpl_global_gtid_binlog_state;
/**
@ -2994,6 +2993,13 @@ void MYSQL_BIN_LOG::cleanup()
mysql_cond_destroy(&COND_binlog_background_thread);
mysql_cond_destroy(&COND_binlog_background_thread_end);
}
/*
Free data for global binlog state.
We can't do that automaticly as we need to do this before
safemalloc is shut down
*/
rpl_global_gtid_binlog_state.free();
DBUG_VOID_RETURN;
}

View File

@ -1199,9 +1199,9 @@ bool DsMrr_impl::setup_buffer_sharing(uint key_size_in_keybuf,
statistics?
*/
uint parts= my_count_bits(key_tuple_map);
ulong rpc;
ha_rows rpc;
ulonglong rowids_size= rowid_buf_elem_size;
if ((rpc= key_info->actual_rec_per_key(parts - 1)))
if ((rpc= (ha_rows) key_info->actual_rec_per_key(parts - 1)))
rowids_size= rowid_buf_elem_size * rpc;
double fraction_for_rowids=

View File

@ -5919,8 +5919,8 @@ ha_rows records_in_index_intersect_extension(PARTIAL_INDEX_INTERSECT_INFO *curr,
ha_rows ext_records= ext_index_scan->records;
if (i < used_key_parts)
{
ulong f1= key_info->actual_rec_per_key(i-1);
ulong f2= key_info->actual_rec_per_key(i);
double f1= key_info->actual_rec_per_key(i-1);
double f2= key_info->actual_rec_per_key(i);
ext_records= (ha_rows) ((double) ext_records / f2 * f1);
}
if (ext_records < table_cardinality)
@ -13157,11 +13157,11 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
double *read_cost, ha_rows *records)
{
ha_rows table_records;
uint num_groups;
uint num_blocks;
ha_rows num_groups;
ha_rows num_blocks;
uint keys_per_block;
uint keys_per_group;
uint keys_per_subgroup; /* Average number of keys in sub-groups */
ha_rows keys_per_group;
ha_rows keys_per_subgroup; /* Average number of keys in sub-groups */
/* formed by a key infix. */
double p_overlap; /* Probability that a sub-group overlaps two blocks. */
double quick_prefix_selectivity;
@ -13170,24 +13170,24 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
DBUG_ENTER("cost_group_min_max");
table_records= table->stat_records();
keys_per_block= (table->file->stats.block_size / 2 /
keys_per_block= (uint) (table->file->stats.block_size / 2 /
(index_info->key_length + table->file->ref_length)
+ 1);
num_blocks= (uint)(table_records / keys_per_block) + 1;
num_blocks= (ha_rows)(table_records / keys_per_block) + 1;
/* Compute the number of keys in a group. */
keys_per_group= index_info->actual_rec_per_key(group_key_parts - 1);
keys_per_group= (ha_rows) index_info->actual_rec_per_key(group_key_parts - 1);
if (keys_per_group == 0) /* If there is no statistics try to guess */
/* each group contains 10% of all records */
keys_per_group= (uint)(table_records / 10) + 1;
num_groups= (uint)(table_records / keys_per_group) + 1;
keys_per_group= (table_records / 10) + 1;
num_groups= (table_records / keys_per_group) + 1;
/* Apply the selectivity of the quick select for group prefixes. */
if (range_tree && (quick_prefix_records != HA_POS_ERROR))
{
quick_prefix_selectivity= (double) quick_prefix_records /
(double) table_records;
num_groups= (uint) rint(num_groups * quick_prefix_selectivity);
num_groups= (ha_rows) rint(num_groups * quick_prefix_selectivity);
set_if_bigger(num_groups, 1);
}
@ -13196,7 +13196,7 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
Compute the probability that two ends of a subgroup are inside
different blocks.
*/
keys_per_subgroup= index_info->actual_rec_per_key(used_key_parts - 1);
keys_per_subgroup= (ha_rows) index_info->actual_rec_per_key(used_key_parts - 1);
if (keys_per_subgroup >= keys_per_block) /* If a subgroup is bigger than */
p_overlap= 1.0; /* a block, it will overlap at least two blocks. */
else
@ -13224,9 +13224,9 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
*records= num_groups;
DBUG_PRINT("info",
("table rows: %lu keys/block: %u keys/group: %u result rows: %lu blocks: %u",
(ulong)table_records, keys_per_block, keys_per_group,
(ulong) *records, num_blocks));
("table rows: %lu keys/block: %u keys/group: %lu result rows: %lu blocks: %lu",
(ulong)table_records, keys_per_block, (ulong) keys_per_group,
(ulong) *records, (ulong) num_blocks));
DBUG_VOID_RETURN;
}

View File

@ -686,6 +686,7 @@ rpl_binlog_state::rpl_binlog_state()
sizeof(uint32), NULL, my_free, HASH_UNIQUE);
mysql_mutex_init(key_LOCK_binlog_state, &LOCK_binlog_state,
MY_MUTEX_INIT_SLOW);
initialized= 1;
}
@ -699,11 +700,20 @@ rpl_binlog_state::reset()
my_hash_reset(&hash);
}
rpl_binlog_state::~rpl_binlog_state()
void rpl_binlog_state::free()
{
if (initialized)
{
initialized= 0;
reset();
my_hash_free(&hash);
mysql_mutex_destroy(&LOCK_binlog_state);
}
}
rpl_binlog_state::~rpl_binlog_state()
{
free();
}

View File

@ -135,11 +135,13 @@ struct rpl_binlog_state
HASH hash;
/* Mutex protecting access to the state. */
mysql_mutex_t LOCK_binlog_state;
my_bool initialized;
rpl_binlog_state();
~rpl_binlog_state();
void reset();
void free();
int update(const struct rpl_gtid *gtid);
uint64 seq_no_from_state();
int write_to_iocache(IO_CACHE *dest);

View File

@ -315,7 +315,7 @@ longlong sys_var::val_int(bool *is_null,
{
case_get_string_as_lex_string;
case_for_integers(return val);
case_for_double(return val);
case_for_double(return (longlong) val);
default:
my_error(ER_VAR_CANT_BE_READ, MYF(0), name.str);
return 0;

View File

@ -3812,8 +3812,8 @@ uint JOIN_TAB_SCAN_MRR::aux_buffer_incr(ulong recno)
uint incr= 0;
TABLE_REF *ref= &join_tab->ref;
TABLE *tab= join_tab->table;
uint rec_per_key=
tab->key_info[ref->key].actual_rec_per_key(ref->key_parts-1);
ha_rows rec_per_key=
(ha_rows) tab->key_info[ref->key].actual_rec_per_key(ref->key_parts-1);
set_if_bigger(rec_per_key, 1);
if (recno == 1)
incr= ref->key_length + tab->file->ref_length;

View File

@ -5977,7 +5977,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
KEY *key=show_table->key_info+i;
if (key->rec_per_key[j])
{
ha_rows records=((double) show_table->stat_records() /
ha_rows records= (ha_rows) ((double) show_table->stat_records() /
key->actual_rec_per_key(j));
table->field[9]->store((longlong) records, TRUE);
table->field[9]->set_notnull();

View File

@ -337,7 +337,7 @@ protected:
void store_record_for_lookup()
{
store_record(stat_table, record[0]);
DBUG_ASSERT(record[0] == stat_table->record[0]);
}
bool update_record()

View File

@ -1475,7 +1475,8 @@ static int os_file_set_atomic_writes(os_file_t file, const char *name)
return ret;
}
#else
static int os_file_set_atomic_writes(os_file_t file, const char *name)
static int os_file_set_atomic_writes(os_file_t file __attribute__ ((unused)),
const char *name)
{
fprintf(stderr,
"InnoDB : can't use atomic writes on %s - not implemented on this platform."

View File

@ -48,7 +48,8 @@ btr/btr0cur\.c: .*value computed is not used.*: 3175-3375
btr/btr0sea\.c: passing argument 2 .* discards qualifiers from pointer target type
ibuf/ibuf0ibuf.c: null argument where non-null required: 700-1000
fsp0fsp\.c: result of 32-bit shift implicitly converted to 64 bits
log/log0log\.c : passing arg 1 of `atomic_add_64_nv' from incompatible pointer type
log/log0online.c : passing arg 1 of `atomic_add_64_nv' from incompatible pointer type
#
# bdb is not critical to keep up to date
#

View File

@ -322,7 +322,9 @@ int vio_fastsend(Vio * vio __attribute__((unused)))
}
if (r)
{
DBUG_PRINT("warning", ("Couldn't set socket option for fast send"));
DBUG_PRINT("warning",
("Couldn't set socket option for fast send, error %d",
socket_errno));
r= -1;
}
DBUG_PRINT("exit", ("%d", r));
@ -819,7 +821,7 @@ void vio_timeout(Vio *vio, uint which, uint timeout)
#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
int r;
DBUG_ENTER("vio_timeout");
DBUG_PRINT("enter", ("which: %u timeout: %u", which, timeout));
{
#ifdef __WIN__
/* Windows expects time in milliseconds as int */
@ -846,6 +848,7 @@ void vio_timeout(Vio *vio, uint which, uint timeout)
Platforms not suporting setting of socket timeout should either use
thr_alarm or just run without read/write timeout(s)
*/
DBUG_PRINT("warning", ("timeout ignored"));
#endif
/* Make timeout values available for async operations. */
if (which)