Commit e27960a4 authored by monty@mysql.com's avatar monty@mysql.com

Ensure that install_test_db.sh script works with both 'make install' and...

Ensure that install_test_db.sh script works with both 'make install' and 'make_binary_distribution' layouts
Abort if we can't allocate memory for table cache
Fix bug with multi-update-tables and BDB tables.
parent 1c0d5ad2
...@@ -14,18 +14,16 @@ ...@@ -14,18 +14,16 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 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. This program replaces strings in files or from stdin to stdout.
It accepts a list of from-string/to-string pairs and replaces It accepts a list of from-string/to-string pairs and replaces
each occurrence of a from-string with the corresponding to-string. each occurrence of a from-string with the corresponding to-string.
The first occurrence of a found string is matched. If there is more The first occurrence of a found string is matched. If there is more
than one possibility for the string to replace, longer matches than one possibility for the string to replace, longer matches
are preferred before shorter 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: Special characters in from string:
\^ Match start of line. \^ Match start of line.
\$ Match end of line. \$ Match end of line.
...@@ -956,9 +954,11 @@ static void free_buffer() ...@@ -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 Fill the buffer retaining the last n bytes at the beginning of the
bytes read from disk. */ newly filled buffer (for backward context). Returns the number of new
bytes read from disk.
*/
static int fill_buffer_retaining(fd,n) static int fill_buffer_retaining(fd,n)
File fd; File fd;
......
...@@ -5,9 +5,16 @@ ...@@ -5,9 +5,16 @@
# This scripts creates the privilege tables db, host, user, tables_priv, # This scripts creates the privilege tables db, host, user, tables_priv,
# columns_priv in the mysql database, as well as the func table. # 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 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 bindir=../bin
BINARY_DIST=1 BINARY_DIST=1
fix_bin=mysql-test fix_bin=mysql-test
......
...@@ -486,7 +486,7 @@ else ...@@ -486,7 +486,7 @@ else
MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc" MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc"
MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen" MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen"
MYSQL="$BASEDIR/bin/mysql" MYSQL="$BASEDIR/bin/mysql"
INSTALL_DB="./install_test_db -bin" INSTALL_DB="./install_test_db --bin"
if test -d "$BASEDIR/share/mysql/english" if test -d "$BASEDIR/share/mysql/english"
then then
LANGUAGE="$BASEDIR/share/mysql/english/" LANGUAGE="$BASEDIR/share/mysql/english/"
......
...@@ -1334,7 +1334,7 @@ int ha_berkeley::index_init(uint keynr) ...@@ -1334,7 +1334,7 @@ int ha_berkeley::index_init(uint keynr)
int ha_berkeley::index_end() int ha_berkeley::index_end()
{ {
int error=0; int error=0;
DBUG_ENTER("index_end"); DBUG_ENTER("ha_berkely::index_end");
if (cursor) if (cursor)
{ {
DBUG_PRINT("enter",("table: '%s'", table->real_name)); DBUG_PRINT("enter",("table: '%s'", table->real_name));
......
...@@ -375,7 +375,7 @@ bool check_stack_overrun(THD *thd,char *dummy); ...@@ -375,7 +375,7 @@ bool check_stack_overrun(THD *thd,char *dummy);
#endif #endif
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables); 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); void table_cache_free(void);
uint cached_tables(void); uint cached_tables(void);
void kill_mysql(void); void kill_mysql(void);
......
...@@ -2225,8 +2225,10 @@ You should consider changing lower_case_table_names to 1 or 2", ...@@ -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[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home[1]=0; mysql_data_home[1]=0;
server_init(); server_init();
table_cache_init(); if (table_cache_init() || hostname_cache_init())
hostname_cache_init(); {
unireg_abort(1);
}
query_cache_result_size_limit(query_cache_limit); query_cache_result_size_limit(query_cache_limit);
query_cache_resize(query_cache_size); query_cache_resize(query_cache_size);
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2); randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
...@@ -3749,11 +3751,11 @@ replicating a LOAD DATA INFILE command", ...@@ -3749,11 +3751,11 @@ replicating a LOAD DATA INFILE command",
0, 0, 0, 0}, 0, 0, 0, 0},
{"log-warnings", 'W', "Log some not critical warnings to the log file", {"log-warnings", 'W', "Log some not critical warnings to the log file",
(gptr*) &global_system_variables.log_warnings, (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}, 0, 0, 0},
{"warnings", 'W', "Deprecated ; Use --log-warnings instead", {"warnings", 'W', "Deprecated ; Use --log-warnings instead",
(gptr*) &global_system_variables.log_warnings, (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}, 0, 0, 0},
{ "back_log", OPT_BACK_LOG, { "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.", "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. \ ...@@ -4100,8 +4102,8 @@ this value; if zero (the default): when the size exceeds max_binlog_size. \
1, 0}, 1, 0},
{"table_cache", OPT_TABLE_CACHE, {"table_cache", OPT_TABLE_CACHE,
"The number of open tables for all threads.", (gptr*) &table_cache_size, "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, (gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, 512*1024L,
0}, 0, 1, 0},
{"thread_concurrency", OPT_THREAD_CONCURRENCY, {"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.", "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, (gptr*) &concurrency, (gptr*) &concurrency, 0, GET_ULONG, REQUIRED_ARG,
......
...@@ -47,11 +47,11 @@ extern "C" byte *table_cache_key(const byte *record,uint *length, ...@@ -47,11 +47,11 @@ extern "C" byte *table_cache_key(const byte *record,uint *length,
return (byte*) entry->table_cache_key; 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(); 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;
} }
......
...@@ -866,14 +866,16 @@ int multi_update::do_updates(bool from_send_error) ...@@ -866,14 +866,16 @@ int multi_update::do_updates(bool from_send_error)
DBUG_RETURN(0); DBUG_RETURN(0);
for (cur_table= update_tables; cur_table ; cur_table= cur_table->next) for (cur_table= update_tables; cur_table ; cur_table= cur_table->next)
{ {
byte *ref_pos;
TABLE *tmp_table;
table = cur_table->table; table = cur_table->table;
if (table == table_to_update) if (table == table_to_update)
continue; // Already updated continue; // Already updated
org_updated= updated; org_updated= updated;
byte *ref_pos; tmp_table= tmp_tables[cur_table->shared];
TABLE *tmp_table= tmp_tables[cur_table->shared];
tmp_table->file->extra(HA_EXTRA_CACHE); // Change to read cache tmp_table->file->extra(HA_EXTRA_CACHE); // Change to read cache
(void) table->file->rnd_init(0);
table->file->extra(HA_EXTRA_NO_CACHE); table->file->extra(HA_EXTRA_NO_CACHE);
/* /*
...@@ -940,6 +942,7 @@ int multi_update::do_updates(bool from_send_error) ...@@ -940,6 +942,7 @@ int multi_update::do_updates(bool from_send_error)
else else
trans_safe= 0; // Can't do safe rollback trans_safe= 0; // Can't do safe rollback
} }
(void) table->file->rnd_end();
} }
DBUG_RETURN(0); DBUG_RETURN(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment