Below is the list of changes that have just been committed into a local
5.1 repository of monty. When monty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2243 06/03/29 14:27:36 monty@stripped +44 -0
Fixed compiler and valgrind warnings
Added missing DBUG_xxx_RETURN statements
Fixed some usage of not initialized variables (as found by valgrind)
Ensure that we don't remove locked tables used as name locks from open table cache until
unlock_table_names() are called.
This was fixed by having drop_locked_name() returning any table used as a name lock so
that we can free it in unlock_table_names()
This will allow Tomas to continue with his work to use namelocks to syncronize things.
Note: valgrind still produces a lot of warnings about using not initialized code and
shows memory loss errors when running the ndb tests
storage/ndb/include/ndbapi/NdbIndexStat.hpp
1.3 06/03/29 14:27:32 monty@stripped +1 -0
Removed compiler warning
sql/tztime.cc
1.33 06/03/29 14:27:32 monty@stripped +3 -4
Removed valgrind warning
sql/table.cc
1.218 06/03/29 14:27:32 monty@stripped +15 -3
Removed valgrind warnings (not fatal)
Removed compiler warnings
sql/sql_yacc.yy
1.485 06/03/29 14:27:31 monty@stripped +2 -1
Ensure that no_write_to_binlog is properly initialized
(Was accessed uninitialized by partition code)
sql/sql_table.cc
1.321 06/03/29 14:27:31 monty@stripped +20 -4
Ensure that we don't remove locked tables used as name locks from open table cache
until unlock_table_names() are called.
This was fixed by having drop_locked_name() returning any table used as a name lock so
that we can free it in unlock_table_names()
This will allow Tomas to continue with his work to use namelocks to syncronize things.
Fixed wrong test of 'table_type' (path_length could otherwise be accessed
uninitialized)
Remove compile warnings about not initialized variables.
sql/sql_show.cc
1.322 06/03/29 14:27:31 monty@stripped +6 -4
Removed compiler warning
sql/sql_plugin.cc
1.17 06/03/29 14:27:31 monty@stripped +2 -1
Removed compiler warning
sql/sql_partition.cc
1.58 06/03/29 14:27:31 monty@stripped +1 -1
Fixed usage of wrong variable (noticed by valgrind)
sql/sql_parse.cc
1.535 06/03/29 14:27:31 monty@stripped +15 -18
Added missing DBUG_VOID_RETURN
Simplify code
sql/sql_delete.cc
1.178 06/03/29 14:27:31 monty@stripped +1 -2
Fixed usage of not initialized variable
(deleted could be referenced in some not common error conditions)
sql/sql_base.cc
1.312 06/03/29 14:27:31 monty@stripped +46 -10
Removed de-reference of not initialized pointer
More comments
drop_locked_tables() changed to not delete tables used for name locking
Fixed compiler warnings
sql/sql_analyse.cc
1.68 06/03/29 14:27:31 monty@stripped +17 -18
Added missing DBUG_RETURN statements
sql/sql_acl.cc
1.188 06/03/29 14:27:31 monty@stripped +3 -2
Fixed compiler warning
sql/sp_head.cc
1.214 06/03/29 14:27:31 monty@stripped +1 -1
Fixed compiler warning
sql/slave.cc
1.269 06/03/29 14:27:31 monty@stripped +2 -1
Fixed compiler warning
sql/set_var.cc
1.181 06/03/29 14:27:31 monty@stripped +2 -0
Fixed compiler warning
sql/password.c
1.40 06/03/29 14:27:31 monty@stripped +3 -3
Removed compiler warnings
sql/opt_range.cc
1.207 06/03/29 14:27:31 monty@stripped +2 -1
Indentation fix
sql/mysql_priv.h
1.388 06/03/29 14:27:31 monty@stripped +1 -1
Changed prototype for 'drop_locked_tables'
sql/log.h
1.8 06/03/29 14:27:31 monty@stripped +3 -1
Fixed compiler warning
sql/log.cc
1.200 06/03/29 14:27:30 monty@stripped +9 -5
Fixed compiler warning
Indentation fixes
sql/lock.cc
1.89 06/03/29 14:27:30 monty@stripped +2 -0
More debugging
sql/item_xmlfunc.cc
1.12 06/03/29 14:27:30 monty@stripped +1 -2
Fixed warning from valgrind when calling memcpy with wrong address
sql/item.cc
1.177 06/03/29 14:27:30 monty@stripped +3 -0
Fixed compiler warning
sql/handler.h
1.200 06/03/29 14:27:30 monty@stripped +2 -0
Fixed compiler warning
sql/handler.cc
1.224 06/03/29 14:27:30 monty@stripped +2 -1
Fixed compiler warning
sql/ha_partition.cc
1.41 06/03/29 14:27:30 monty@stripped +8 -4
Fixed compiler warning
Fixed error noticed by valgrind in ha_partition::rnd_init()
sql/ha_ndbcluster.cc
1.293 06/03/29 14:27:30 monty@stripped +2 -1
Fixed compiler warnings
sql/ha_myisammrg.cc
1.83 06/03/29 14:27:30 monty@stripped +2 -1
Fixed compiler warning
sql/ha_myisam.cc
1.175 06/03/29 14:27:30 monty@stripped +2 -1
Fixed compiler warning
sql/ha_heap.cc
1.84 06/03/29 14:27:30 monty@stripped +2 -1
Fixed compiler warning
sql/ha_federated.cc
1.56 06/03/29 14:27:30 monty@stripped +2 -1
Fixed compiler warning
sql/ha_blackhole.cc
1.29 06/03/29 14:27:30 monty@stripped +3 -2
Fixed compiler warning
sql/ha_berkeley.cc
1.173 06/03/29 14:27:30 monty@stripped +2 -1
Fixed compiler warning
sql/ha_archive.cc
1.85 06/03/29 14:27:30 monty@stripped +7 -4
Remove compiler warnings (Wrong handlerton structure and signed/unsigned comparison)
sql/event.cc
1.38 06/03/29 14:27:30 monty@stripped +15 -6
More comments
Simplify code
Fixed memory leak found by valgrind
mysql-test/valgrind.supp
1.5 06/03/29 14:27:30 monty@stripped +9 -0
Ignore 'safe' warnings from libz (when used with archive)
mysql-test/t/ndb_condition_pushdown.test
1.16 06/03/29 14:27:30 monty@stripped +1 -1
Drop used tables before test
mysql-test/t/lock_multi.test
1.14 06/03/29 14:27:30 monty@stripped +19 -0
Add test of new code
mysql-test/r/ndb_condition_pushdown.result
1.18 06/03/29 14:27:30 monty@stripped +1 -1
Drop used tables before test
mysql-test/r/lock_multi.result
1.16 06/03/29 14:27:30 monty@stripped +7 -0
Add test of new code
mysql-test/mysql-test-run.sh
1.310 06/03/29 14:27:30 monty@stripped +1 -1
Collect warnings about missing DBUG_RETURN statements
client/mysqltest.c
1.201 06/03/29 14:27:30 monty@stripped +7 -5
Change type of variables to get rid of compiler warnings
More debugging
Fix memory leak
BitKeeper/etc/ignore
1.235 06/03/29 14:22:53 monty@stripped +1 -0
added mysql-test/r/*.log
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: monty
# Host: narttu.mysql.fi
# Root: /home/my/mysql-5.1
--- 1.309/mysql-test/mysql-test-run.sh 2006-03-07 22:26:45 +02:00
+++ 1.310/mysql-test/mysql-test-run.sh 2006-03-29 14:27:30 +03:00
@@ -1088,7 +1088,7 @@
found_error=0
# Find errors
- for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning"
+ for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN"
do
if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
then
--- 1.172/sql/ha_berkeley.cc 2006-02-25 23:20:52 +02:00
+++ 1.173/sql/ha_berkeley.cc 2006-03-29 14:27:30 +03:00
@@ -155,7 +155,8 @@
NULL, /* Fill Files Table */
HTON_CLOSE_CURSORS_AT_COMMIT | HTON_FLUSH_AFTER_RENAME,
NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
};
handler *berkeley_create_handler(TABLE_SHARE *table)
--- 1.83/sql/ha_heap.cc 2006-02-25 23:20:52 +02:00
+++ 1.84/sql/ha_heap.cc 2006-03-29 14:27:30 +03:00
@@ -60,7 +60,8 @@
NULL, /* Fill Files Table */
HTON_CAN_RECREATE,
NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
};
static handler *heap_create_handler(TABLE_SHARE *table)
--- 1.174/sql/ha_myisam.cc 2006-02-25 23:20:52 +02:00
+++ 1.175/sql/ha_myisam.cc 2006-03-29 14:27:30 +03:00
@@ -92,7 +92,8 @@
NULL, /* Fill Files Table */
HTON_CAN_RECREATE,
NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
};
--- 1.82/sql/ha_myisammrg.cc 2006-02-27 17:58:32 +02:00
+++ 1.83/sql/ha_myisammrg.cc 2006-03-29 14:27:30 +03:00
@@ -70,7 +70,8 @@
NULL, /* Fill Files Table */
HTON_CAN_RECREATE,
NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
};
static handler *myisammrg_create_handler(TABLE_SHARE *table)
--- 1.223/sql/handler.cc 2006-03-26 12:32:46 +03:00
+++ 1.224/sql/handler.cc 2006-03-29 14:27:30 +03:00
@@ -68,7 +68,8 @@
NULL, /* fill_files_table */
HTON_NO_FLAGS, /* flags */
NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
};
static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
--- 1.199/sql/handler.h 2006-03-26 12:32:46 +03:00
+++ 1.200/sql/handler.h 2006-03-29 14:27:30 +03:00
@@ -686,6 +686,8 @@
{
do_prelock(tables, count);
}
+ virtual ~TABLEOP_HOOKS() {}
+ TABLEOP_HOOKS() {}
private:
/* Function primitive that is called prior to locking tables */
--- 1.176/sql/item.cc 2006-03-28 05:30:32 +03:00
+++ 1.177/sql/item.cc 2006-03-29 14:27:30 +03:00
@@ -1362,6 +1362,9 @@
Item **args, uint nargs, uint flags)
{
Item **arg, **last, *safe_args[2];
+
+ LINT_INIT(safe_args[0]);
+ LINT_INIT(safe_args[1]);
if (agg_item_collations(coll, fname, args, nargs, flags))
return TRUE;
--- 1.88/sql/lock.cc 2006-02-16 09:44:10 +02:00
+++ 1.89/sql/lock.cc 2006-03-29 14:27:30 +03:00
@@ -911,11 +911,13 @@
void unlock_table_names(THD *thd, TABLE_LIST *table_list,
TABLE_LIST *last_table)
{
+ DBUG_ENTER("unlock_table_names");
for (TABLE_LIST *table= table_list;
table != last_table;
table= table->next_local)
unlock_table_name(thd,table);
pthread_cond_broadcast(&COND_refresh);
+ DBUG_VOID_RETURN;
}
--- 1.199/sql/log.cc 2006-03-13 09:26:53 +02:00
+++ 1.200/sql/log.cc 2006-03-29 14:27:30 +03:00
@@ -63,9 +63,11 @@
Don't add constructors, destructors, or virtual functions.
*/
struct binlog_trx_data {
- bool empty() const {
+ bool empty() const
+ {
return pending == NULL && my_b_tell(&trans_log) == 0;
}
+ binlog_trx_data() {}
IO_CACHE trans_log; // The transaction cache
Rows_log_event *pending; // The pending binrows event
};
@@ -104,7 +106,8 @@
NULL, /* Fill FILES table */
HTON_NOT_USER_SELECTABLE | HTON_HIDDEN,
NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
};
@@ -2637,8 +2640,9 @@
int THD::binlog_write_table_map(TABLE *table, bool is_trans)
{
+ int error;
DBUG_ENTER("THD::binlog_write_table_map");
- DBUG_PRINT("enter", ("table=%p (%s: #%u)",
+ DBUG_PRINT("enter", ("table: %p (%s: #%u)",
table, table->s->table_name, table->s->table_map_id));
/* Pre-conditions */
@@ -2655,10 +2659,10 @@
trans_register_ha(this, options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN),
&binlog_hton);
- if (int error= mysql_bin_log.write(&the_event))
+ if ((error= mysql_bin_log.write(&the_event)))
DBUG_RETURN(error);
- ++binlog_table_maps;
+ binlog_table_maps++;
table->s->table_map_version= mysql_bin_log.table_map_version();
DBUG_RETURN(0);
}
--- 1.387/sql/mysql_priv.h 2006-03-22 08:57:50 +02:00
+++ 1.388/sql/mysql_priv.h 2006-03-29 14:27:31 +03:00
@@ -838,7 +838,7 @@
bool close_data_tables(THD *thd,const char *db, const char *table_name);
bool wait_for_tables(THD *thd);
bool table_is_used(TABLE *table, bool wait_for_name_lock);
-bool drop_locked_tables(THD *thd,const char *db, const char *table_name);
+TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name);
void abort_locked_tables(THD *thd,const char *db, const char *table_name);
void execute_init_command(THD *thd, sys_var_str *init_command_var,
rw_lock_t *var_mutex);
--- 1.206/sql/opt_range.cc 2006-03-24 13:33:04 +02:00
+++ 1.207/sql/opt_range.cc 2006-03-29 14:27:31 +03:00
@@ -6039,7 +6039,8 @@
SEL_ARG::insert(SEL_ARG *key)
{
SEL_ARG *element,**par,*last_element;
- LINT_INIT(par); LINT_INIT(last_element);
+ LINT_INIT(par);
+ LINT_INIT(last_element);
for (element= this; element != &null_element ; )
{
--- 1.39/sql/password.c 2006-01-11 16:49:48 +02:00
+++ 1.40/sql/password.c 2006-03-29 14:27:31 +03:00
@@ -323,7 +323,7 @@
char *octet2hex(char *to, const char *str, uint len)
{
- const byte *str_end= str + len;
+ const char *str_end= str + len;
for (; str != str_end; ++str)
{
*to++= _dig_vec_upper[((uchar) *str) >> 4];
@@ -406,7 +406,7 @@
mysql_sha1_result(&sha1_context, hash_stage2);
/* convert hash_stage2 to hex string */
*to++= PVERSION41_CHAR;
- octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
+ octet2hex(to, (const char*) hash_stage2, SHA1_HASH_SIZE);
}
@@ -520,5 +520,5 @@
void make_password_from_salt(char *to, const uint8 *hash_stage2)
{
*to++= PVERSION41_CHAR;
- octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
+ octet2hex(to, (const char*) hash_stage2, SHA1_HASH_SIZE);
}
--- 1.268/sql/slave.cc 2006-03-08 15:21:56 +02:00
+++ 1.269/sql/slave.cc 2006-03-29 14:27:31 +03:00
@@ -3613,7 +3613,7 @@
thd->net.last_error ?
thd->net.last_error : "<no message>");
}
- else if (rli->last_slave_errno != thd->net.last_errno)
+ else if (rli->last_slave_errno != (int) thd->net.last_errno)
{
sql_print_error("Slave (additional info): %s Error_code: %d",
thd->net.last_error ?
@@ -4095,6 +4095,7 @@
buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT /* a way to escape */)
DBUG_RETURN(queue_old_event(mi,buf,event_len));
+ LINT_INIT(inc_pos);
pthread_mutex_lock(&mi->data_lock);
switch (buf[EVENT_TYPE_OFFSET]) {
--- 1.187/sql/sql_acl.cc 2006-03-21 14:10:09 +02:00
+++ 1.188/sql/sql_acl.cc 2006-03-29 14:27:31 +03:00
@@ -5037,6 +5037,8 @@
LINT_INIT(acl_user);
LINT_INIT(acl_db);
LINT_INIT(grant_name);
+ LINT_INIT(user);
+ LINT_INIT(host);
/* Get the number of elements in the in-memory structure. */
switch (struct_no) {
@@ -5109,8 +5111,7 @@
result= 1; /* At least one element found. */
if ( drop )
{
- switch ( struct_no )
- {
+ switch ( struct_no ) {
case 0:
delete_dynamic_element(&acl_users, idx);
break;
--- 1.67/sql/sql_analyse.cc 2006-03-09 20:09:45 +02:00
+++ 1.68/sql/sql_analyse.cc 2006-03-29 14:27:31 +03:00
@@ -176,8 +176,7 @@
bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
{
- const char *begin, *end = str + str_len;
-
+ const char *begin, *end= str + str_len;
DBUG_ENTER("test_if_number");
/*
@@ -186,13 +185,13 @@
*/
for (; str != end && my_isspace(system_charset_info, *str); str++) ;
if (str == end)
- return 0;
+ DBUG_RETURN(0);
if (*str == '-')
{
info->negative = 1;
- if (++str == end || *str == '0') // converting -0 to a number
- return 0; // might lose information
+ if (++str == end || *str == '0') // converting -0 to a number
+ DBUG_RETURN(0); // might lose information
}
else
info->negative = 0;
@@ -210,33 +209,33 @@
int error;
info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
if (info->integers == 1)
- return 0; // a single number can't be zerofill
+ DBUG_RETURN(0); // single number can't be zerofill
info->maybe_zerofill = 1;
- return 1; // a zerofill number, or an integer
+ DBUG_RETURN(1); // a zerofill number, or an integer
}
if (*str == '.' || *str == 'e' || *str == 'E')
{
- if (info->zerofill) // can't be zerofill anymore
- return 0;
- if ((str + 1) == end) // number was something like '123[.eE]'
+ if (info->zerofill) // can't be zerofill anymore
+ DBUG_RETURN(0);
+ if ((str + 1) == end) // number was something like '123[.eE]'
{
char *endpos= (char*) str;
int error;
info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
- return 1;
+ DBUG_RETURN(1);
}
- if (*str == 'e' || *str == 'E') // number may be something like '1e+50'
+ if (*str == 'e' || *str == 'E') // number may be something like '1e+50'
{
str++;
if (*str != '-' && *str != '+')
- return 0;
+ DBUG_RETURN(0);
for (str++; str != end && my_isdigit(system_charset_info,*str); str++) ;
if (str == end)
{
- info->is_float = 1; // we can't use variable decimals here
+ info->is_float = 1; // we can't use variable decimals here
return 1;
}
- return 0;
+ DBUG_RETURN(0);
}
for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end
if (str == end) // number was something like '123.000'
@@ -244,17 +243,17 @@
char *endpos= (char*) str;
int error;
info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
- return 1;
+ DBUG_RETURN(1);
}
for (; str != end && my_isdigit(system_charset_info,*str); str++)
info->decimals++;
if (str == end)
{
info->dval = my_atof(begin);
- return 1;
+ DBUG_RETURN(1);
}
}
- return 0;
+ DBUG_RETURN(0);
}
--- 1.311/sql/sql_base.cc 2006-03-09 04:56:06 +02:00
+++ 1.312/sql/sql_base.cc 2006-03-29 14:27:31 +03:00
@@ -1877,7 +1877,7 @@
if (!thd->open_tables)
thd->version=refresh_version;
else if ((thd->version != refresh_version) &&
- ! (flags & MYSQL_LOCK_IGNORE_FLUSH) && !table->s->log_table)
+ ! (flags & MYSQL_LOCK_IGNORE_FLUSH))
{
/* Someone did a refresh while thread was opening tables */
if (refresh)
@@ -2349,13 +2349,36 @@
}
-/* drop tables from locked list */
+/*
+ drop tables from locked list
+
+ SYNOPSIS
+ drop_locked_tables()
+ thd Thread thandler
+ db Database
+ table_name Table name
+
+ INFORMATION
+ This is only called on drop tables
+
+ The TABLE object for the dropped table is unlocked but still kept around
+ as a name lock, which means that the table will be available for other
+ thread as soon as we call unlock_table_names().
+ If there is multiple copies of the table locked, all copies except
+ the first, which acts as a name lock, is removed.
+
+ RETURN
+ # If table existed, return table
+ 0 Table was not locked
+*/
+
-bool drop_locked_tables(THD *thd,const char *db, const char *table_name)
+TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name)
{
- TABLE *table,*next,**prev;
- bool found=0;
+ TABLE *table,*next,**prev, *found= 0;
prev= &thd->open_tables;
+ DBUG_ENTER("drop_locked_tables");
+
for (table= thd->open_tables; table ; table=next)
{
next=table->next;
@@ -2363,8 +2386,21 @@
!strcmp(table->s->db.str, db))
{
mysql_lock_remove(thd, thd->locked_tables,table);
- VOID(hash_delete(&open_cache,(byte*) table));
- found=1;
+ if (!found)
+ {
+ found= table;
+ /* Close engine table, but keep object around as a name lock */
+ if (table->db_stat)
+ {
+ table->db_stat= 0;
+ table->file->close();
+ }
+ }
+ else
+ {
+ /* We already have a name lock, remove copy */
+ VOID(hash_delete(&open_cache,(byte*) table));
+ }
}
else
{
@@ -2373,14 +2409,12 @@
}
}
*prev=0;
- if (found)
- VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh
if (thd->locked_tables && thd->locked_tables->table_count == 0)
{
my_free((gptr) thd->locked_tables,MYF(0));
thd->locked_tables=0;
}
- return found;
+ DBUG_RETURN(found);
}
@@ -3489,6 +3523,7 @@
Field_iterator_view field_it;
field_it.set(table_list);
Query_arena *arena, backup;
+ LINT_INIT(arena);
DBUG_ASSERT(table_list->schema_table_reformed ||
(ref != 0 && table_list->view != 0));
@@ -3578,6 +3613,7 @@
DBUG_ASSERT(table_ref->is_natural_join && table_ref->join_columns);
DBUG_ASSERT(*actual_table == NULL);
+ LINT_INIT(arena);
LINT_INIT(found_field);
for (;;)
--- 1.177/sql/sql_delete.cc 2006-03-15 12:21:22 +02:00
+++ 1.178/sql/sql_delete.cc 2006-03-29 14:27:31 +03:00
@@ -37,7 +37,7 @@
READ_RECORD info;
bool using_limit=limit != HA_POS_ERROR;
bool transactional_table, safe_update, const_cond;
- ha_rows deleted;
+ ha_rows deleted= 0;
uint usable_index= MAX_KEY;
SELECT_LEX *select_lex= &thd->lex->select_lex;
bool ha_delete_all_rows= 0;
@@ -212,7 +212,6 @@
else
init_read_record_idx(&info, thd, table, 1, usable_index);
- deleted=0L;
init_ftfuncs(thd, select_lex, 1);
thd->proc_info="updating";
will_batch= !table->file->start_bulk_delete();
--- 1.534/sql/sql_parse.cc 2006-03-21 14:10:09 +02:00
+++ 1.535/sql/sql_parse.cc 2006-03-29 14:27:31 +03:00
@@ -2112,8 +2112,8 @@
void log_slow_statement(THD *thd)
{
- DBUG_ENTER("log_slow_statement");
time_t start_of_query;
+ DBUG_ENTER("log_slow_statement");
/*
The following should never be true with our current code base,
@@ -2121,7 +2121,7 @@
statement in a trigger or stored function
*/
if (unlikely(thd->in_sub_stmt))
- return; // Don't set time for sub stmt
+ DBUG_VOID_RETURN; // Don't set time for sub stmt
start_of_query= thd->start_time;
thd->end_time(); // Set start time
@@ -5864,18 +5864,15 @@
{
if (thd->net.report_error)
{
- if (thd->lex->sphead)
- {
- delete thd->lex->sphead;
- thd->lex->sphead= NULL;
- }
- if (thd->lex->et)
+ delete lex->sphead;
+ lex->sphead= NULL;
+ if (lex->et)
{
- thd->lex->et->free_sphead_on_delete= true;
+ lex->et->free_sphead_on_delete= true;
/* alloced on thd->mem_root so no real memory free but dtor call */
- thd->lex->et->free_sp();
- thd->lex->et->deinit_mutexes();
- thd->lex->et= NULL;
+ lex->et->free_sp();
+ lex->et->deinit_mutexes();
+ lex->et= NULL;
}
}
else
@@ -5906,18 +5903,18 @@
thd->is_fatal_error));
query_cache_abort(&thd->net);
lex->unit.cleanup();
- if (thd->lex->sphead)
+ if (lex->sphead)
{
/* Clean up after failed stored procedure/function */
- delete thd->lex->sphead;
- thd->lex->sphead= NULL;
+ delete lex->sphead;
+ lex->sphead= NULL;
}
- if (thd->lex->et)
+ if (lex->et)
{
- thd->lex->et->free_sphead_on_delete= true;
+ lex->et->free_sphead_on_delete= true;
lex->et->free_sp();
lex->et->deinit_mutexes();
- thd->lex->et= NULL;
+ lex->et= NULL;
}
}
thd->proc_info="freeing items";
--- 1.321/sql/sql_show.cc 2006-03-21 14:10:10 +02:00
+++ 1.322/sql/sql_show.cc 2006-03-29 14:27:31 +03:00
@@ -1770,18 +1770,19 @@
there's lots of room for optimizing this, especially in non-sorted mode,
but nobody cares - it may be called only in case of failed plugin
initialization in the mysqld startup.
-
*/
+
void remove_status_vars(SHOW_VAR *list)
{
if (status_vars_inited)
{
pthread_mutex_lock(&LOCK_status);
SHOW_VAR *all= dynamic_element(&all_status_vars, 0, SHOW_VAR *);
- int a= 0, b= all_status_vars.elements, c= (a+b)/2, res;
+ int a= 0, b= all_status_vars.elements, c= (a+b)/2;
for (; list->name; list++)
{
+ int res= 0;
for (a= 0, b= all_status_vars.elements; b-a > 1; c= (a+b)/2)
{
res= show_var_cmp(list, all+c);
@@ -1789,7 +1790,8 @@
b= c;
else if (res > 0)
a= c;
- else break;
+ else
+ break;
}
if (res == 0)
all[c].type= SHOW_UNDEF;
@@ -1800,7 +1802,7 @@
else
{
SHOW_VAR *all= dynamic_element(&all_status_vars, 0, SHOW_VAR *);
- int i;
+ uint i;
for (; list->name; list++)
{
for (i= 0; i < all_status_vars.elements; i++)
--- 1.320/sql/sql_table.cc 2006-03-24 21:56:48 +02:00
+++ 1.321/sql/sql_table.cc 2006-03-29 14:27:31 +03:00
@@ -565,6 +565,10 @@
String built_query;
DBUG_ENTER("mysql_rm_table_part2");
+ LINT_INIT(alias);
+ LINT_INIT(path_length);
+ safe_mutex_assert_owner(&LOCK_open);
+
if (thd->current_stmt_binlog_row_based && !dont_log_query)
{
built_query.set_charset(system_charset_info);
@@ -614,7 +618,7 @@
*/
if (thd->current_stmt_binlog_row_based && !dont_log_query)
{
- ++non_temp_tables_count;
+ non_temp_tables_count++;
/*
Don't write the database name if it is the current one (or if
thd->db is NULL).
@@ -634,11 +638,18 @@
table_type= table->db_type;
if (!drop_temporary)
{
+ TABLE *locked_table;
abort_locked_tables(thd, db, table->table_name);
remove_table_from_cache(thd, db, table->table_name,
RTFC_WAIT_OTHER_THREAD_FLAG |
RTFC_CHECK_KILLED_FLAG);
- drop_locked_tables(thd, db, table->table_name);
+ /*
+ If the table was used in lock tables, remember it so that
+ unlock_table_names can free it
+ */
+ if ((locked_table= drop_locked_tables(thd, db, table->table_name)))
+ table->table= locked_table;
+
if (thd->killed)
{
thd->no_warnings_for_error= 0;
@@ -649,8 +660,8 @@
path_length= build_table_filename(path, sizeof(path),
db, alias, reg_ext);
}
- if (table_type == NULL &&
- (drop_temporary ||
+ if (drop_temporary ||
+ (table_type == NULL &&
(access(path, F_OK) &&
ha_create_table_from_engine(thd, db, alias)) ||
(!drop_view &&
@@ -3961,6 +3972,11 @@
uint *index_add_buffer;
bool committed= 0;
DBUG_ENTER("mysql_alter_table");
+
+ LINT_INIT(index_add_count);
+ LINT_INIT(index_drop_count);
+ LINT_INIT(index_add_buffer);
+ LINT_INIT(index_drop_buffer);
thd->proc_info="init";
table_name=table_list->table_name;
--- 1.484/sql/sql_yacc.yy 2006-03-21 14:10:10 +02:00
+++ 1.485/sql/sql_yacc.yy 2006-03-29 14:27:31 +03:00
@@ -4726,13 +4726,14 @@
lex->col_list.empty();
lex->select_lex.init_order();
lex->select_lex.db=lex->name= 0;
- lex->like_name= 0;
+ lex->like_name= 0;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= (handlerton*) &default_hton;
lex->create_info.default_table_charset= NULL;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_info.reset();
lex->alter_info.flags= 0;
+ lex->no_write_to_binlog= 0;
}
alter_commands
{}
--- 1.217/sql/table.cc 2006-03-22 13:10:33 +02:00
+++ 1.218/sql/table.cc 2006-03-29 14:27:32 +03:00
@@ -1556,7 +1556,15 @@
DBUG_RETURN (error);
}
- /* close a .frm file and it's tables */
+
+/*
+ Free information allocated by openfrm
+
+ SYNOPSIS
+ closefrm()
+ table TABLE object to free
+ free_share Is 1 if we also want to free table_share
+*/
int closefrm(register TABLE *table, bool free_share)
{
@@ -1564,6 +1572,7 @@
uint idx;
KEY *key_info;
DBUG_ENTER("closefrm");
+
if (table->db_stat)
error=table->file->close();
key_info= table->key_info;
@@ -2395,12 +2404,14 @@
table running on a old server will be valid.
*/
field->sql_type(sql_type);
- if (strncmp(sql_type.c_ptr(), table_def->type.str,
+ if (sql_type.length() < table_def->type.length - 1 ||
+ strncmp(sql_type.ptr(),
+ table_def->type.str,
table_def->type.length - 1))
{
sql_print_error("(%s) Expected field %s at position %d to have type "
"%s, found %s", table->alias, table_def->name.str,
- i, table_def->type.str, sql_type.c_ptr());
+ i, table_def->type.str, sql_type.c_ptr_safe());
error= TRUE;
}
else if (table_def->cset.str && !field->has_charset())
@@ -3621,6 +3632,7 @@
TABLE_LIST *add_table_ref= parent_table_ref ?
parent_table_ref : table_ref;
+ LINT_INIT(field_count);
if (field_it == &table_field_it)
{
/* The field belongs to a stored table. */
--- 1.37/sql/event.cc 2006-02-28 21:32:30 +02:00
+++ 1.38/sql/event.cc 2006-03-29 14:27:30 +03:00
@@ -952,6 +952,10 @@
NOTES
1) Use sp_name for look up, return in **ett if found
2) tbl is not closed at exit
+
+ RETURN
+ 0 ok In this case *ett is set to the event
+ # error *ett == 0
*/
static int
@@ -960,7 +964,7 @@
{
TABLE *table;
int ret;
- Event_timed *et=NULL;
+ Event_timed *et= 0;
DBUG_ENTER("db_find_event");
DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
@@ -997,7 +1001,7 @@
}
done:
- if (ret && et)
+ if (ret)
{
delete et;
et= 0;
@@ -1382,7 +1386,7 @@
ret= db_find_event(thd, spn, &definer, &et, NULL, thd->mem_root);
thd->restore_backup_open_tables_state(&backup);
- if (!ret && et)
+ if (et)
{
Protocol *protocol= thd->protocol;
char show_str_buf[768];
@@ -1392,10 +1396,12 @@
ulong sql_mode_len=0;
show_str.length(0);
- show_str.set_charset(system_charset_info);
if (et->get_create_event(thd, &show_str))
+ {
+ delete et;
DBUG_RETURN(1);
+ }
field_list.push_back(new Item_empty_string("Event", NAME_LEN));
@@ -1409,16 +1415,19 @@
show_str.length()));
if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF))
+ {
+ delete et;
DBUG_RETURN(1);
-
+ }
protocol->prepare_for_resend();
protocol->store(et->name.str, et->name.length, system_charset_info);
protocol->store((char*) sql_mode_str, sql_mode_len, system_charset_info);
- protocol->store(show_str.c_ptr(), show_str.length(), system_charset_info);
+ protocol->store(show_str.ptr(), show_str.length(), system_charset_info);
ret= protocol->write();
send_eof(thd);
+ delete et;
}
DBUG_RETURN(ret);
--- 1.11/sql/item_xmlfunc.cc 2006-03-22 10:55:25 +02:00
+++ 1.12/sql/item_xmlfunc.cc 2006-03-29 14:27:30 +03:00
@@ -2403,8 +2403,7 @@
char context[32];
uint clen= xpath.query.end - xpath.lasttok.beg;
set_if_bigger(clen, sizeof(context) - 1);
- memcpy(context, xpath.lasttok.beg, clen);
- context[clen]= '\0';
+ strmake(context, xpath.lasttok.beg, clen);
my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%s'",
MYF(0), context);
return;
--- 1.84/sql/ha_archive.cc 2006-02-25 23:20:51 +02:00
+++ 1.85/sql/ha_archive.cc 2006-03-29 14:27:30 +03:00
@@ -180,7 +180,9 @@
NULL, /* fill_files_table */
HTON_NO_FLAGS,
NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
+
};
static handler *archive_create_handler(TABLE_SHARE *table)
@@ -1228,10 +1230,11 @@
if (table->found_next_number_field)
{
Field *field= table->found_next_number_field;
- if (share->auto_increment_value <
- field->val_int((char*)(buf + field->offset())))
+ ulonglong auto_value=
+ (ulonglong) field->val_int((char*)(buf + field->offset()));
+ if (share->auto_increment_value < auto_value)
auto_increment_value= share->auto_increment_value=
- field->val_int((char*)(buf + field->offset()));
+ auto_value;
}
share->rows_recorded++;
}
--- 1.28/sql/ha_blackhole.cc 2006-02-25 23:20:52 +02:00
+++ 1.29/sql/ha_blackhole.cc 2006-03-29 14:27:30 +03:00
@@ -62,8 +62,9 @@
NULL, /* Alter Tablespace */
NULL, /* Fill FILES table */
HTON_CAN_RECREATE,
- NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_func */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
};
--- 1.32/sql/tztime.cc 2006-02-25 20:35:09 +02:00
+++ 1.33/sql/tztime.cc 2006-03-29 14:27:32 +03:00
@@ -2189,12 +2189,11 @@
TZ_NAMES_ENTRY *tmp_tzname;
Time_zone *result_tz= 0;
long offset;
-
DBUG_ENTER("my_tz_find");
DBUG_PRINT("enter", ("time zone name='%s'",
- name ? ((String *)name)->c_ptr() : "NULL"));
-
- DBUG_ASSERT(!time_zone_tables_exist || tz_tables || current_thd->slave_thread);
+ name ? ((String *)name)->c_ptr_safe() : "NULL"));
+ DBUG_ASSERT(!time_zone_tables_exist || tz_tables ||
+ current_thd->slave_thread);
if (!name)
DBUG_RETURN(0);
--- 1.7/sql/log.h 2006-02-28 10:53:05 +02:00
+++ 1.8/sql/log.h 2006-03-29 14:27:31 +03:00
@@ -40,7 +40,8 @@
class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
{
- public:
+public:
+ TC_LOG_DUMMY() {}
int open(const char *opt_name) { return 0; }
void close() { }
int log(THD *thd, my_xid xid) { return 1; }
@@ -354,6 +355,7 @@
class Log_event_handler
{
public:
+ Log_event_handler() {}
virtual bool init()= 0;
virtual void cleanup()= 0;
--- 1.292/sql/ha_ndbcluster.cc 2006-03-24 18:36:40 +02:00
+++ 1.293/sql/ha_ndbcluster.cc 2006-03-29 14:27:30 +03:00
@@ -2336,7 +2336,7 @@
if (generate_scan_filter(m_cond_stack, op))
DBUG_RETURN(ndb_err(trans));
- if (res= define_read_attrs(buf, op))
+ if ((res= define_read_attrs(buf, op)))
{
DBUG_RETURN(res);
}
@@ -9681,6 +9681,7 @@
NDBDICT *dict = ndb->getDictionary();
int error;
const char * errmsg;
+ LINT_INIT(errmsg);
switch (info->ts_cmd_type){
case (CREATE_TABLESPACE):
--- 1.15/mysql-test/r/lock_multi.result 2005-09-15 22:17:37 +03:00
+++ 1.16/mysql-test/r/lock_multi.result 2006-03-29 14:27:30 +03:00
@@ -36,6 +36,13 @@
drop table t2;
ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
+create table t1 (a int);
+create table t2 (a int);
+lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
+ insert t1 select * from t2;
+drop table t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+drop table t1;
create table t1(a int);
lock tables t1 write;
show columns from t1;
--- 1.13/mysql-test/t/lock_multi.test 2005-09-15 22:17:37 +03:00
+++ 1.14/mysql-test/t/lock_multi.test 2006-03-29 14:27:30 +03:00
@@ -95,6 +95,25 @@
connection locker;
drop table t1;
+#
+# Same test as above, but with the dropped table locked twice
+#
+
+connection locker;
+create table t1 (a int);
+create table t2 (a int);
+lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
+connection reader;
+send insert t1 select * from t2;
+connection locker;
+drop table t2;
+connection reader;
+--error 1146
+reap;
+connection locker;
+drop table t1;
+
+
# End of 4.1 tests
#
--- 1.180/sql/set_var.cc 2006-03-21 11:54:21 +02:00
+++ 1.181/sql/set_var.cc 2006-03-29 14:27:31 +03:00
@@ -1965,6 +1965,7 @@
bool sys_var_collation::check(THD *thd, set_var *var)
{
CHARSET_INFO *tmp;
+ LINT_INIT(tmp);
if (var->value->result_type() == STRING_RESULT)
{
@@ -1999,6 +2000,7 @@
bool sys_var_character_set::check(THD *thd, set_var *var)
{
CHARSET_INFO *tmp;
+ LINT_INIT(tmp);
if (var->value->result_type() == STRING_RESULT)
{
--- 1.4/mysql-test/valgrind.supp 2005-11-23 22:44:54 +02:00
+++ 1.5/mysql-test/valgrind.supp 2006-03-29 14:27:30 +03:00
@@ -153,6 +153,15 @@
fun:gzflush
}
+{
+ libz deflate3
+ Memcheck:Cond
+ obj:*/libz.so.*
+ obj:*/libz.so.*
+ fun:deflate
+ fun:do_flush
+}
+
#
# Warning from my_thread_init becasue mysqld dies before kill thread exists
#
--- 1.16/sql/sql_plugin.cc 2006-03-21 11:54:21 +02:00
+++ 1.17/sql/sql_plugin.cc 2006-03-29 14:27:31 +03:00
@@ -192,7 +192,8 @@
if (plugin_dl.version != MYSQL_PLUGIN_INTERFACE_VERSION)
{
- int i, sizeof_st_plugin;
+ int i;
+ uint sizeof_st_plugin;
struct st_mysql_plugin *old, *cur;
char *ptr= (char *)sym;
--- 1.40/sql/ha_partition.cc 2006-03-22 12:45:06 +02:00
+++ 1.41/sql/ha_partition.cc 2006-03-29 14:27:30 +03:00
@@ -103,8 +103,9 @@
NULL, /* Alter Tablespace */
NULL, /* Fill FILES table */
HTON_NOT_USER_SELECTABLE | HTON_HIDDEN,
- NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_func */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
};
/*
@@ -2914,12 +2915,15 @@
/* Now we see what the index of our first important partition is */
DBUG_PRINT("info", ("m_part_info->used_partitions 0x%x",
- m_part_info->used_partitions.bitmap));
+ m_part_info->used_partitions.bitmap));
part_id= bitmap_get_first_set(&(m_part_info->used_partitions));
DBUG_PRINT("info", ("m_part_spec.start_part %d", part_id));
if (MY_BIT_NONE == part_id)
+ {
+ error= 0;
goto err1;
+ }
/*
We have a partition and we are scanning with rnd_next
@@ -2958,7 +2962,7 @@
while ((int)--i >= (int)part_id)
{
if (bitmap_is_set(&(m_part_info->used_partitions), i))
- m_file[i]->ha_rnd_end();
+ m_file[i]->ha_rnd_end();
}
err1:
m_scan_value= 2;
--- 1.57/sql/sql_partition.cc 2006-03-25 01:21:33 +02:00
+++ 1.58/sql/sql_partition.cc 2006-03-29 14:27:31 +03:00
@@ -4924,7 +4924,7 @@
*/
if (table->part_info)
{
- if (thd->lex->alter_info.flags & ALTER_REMOVE_PARTITIONING)
+ if (alter_info->flags & ALTER_REMOVE_PARTITIONING)
{
DBUG_PRINT("info", ("Remove partitioning"));
if (!(thd->lex->create_info.used_fields & HA_CREATE_USED_ENGINE))
--- 1.17/mysql-test/r/ndb_condition_pushdown.result 2005-11-04 22:09:53 +02:00
+++ 1.18/mysql-test/r/ndb_condition_pushdown.result 2006-03-29 14:27:30 +03:00
@@ -1,4 +1,4 @@
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE IF EXISTS t1,t2,t3,t4;
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10),
--- 1.15/mysql-test/t/ndb_condition_pushdown.test 2005-10-13 17:11:43 +03:00
+++ 1.16/mysql-test/t/ndb_condition_pushdown.test 2006-03-29 14:27:30 +03:00
@@ -2,7 +2,7 @@
-- source include/not_embedded.inc
--disable_warnings
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE IF EXISTS t1,t2,t3,t4;
--enable_warnings
#
--- 1.200/client/mysqltest.c 2006-03-24 13:33:04 +02:00
+++ 1.201/client/mysqltest.c 2006-03-29 14:27:30 +03:00
@@ -209,9 +209,9 @@
*/
char* buf;
char* even_buf;
- uint even_buf_len;
char* odd_buf;
- uint odd_buf_len;
+ int even_buf_len;
+ int odd_buf_len;
};
struct st_replace_regex *glob_replace_regex= 0;
@@ -1279,6 +1279,7 @@
MYSQL_ROW row;
MYSQL* mysql = &cur_con->mysql;
LINT_INIT(res);
+ DBUG_ENTER("var_query_set");
while (end > query && *end != '`')
--end;
@@ -1340,7 +1341,7 @@
eval_expr(var, "", 0);
mysql_free_result(res);
- return 0;
+ DBUG_RETURN(0);
}
void var_copy(VAR *dest, VAR *src)
@@ -1517,6 +1518,7 @@
}
command->last_argument= command->end;
+ dynstr_free(&ds_cmd);
DBUG_VOID_RETURN;
}
@@ -1557,7 +1559,7 @@
dynstr_append_mem(ds, "\n", 1);
dynstr_free(&ds_echo);
command->last_argument= command->end;
- return 0;
+ return(0);
}
@@ -1660,7 +1662,7 @@
if (have_ndbcluster)
{
- ulonglong epoch, tmp_epoch= 0;
+ ulonglong epoch=0, tmp_epoch= 0;
int count= 0;
do
--- 1.55/sql/ha_federated.cc 2006-03-07 21:00:41 +02:00
+++ 1.56/sql/ha_federated.cc 2006-03-29 14:27:30 +03:00
@@ -400,7 +400,8 @@
NULL, /* Fill FILES table */
HTON_ALTER_NOT_SUPPORTED,
NULL, /* binlog_func */
- NULL /* binlog_log_query */
+ NULL, /* binlog_log_query */
+ NULL /* release_temporary_latches */
};
--- 1.2/storage/ndb/include/ndbapi/NdbIndexStat.hpp 2005-11-06 14:33:04 +02:00
+++ 1.3/storage/ndb/include/ndbapi/NdbIndexStat.hpp 2006-03-29 14:27:32 +03:00
@@ -108,6 +108,7 @@
Uint16 m_entries;
Uint8 m_idir;
Uint8 pad1;
+ Area() {}
Pointer& get_pointer(unsigned i) const {
return *(Pointer*)&m_data[i];
}
--- 1.213/sql/sp_head.cc 2006-03-21 21:15:30 +02:00
+++ 1.214/sql/sp_head.cc 2006-03-29 14:27:31 +03:00
@@ -1224,10 +1224,10 @@
sp_rcontext *octx = thd->spcont;
sp_rcontext *nctx = NULL;
bool err_status= FALSE;
-
DBUG_ENTER("sp_head::execute_function");
DBUG_PRINT("info", ("function %s", m_name.str));
+ LINT_INIT(binlog_save_options);
params = m_pcont->context_pvars();
/*
--- 1.234/BitKeeper/etc/ignore 2006-03-28 06:46:13 +03:00
+++ 1.235/BitKeeper/etc/ignore 2006-03-29 14:22:53 +03:00
@@ -1758,3 +1758,4 @@
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
+mysql-test/r/*.log
| Thread |
|---|
| • bk commit into 5.1 tree (monty:1.2243) | monty | 31 Mar |