Commit 59eaf292 authored by unknown's avatar unknown
Browse files

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


BitKeeper/etc/ignore:
  added mysql-test/r/*.log
client/mysqltest.c:
  Change type of variables to get rid of compiler warnings
  More debugging
  Fix memory leak
mysql-test/mysql-test-run.sh:
  Collect warnings about missing DBUG_RETURN statements
mysql-test/r/lock_multi.result:
  Add test of new code
mysql-test/r/ndb_condition_pushdown.result:
  Drop used tables before test
mysql-test/t/lock_multi.test:
  Add test of new code
mysql-test/t/ndb_condition_pushdown.test:
  Drop used tables before test
mysql-test/valgrind.supp:
  Ignore 'safe' warnings from libz (when used with archive)
sql/event.cc:
  More comments
  Simplify code
  Fixed memory leak found by valgrind
sql/ha_archive.cc:
  Remove compiler warnings (Wrong handlerton structure and signed/unsigned comparison)
sql/ha_berkeley.cc:
  Fixed compiler warning
sql/ha_blackhole.cc:
  Fixed compiler warning
sql/ha_federated.cc:
  Fixed compiler warning
sql/ha_heap.cc:
  Fixed compiler warning
sql/ha_myisam.cc:
  Fixed compiler warning
sql/ha_myisammrg.cc:
  Fixed compiler warning
sql/ha_ndbcluster.cc:
  Fixed compiler warnings
sql/ha_partition.cc:
  Fixed compiler warning
  Fixed error noticed by valgrind in ha_partition::rnd_init()
sql/handler.cc:
  Fixed compiler warning
sql/handler.h:
  Fixed compiler warning
sql/item.cc:
  Fixed compiler warning
sql/item_xmlfunc.cc:
  Fixed warning from valgrind when calling memcpy with wrong address
sql/lock.cc:
  More debugging
sql/log.cc:
  Fixed compiler warning
  Indentation fixes
sql/log.h:
  Fixed compiler warning
sql/mysql_priv.h:
  Changed prototype for 'drop_locked_tables'
sql/opt_range.cc:
  Indentation fix
sql/password.c:
  Removed compiler warnings
sql/set_var.cc:
  Fixed compiler warning
sql/slave.cc:
  Fixed compiler warning
sql/sp_head.cc:
  Fixed compiler warning
sql/sql_acl.cc:
  Fixed compiler warning
sql/sql_analyse.cc:
  Added missing DBUG_RETURN statements
sql/sql_base.cc:
  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_delete.cc:
  Fixed usage of not initialized variable
  (deleted could be referenced in some not common error conditions)
sql/sql_parse.cc:
  Added missing DBUG_VOID_RETURN
  Simplify code
sql/sql_partition.cc:
  Fixed usage of wrong variable (noticed by valgrind)
sql/sql_plugin.cc:
  Removed compiler warning
sql/sql_show.cc:
  Removed compiler warning
sql/sql_table.cc:
  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_yacc.yy:
  Ensure that no_write_to_binlog is properly initialized
  (Was accessed uninitialized by partition code)
sql/table.cc:
  Removed valgrind warnings (not fatal)
  Removed compiler warnings
sql/tztime.cc:
  Removed valgrind warning
storage/ndb/include/ndbapi/NdbIndexStat.hpp:
  Removed compiler warning
parent 73970add
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1758,3 +1758,4 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
mysql-test/r/*.log
+7 −5
Original line number Diff line number Diff line
@@ -209,9 +209,9 @@ struct st_replace_regex
   */
  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 @@ int var_query_set(VAR* var, const char *query, const char** query_end)
  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 @@ int var_query_set(VAR* var, const char *query, const char** query_end)
    eval_expr(var, "", 0);

  mysql_free_result(res);
  return 0;
  DBUG_RETURN(0);
}

void var_copy(VAR *dest, VAR *src)
@@ -1517,6 +1518,7 @@ void do_system(struct st_query *command)
  }

  command->last_argument= command->end;
  dynstr_free(&ds_cmd);
  DBUG_VOID_RETURN;
}

@@ -1557,7 +1559,7 @@ int do_echo(struct st_query *command)
  dynstr_append_mem(ds, "\n", 1);
  dynstr_free(&ds_echo);
  command->last_argument= command->end;
  return 0;
  return(0);
}


@@ -1660,7 +1662,7 @@ int do_save_master_pos()

    if (have_ndbcluster)
    {
      ulonglong epoch, tmp_epoch= 0;
      ulonglong epoch=0, tmp_epoch= 0;
      int count= 0;

      do
+1 −1
Original line number Diff line number Diff line
@@ -1088,7 +1088,7 @@ report_stats () {

    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
+7 −0
Original line number Diff line number Diff line
@@ -37,6 +37,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;
Field	Type	Null	Key	Default	Extra
+1 −1
Original line number Diff line number Diff line
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),
Loading