From 18665803f418cd0f1333349cd433f5b58818cc9e Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Nov 2003 14:00:25 +0200 Subject: [PATCH] Cleanups (comments and compiler warnings) dded init of variable to fix core dump on startup errors mysql-test/Makefile.am: Added transformation of socket address for mysql-test-run mysql-test/mysql-test-run.sh: Added option --socket sql/derror.cc: Removed compiler warning sql/mysql_priv.h: Moved assert up to be able to use asserts in other header files sql/mysqld.cc: Fixed comment sql/sql_bitmap.h: Added copyright notice Removed not needed header files sql/sql_class.cc: Added init of variable to fix core dump on startup errors sql/sql_test.cc: Fixed compiler errors (from key_map code) BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/Makefile.am | 1 + mysql-test/mysql-test-run.sh | 6 ++++-- sql/derror.cc | 1 + sql/mysql_priv.h | 2 +- sql/mysqld.cc | 2 +- sql/sql_bitmap.h | 32 ++++++++++++++++++++++---------- sql/sql_class.cc | 2 ++ sql/sql_test.cc | 5 +++-- 9 files changed, 36 insertions(+), 16 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 9df789c0340..9fa17da17a1 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -75,6 +75,7 @@ monty@hundin.mysql.fi monty@mashka.(none) monty@mashka.mysql.fi monty@mishka.mysql.fi +monty@mysql.com monty@narttu. monty@narttu.mysql.fi monty@rescue. diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 2babb6fba66..d23a9919b48 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -73,6 +73,7 @@ SUFFIXES = .sh -e 's!@''PERL''@!@PERL@!' \ -e 's!@''VERSION''@!@VERSION@!' \ -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \ + -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \ -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \ -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \ $< > $@-t diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index b7e39549411..94affe6b2f7 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -15,6 +15,7 @@ VERBOSE="" USE_MANAGER=0 MY_TZ=GMT-3 TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work +LOCAL_SOCKET=@MYSQL_UNIX_ADDR@ # For query_cache test ulimit -n 1024 @@ -226,7 +227,7 @@ while test $# -gt 0; do --slave-binary=*) SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;; --local) USE_RUNNING_SERVER="" ;; - --extern) USE_RUNNING_SERVER="1" ;; + --extern) USE_RUNNING_SERVER="1" ;; --tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;; --local-master) MASTER_MYPORT=3306; @@ -256,6 +257,7 @@ while test $# -gt 0; do --start-and-exit) START_AND_EXIT=1 ;; + --socket=*) LOCAL_SOCKET=`$ECHO "$1" | $SED -e "s;--socket=;;"` ;; --skip-rpl) NO_SLAVE=1 ;; --skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;; --do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;; @@ -501,7 +503,7 @@ then fi if [ -n "$USE_RUNNING_SERVER" ] then - MASTER_MYSOCK="/tmp/mysql.sock" + MASTER_MYSOCK=$LOCAL_SOCKET; DBUSER=${DBUSER:-test} else DBUSER=${DBUSER:-root} # We want to do FLUSH xxx commands diff --git a/sql/derror.cc b/sql/derror.cc index 7f4068c487e..f5fe92da238 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -136,6 +136,7 @@ err1: if (file != FERR) VOID(my_close(file,MYF(MY_WME))); unireg_abort(1); + return 1; } /* read_texts */ diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index f7b12bd959c..53cbba36b93 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -15,6 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include #include #include #include @@ -24,7 +25,6 @@ #include #include /* Needed by field.h */ #include -#include #ifdef __EMX__ #undef write /* remove pthread.h macro definition for EMX */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index fafc67e059d..75e2fc957e4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1884,7 +1884,7 @@ extern "C" int my_message_sql(uint error, const char *str, if ((thd= current_thd)) { /* - thd->lex.current_select equel to zero if lex structure is not inited + thd->lex.current_select == 0 if lex structure is not inited (not query command (COM_QUERY)) */ if (thd->lex.current_select && diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index 53293e39591..e5e50c180bf 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -1,14 +1,26 @@ -#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Implementation of a bitmap type. + The idea with this is to be able to handle any constant number of bits but + also be able to use 32 or 64 bits bitmaps very efficiently +*/ + #include -#include template class Bitmap { diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e5760dda8ae..ed8eaba9128 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -102,6 +102,8 @@ THD::THD():user_time(0), is_fatal_error(0), lock=locked_tables=0; used_tables=0; cuted_fields= sent_row_count= current_stmt_id= 0L; + // Must be reset to handle error with THD's created for init of mysqld + lex.current_select= 0; start_time=(time_t) 0; current_linfo = 0; slave_thread = 0; diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 7e3513367fd..47f0932b221 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -164,10 +164,11 @@ TEST_join(JOIN *join) { JOIN_TAB *tab=join->join_tab+i; TABLE *form=tab->table; - fprintf(DBUG_FILE,"%-16.16s type: %-7s q_keys: %4d refs: %d key: %d len: %d\n", + char key_map_buff[128]; + fprintf(DBUG_FILE,"%-16.16s type: %-7s q_keys: %s refs: %d key: %d len: %d\n", form->table_name, join_type_str[tab->type], - tab->keys, + tab->keys.print(key_map_buff), tab->ref.key_parts, tab->ref.key, tab->ref.key_length);