mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 02:30:06 +01:00
Fixed errors descovered by valgrind 2.4
Added suppression file for some valgrind warnings that are not real errors mysql-test/mysql-test-run.sh: Added suppression of some valgrind warnings that are not real errors mysql-test/r/heap.result: Cleanup old tests and added new tests mysql-test/t/heap.test: Cleanup old tests and added new tests mysys/default.c: Removed duplicate fn_format() scripts/make_binary_distribution.sh: Added valgrind suppress file sql/ha_federated.cc: Ensure that 'socket' is initialized properly sql/ha_heap.cc: Ensure that with_auto_increment is initialized properly sql/mysqld.cc: Ensure that create_time is initialized for cached threads sql/sql_parse.cc: Indentation fix strings/decimal.c: Fixed wrong tests
This commit is contained in:
parent
f3aa7770b6
commit
080c8ab39b
11 changed files with 121 additions and 43 deletions
|
@ -418,7 +418,7 @@ while test $# -gt 0; do
|
||||||
fi
|
fi
|
||||||
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
|
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
|
||||||
valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
|
valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
|
||||||
VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16"
|
VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$CWD/valgrind.supp"
|
||||||
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
||||||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
||||||
SLEEP_TIME_AFTER_RESTART=10
|
SLEEP_TIME_AFTER_RESTART=10
|
||||||
|
|
|
@ -667,14 +667,7 @@ drop table t1;
|
||||||
set storage_engine=MyISAM;
|
set storage_engine=MyISAM;
|
||||||
create table t1 (a bigint unsigned auto_increment primary key, b int,
|
create table t1 (a bigint unsigned auto_increment primary key, b int,
|
||||||
key (b, a)) engine=heap;
|
key (b, a)) engine=heap;
|
||||||
insert t1 (b) values (1);
|
insert t1 (b) values (1),(1),(1),(1),(1),(1),(1),(1);
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a b
|
a b
|
||||||
1 1
|
1 1
|
||||||
|
@ -688,14 +681,7 @@ a b
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a int not null, b int not null auto_increment,
|
create table t1 (a int not null, b int not null auto_increment,
|
||||||
primary key(a, b), key(b)) engine=heap;
|
primary key(a, b), key(b)) engine=heap;
|
||||||
insert t1 (a) values (1);
|
insert t1 (a) values (1),(1),(1),(1),(1),(1),(1),(1);
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a b
|
a b
|
||||||
1 1
|
1 1
|
||||||
|
@ -707,3 +693,6 @@ a b
|
||||||
1 7
|
1 7
|
||||||
1 8
|
1 8
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a int not null, b int not null auto_increment,
|
||||||
|
primary key(a, b)) engine=heap;
|
||||||
|
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||||
|
|
|
@ -413,25 +413,16 @@ eval set storage_engine=$default;
|
||||||
|
|
||||||
create table t1 (a bigint unsigned auto_increment primary key, b int,
|
create table t1 (a bigint unsigned auto_increment primary key, b int,
|
||||||
key (b, a)) engine=heap;
|
key (b, a)) engine=heap;
|
||||||
insert t1 (b) values (1);
|
insert t1 (b) values (1),(1),(1),(1),(1),(1),(1),(1);
|
||||||
insert t1 (b) values (1);
|
select * from t1;
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
insert t1 (b) values (1);
|
|
||||||
select * from t1;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
create table t1 (a int not null, b int not null auto_increment,
|
create table t1 (a int not null, b int not null auto_increment,
|
||||||
primary key(a, b), key(b)) engine=heap;
|
primary key(a, b), key(b)) engine=heap;
|
||||||
insert t1 (a) values (1);
|
insert t1 (a) values (1),(1),(1),(1),(1),(1),(1),(1);
|
||||||
insert t1 (a) values (1);
|
select * from t1;
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
insert t1 (a) values (1);
|
|
||||||
select * from t1;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--error 1075
|
||||||
|
create table t1 (a int not null, b int not null auto_increment,
|
||||||
|
primary key(a, b)) engine=heap;
|
||||||
|
|
94
mysql-test/valgrind.supp
Normal file
94
mysql-test/valgrind.supp
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
#
|
||||||
|
# Suppress some common (not fatal) errors in system libraries found by valgrind
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pthread doesn't free all thread specific memory before program exists
|
||||||
|
#
|
||||||
|
{
|
||||||
|
pthread allocate_tls memory loss
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:calloc
|
||||||
|
fun:_dl_allocate_tls
|
||||||
|
fun:allocate_stack
|
||||||
|
fun:pthread_create@@GLIBC_2.1
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
pthread allocate_dtv memory loss
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:calloc
|
||||||
|
fun:allocate_dtv
|
||||||
|
fun:_dl_allocate_tls_storage
|
||||||
|
fun:__GI__dl_allocate_tls
|
||||||
|
fun:pthread_create
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
pthread memalign memory loss
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:memalign
|
||||||
|
fun:_dl_allocate_tls_storage
|
||||||
|
fun:__GI__dl_allocate_tls
|
||||||
|
fun:pthread_create
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
pthread errno
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:calloc
|
||||||
|
fun:_dlerror_run
|
||||||
|
fun:dlsym
|
||||||
|
fun:__errno_location
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Warnings in libz becasue it works with aligned memory(?)
|
||||||
|
#
|
||||||
|
|
||||||
|
{
|
||||||
|
libz tr_flush_block
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:_tr_flush_block
|
||||||
|
fun:deflate_slow
|
||||||
|
fun:deflate
|
||||||
|
fun:do_flush
|
||||||
|
fun:gzclose
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
libz tr_flush_block2
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:_tr_flush_block
|
||||||
|
fun:deflate_slow
|
||||||
|
fun:deflate
|
||||||
|
fun:compress2
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
libz longest_match
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:longest_match
|
||||||
|
fun:deflate_slow
|
||||||
|
fun:deflate
|
||||||
|
fun:do_flush
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
libz longest_match2
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:longest_match
|
||||||
|
fun:deflate_slow
|
||||||
|
fun:deflate
|
||||||
|
fun:compress2
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
libz deflate
|
||||||
|
Memcheck:Cond
|
||||||
|
obj:/usr/lib/libz.so.*
|
||||||
|
obj:/usr/lib/libz.so.*
|
||||||
|
fun:deflate
|
||||||
|
fun:compress2
|
||||||
|
}
|
|
@ -477,13 +477,13 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
|
||||||
if ((stat_info.st_mode & S_IWOTH) &&
|
if ((stat_info.st_mode & S_IWOTH) &&
|
||||||
(stat_info.st_mode & S_IFMT) == S_IFREG)
|
(stat_info.st_mode & S_IFMT) == S_IFREG)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "warning: World-writable config file %s is ignored\n",
|
fprintf(stderr, "Warning: World-writable config file '%s' is ignored\n",
|
||||||
name);
|
name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!(fp= my_fopen(fn_format(name, name, "", "", 4), O_RDONLY, MYF(0))))
|
if (!(fp= my_fopen(name, O_RDONLY, MYF(0))))
|
||||||
return 0; /* Ignore wrong files */
|
return 0; /* Ignore wrong files */
|
||||||
|
|
||||||
while (fgets(buff, sizeof(buff) - 1, fp))
|
while (fgets(buff, sizeof(buff) - 1, fp))
|
||||||
|
|
|
@ -207,6 +207,7 @@ rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD
|
||||||
|
|
||||||
for i in mysql-test/mysql-test-run mysql-test/install_test_db \
|
for i in mysql-test/mysql-test-run mysql-test/install_test_db \
|
||||||
mysql-test/mysql-test-run.pl mysql-test/README \
|
mysql-test/mysql-test-run.pl mysql-test/README \
|
||||||
|
mysql-test/valgrind.supp \
|
||||||
netware/mysql_test_run.nlm netware/install_test_db.ncf
|
netware/mysql_test_run.nlm netware/install_test_db.ncf
|
||||||
do
|
do
|
||||||
if [ -f $i ]
|
if [ -f $i ]
|
||||||
|
|
|
@ -548,12 +548,12 @@ error:
|
||||||
static int parse_url(FEDERATED_SHARE *share, TABLE *table,
|
static int parse_url(FEDERATED_SHARE *share, TABLE *table,
|
||||||
uint table_create_flag)
|
uint table_create_flag)
|
||||||
{
|
{
|
||||||
|
uint error_num= (table_create_flag ? ER_CANT_CREATE_TABLE :
|
||||||
|
ER_CONNECT_TO_MASTER);
|
||||||
DBUG_ENTER("ha_federated::parse_url");
|
DBUG_ENTER("ha_federated::parse_url");
|
||||||
|
|
||||||
share->port= 0;
|
share->port= 0;
|
||||||
uint error_num= (table_create_flag ? ER_CANT_CREATE_TABLE :
|
share->socket= 0;
|
||||||
ER_CONNECT_TO_MASTER);
|
|
||||||
|
|
||||||
share->scheme= my_strdup(table->s->comment, MYF(0));
|
share->scheme= my_strdup(table->s->comment, MYF(0));
|
||||||
|
|
||||||
if ((share->username= strstr(share->scheme, "://")))
|
if ((share->username= strstr(share->scheme, "://")))
|
||||||
|
|
|
@ -548,6 +548,7 @@ int ha_heap::create(const char *name, TABLE *table_arg,
|
||||||
hp_create_info.auto_increment= (create_info->auto_increment_value ?
|
hp_create_info.auto_increment= (create_info->auto_increment_value ?
|
||||||
create_info->auto_increment_value - 1 : 0);
|
create_info->auto_increment_value - 1 : 0);
|
||||||
hp_create_info.max_table_size=current_thd->variables.max_heap_table_size;
|
hp_create_info.max_table_size=current_thd->variables.max_heap_table_size;
|
||||||
|
hp_create_info.with_auto_increment= found_real_auto_increment;
|
||||||
max_rows = (ha_rows) (hp_create_info.max_table_size / mem_per_row);
|
max_rows = (ha_rows) (hp_create_info.max_table_size / mem_per_row);
|
||||||
error= heap_create(fn_format(buff,name,"","",4+2),
|
error= heap_create(fn_format(buff,name,"","",4+2),
|
||||||
keys, keydef, share->reclength,
|
keys, keydef, share->reclength,
|
||||||
|
|
|
@ -1519,6 +1519,7 @@ void end_thread(THD *thd, bool put_in_cache)
|
||||||
thd=thread_cache.get();
|
thd=thread_cache.get();
|
||||||
thd->real_id=pthread_self();
|
thd->real_id=pthread_self();
|
||||||
(void) thd->store_globals();
|
(void) thd->store_globals();
|
||||||
|
thd->thr_create_time= time(NULL);
|
||||||
threads.append(thd);
|
threads.append(thd);
|
||||||
pthread_mutex_unlock(&LOCK_thread_count);
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
@ -5180,7 +5181,7 @@ log and this option does nothing anymore.",
|
||||||
(gptr*) &dflt_key_cache_var.param_buff_size,
|
(gptr*) &dflt_key_cache_var.param_buff_size,
|
||||||
(gptr*) 0,
|
(gptr*) 0,
|
||||||
0, (GET_ULL | GET_ASK_ADDR),
|
0, (GET_ULL | GET_ASK_ADDR),
|
||||||
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, UINT_MAX32, MALLOC_OVERHEAD,
|
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~(ulong) 0, MALLOC_OVERHEAD,
|
||||||
IO_SIZE, 0},
|
IO_SIZE, 0},
|
||||||
{"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
|
{"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
|
||||||
"This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache",
|
"This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache",
|
||||||
|
|
|
@ -1103,7 +1103,8 @@ pthread_handler_decl(handle_one_connection,arg)
|
||||||
thd->proc_info=0;
|
thd->proc_info=0;
|
||||||
thd->set_time();
|
thd->set_time();
|
||||||
thd->init_for_queries();
|
thd->init_for_queries();
|
||||||
while (!net->error && net->vio != 0 && !(thd->killed == THD::KILL_CONNECTION))
|
while (!net->error && net->vio != 0 &&
|
||||||
|
!(thd->killed == THD::KILL_CONNECTION))
|
||||||
{
|
{
|
||||||
net->no_send_error= 0;
|
net->no_send_error= 0;
|
||||||
if (do_command(thd))
|
if (do_command(thd))
|
||||||
|
|
|
@ -806,7 +806,7 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed)
|
||||||
if (s < end_of_string && *s=='.')
|
if (s < end_of_string && *s=='.')
|
||||||
{
|
{
|
||||||
endp= s+1;
|
endp= s+1;
|
||||||
while (s < end_of_string && my_isdigit(&my_charset_latin1, *endp))
|
while (endp < end_of_string && my_isdigit(&my_charset_latin1, *endp))
|
||||||
endp++;
|
endp++;
|
||||||
frac= endp - s - 1;
|
frac= endp - s - 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue