summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extra/replace.c18
-rw-r--r--libmysql/libmysql.c4
-rw-r--r--myisam/mi_check.c4
-rw-r--r--mysql-test/install_test_db.sh11
-rw-r--r--mysql-test/mysql-test-run.sh2
-rw-r--r--mysql-test/r/func_math.result6
-rw-r--r--mysql-test/t/func_math.test8
-rw-r--r--sql/ha_berkeley.cc2
-rw-r--r--sql/item_func.cc3
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc14
-rw-r--r--sql/sql_base.cc6
-rw-r--r--sql/sql_update.cc9
13 files changed, 59 insertions, 30 deletions
diff --git a/extra/replace.c b/extra/replace.c
index 792684918ea..422cfdbac36 100644
--- a/extra/replace.c
+++ b/extra/replace.c
@@ -14,18 +14,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/* Replace strings in textfile
+/*
+ Replace strings in textfile
+
This program replaces strings in files or from stdin to stdout.
It accepts a list of from-string/to-string pairs and replaces
each occurrence of a from-string with the corresponding to-string.
The first occurrence of a found string is matched. If there is more
than one possibility for the string to replace, longer matches
are preferred before shorter matches.
- This program replace strings in a file or on stdin/stdout.
- It accepts a list of from-strings and to-strings and replaces all
- occurents of from-strings to to-strings.
- The first occurents of a found string is matched. If there are more than
- one possibly replace the longer from-string is replaced.
+
Special characters in from string:
\^ Match start of line.
\$ Match end of line.
@@ -956,9 +954,11 @@ static void free_buffer()
}
-/* Fill the buffer retaining the last n bytes at the beginning of the
- newly filled buffer (for backward context). Returns the number of new
- bytes read from disk. */
+/*
+ Fill the buffer retaining the last n bytes at the beginning of the
+ newly filled buffer (for backward context). Returns the number of new
+ bytes read from disk.
+*/
static int fill_buffer_retaining(fd,n)
File fd;
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index f86435712dc..f2d77d495c9 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -2112,8 +2112,8 @@ static my_bool mysql_reconnect(MYSQL *mysql)
{
/* Allow reconnect next time */
mysql->server_status&= ~SERVER_STATUS_IN_TRANS;
- mysql->net.last_errno=CR_SERVER_GONE_ERROR;
- strmov(mysql->net.last_error,ER(mysql->net.last_errno));
+ mysql->net.last_errno= CR_SERVER_GONE_ERROR;
+ strmov(mysql->net.last_error, ER(mysql->net.last_errno));
DBUG_RETURN(1);
}
mysql_init(&tmp_mysql);
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 8581f79c99d..61c98eb526f 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -112,7 +112,9 @@ int chk_status(MI_CHECK *param, register MI_INFO *info)
/* Don't count this as a real warning, as check can correct this ! */
uint save=param->warning_printed;
mi_check_print_warning(param,
- "%d clients is using or hasn't closed the table properly",
+ share->state.open_count==1 ?
+ "%d client is using or hasn't closed the table properly" :
+ "%d clients are using or haven't closed the table properly",
share->state.open_count);
/* If this will be fixed by the check, forget the warning */
if (param->testflag & T_UPDATE_STATE)
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index c87cf82088f..3b361b8afec 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -5,9 +5,16 @@
# This scripts creates the privilege tables db, host, user, tables_priv,
# columns_priv in the mysql database, as well as the func table.
-if [ x$1 = x"-bin" ]; then
+if [ x$1 = x"--bin" ]; then
shift 1
- execdir=../bin
+
+# Check if it's a binary distribution or a 'make install'
+if test -x ../libexec/mysqld
+ then
+ execdir=../libexec
+ else
+ execdir=../bin
+fi
bindir=../bin
BINARY_DIST=1
fix_bin=mysql-test
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index cbacedfedb4..a606a492058 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -487,7 +487,7 @@ else
MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc"
MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen"
MYSQL="$BASEDIR/bin/mysql"
- INSTALL_DB="./install_test_db -bin"
+ INSTALL_DB="./install_test_db --bin"
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/bin/mysql_fix_privilege_tables"
if test -d "$BASEDIR/share/mysql/english"
then
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 46ad7a14e25..1b6a0d43738 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -59,3 +59,9 @@ ASIN(0.8+0.2)
SELECT ASIN(1.2-0.2);
ASIN(1.2-0.2)
1.570796
+floor(log(4)/log(2))
+2
+floor(log(8)/log(2))
+3
+floor(log(16)/log(2))
+4
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 2de692d4389..7057b0ca412 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -28,3 +28,11 @@ SELECT ACOS(0.2*5.0);
SELECT ACOS(0.5*2.0);
SELECT ASIN(0.8+0.2);
SELECT ASIN(1.2-0.2);
+
+#
+# Bug #3051 FLOOR returns invalid
+#
+
+select floor(log(4)/log(2));
+select floor(log(8)/log(2));
+select floor(log(16)/log(2));
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 15eb7fc72c6..35e731f20da 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -1334,7 +1334,7 @@ int ha_berkeley::index_init(uint keynr)
int ha_berkeley::index_end()
{
int error=0;
- DBUG_ENTER("index_end");
+ DBUG_ENTER("ha_berkely::index_end");
if (cursor)
{
DBUG_PRINT("enter",("table: '%s'", table->real_name));
diff --git a/sql/item_func.cc b/sql/item_func.cc
index ab96915e746..9d1f784fc25 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -667,7 +667,8 @@ longlong Item_func_ceiling::val_int()
longlong Item_func_floor::val_int()
{
- double value=args[0]->val();
+ // the volatile's for BUG #3051 to calm optimizer down (because of gcc's bug)
+ volatile double value=args[0]->val();
null_value=args[0]->null_value;
return (longlong) floor(value);
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 3267b42effc..c21a2f6f31d 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -376,7 +376,7 @@ bool check_stack_overrun(THD *thd,char *dummy);
#endif
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables);
-void table_cache_init(void);
+bool table_cache_init(void);
void table_cache_free(void);
uint cached_tables(void);
void kill_mysql(void);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 38faf95fd0e..671a78f6bfd 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2225,8 +2225,10 @@ You should consider changing lower_case_table_names to 1 or 2",
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home[1]=0;
server_init();
- table_cache_init();
- hostname_cache_init();
+ if (table_cache_init() || hostname_cache_init())
+ {
+ unireg_abort(1);
+ }
query_cache_result_size_limit(query_cache_limit);
query_cache_resize(query_cache_size);
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
@@ -3749,11 +3751,11 @@ replicating a LOAD DATA INFILE command",
0, 0, 0, 0},
{"log-warnings", 'W', "Log some not critical warnings to the log file",
(gptr*) &global_system_variables.log_warnings,
- (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 1, 0, 0,
0, 0, 0},
{"warnings", 'W', "Deprecated ; Use --log-warnings instead",
(gptr*) &global_system_variables.log_warnings,
- (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 1, 0, 0,
0, 0, 0},
{ "back_log", OPT_BACK_LOG,
"The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.",
@@ -4100,8 +4102,8 @@ this value; if zero (the default): when the size exceeds max_binlog_size. \
1, 0},
{"table_cache", OPT_TABLE_CACHE,
"The number of open tables for all threads.", (gptr*) &table_cache_size,
- (gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, ~0L, 0, 1,
- 0},
+ (gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, 512*1024L,
+ 0, 1, 0},
{"thread_concurrency", OPT_THREAD_CONCURRENCY,
"Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.",
(gptr*) &concurrency, (gptr*) &concurrency, 0, GET_ULONG, REQUIRED_ARG,
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 9da1f4e2231..dac8da12065 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -47,11 +47,11 @@ extern "C" byte *table_cache_key(const byte *record,uint *length,
return (byte*) entry->table_cache_key;
}
-void table_cache_init(void)
+bool table_cache_init(void)
{
- VOID(hash_init(&open_cache,table_cache_size+16,0,0,table_cache_key,
- (hash_free_key) free_cache_entry,0));
mysql_rm_tmp_tables();
+ return hash_init(&open_cache,table_cache_size+16,0,0,table_cache_key,
+ (hash_free_key) free_cache_entry,0) != 0;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 0a8530aa141..02d2fe2c442 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -866,14 +866,16 @@ int multi_update::do_updates(bool from_send_error)
DBUG_RETURN(0);
for (cur_table= update_tables; cur_table ; cur_table= cur_table->next)
{
+ byte *ref_pos;
+ TABLE *tmp_table;
+
table = cur_table->table;
if (table == table_to_update)
continue; // Already updated
-
org_updated= updated;
- byte *ref_pos;
- TABLE *tmp_table= tmp_tables[cur_table->shared];
+ tmp_table= tmp_tables[cur_table->shared];
tmp_table->file->extra(HA_EXTRA_CACHE); // Change to read cache
+ (void) table->file->rnd_init(0);
table->file->extra(HA_EXTRA_NO_CACHE);
/*
@@ -940,6 +942,7 @@ int multi_update::do_updates(bool from_send_error)
else
trans_safe= 0; // Can't do safe rollback
}
+ (void) table->file->rnd_end();
}
DBUG_RETURN(0);