Below is the list of changes that have just been committed into a local
5.1 repository of istruewing. When istruewing 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@stripped, 2006-08-02 18:10:51+02:00, ingo@stripped +15 -0
Merge istruewing@stripped:/home/bk/mysql-5.1-engines
into chilla.local:/home/mydev/mysql-5.1-bug18775
MERGE: 1.2239.4.1
sql/ha_myisam.cc@stripped, 2006-08-02 18:03:43+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.184.1.1
sql/ha_myisammrg.cc@stripped, 2006-08-02 18:03:43+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.90.1.1
sql/ha_ndbcluster.cc@stripped, 2006-08-02 18:03:43+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.336.6.1
sql/mysql_priv.h@stripped, 2006-08-02 18:03:43+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.416.3.1
sql/sql_acl.cc@stripped, 2006-08-02 18:03:44+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.199.1.1
sql/sql_base.cc@stripped, 2006-08-02 18:03:44+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.333.1.1
sql/sql_db.cc@stripped, 2006-08-02 18:10:47+02:00, ingo@stripped +1 -2
Bug#18775 - Temporary table from alter table visible to other threads
Manual merge
MERGE: 1.138.1.1
sql/sql_delete.cc@stripped, 2006-08-02 18:03:44+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.186.2.1
sql/sql_insert.cc@stripped, 2006-08-02 18:03:44+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.210.1.1
sql/sql_partition.cc@stripped, 2006-08-02 18:03:44+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.80.1.1
sql/sql_show.cc@stripped, 2006-08-02 18:03:45+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.354.1.1
sql/sql_table.cc@stripped, 2006-08-02 18:03:46+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.356.2.1
sql/sql_trigger.cc@stripped, 2006-08-02 18:03:46+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.56.1.3
sql/sql_view.cc@stripped, 2006-08-02 18:03:46+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.95.1.1
sql/table.cc@stripped, 2006-08-02 18:03:46+02:00, ingo@stripped +0 -0
Auto merged
MERGE: 1.230.1.1
# 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: ingo
# Host: chilla.local
# Root: /home/mydev/mysql-5.1-bug18775/RESYNC
--- 1.185/sql/ha_myisam.cc 2006-08-02 18:10:59 +02:00
+++ 1.186/sql/ha_myisam.cc 2006-08-02 18:10:59 +02:00
@@ -464,11 +464,14 @@ int ha_myisam::restore(THD* thd, HA_CHEC
HA_CHECK_OPT tmp_check_opt;
char *backup_dir= thd->lex->backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
- const char *table_name= table->s->table_name.str;
+ char table_name[FN_REFLEN];
int error;
const char* errmsg;
DBUG_ENTER("restore");
+ VOID(tablename_to_filename(table->s->table_name.str, table_name,
+ sizeof(table_name)));
+
if (fn_format_relative_to_data_home(src_path, table_name, backup_dir,
MI_NAME_DEXT))
DBUG_RETURN(HA_ADMIN_INVALID);
@@ -504,10 +507,13 @@ int ha_myisam::backup(THD* thd, HA_CHECK
{
char *backup_dir= thd->lex->backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
- const char *table_name= table->s->table_name.str;
+ char table_name[FN_REFLEN];
int error;
const char *errmsg;
DBUG_ENTER("ha_myisam::backup");
+
+ VOID(tablename_to_filename(table->s->table_name.str, table_name,
+ sizeof(table_name)));
if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
reg_ext))
--- 1.92/sql/ha_myisammrg.cc 2006-08-02 18:10:59 +02:00
+++ 1.93/sql/ha_myisammrg.cc 2006-08-02 18:10:59 +02:00
@@ -473,7 +473,7 @@ int ha_myisammrg::create(const char *nam
an embedded server without changing the paths in the .MRG file.
*/
uint length= build_table_filename(buff, sizeof(buff),
- tables->db, tables->table_name, "");
+ tables->db, tables->table_name, "", 0);
/*
If a MyISAM table is in the same directory as the MERGE table,
we use the table name without a path. This means that the
--- 1.421/sql/mysql_priv.h 2006-08-02 18:10:59 +02:00
+++ 1.422/sql/mysql_priv.h 2006-08-02 18:10:59 +02:00
@@ -734,7 +734,7 @@ int mysql_rm_table_part2_with_lock(THD *
bool if_exists, bool drop_temporary,
bool log_query);
bool quick_rm_table(handlerton *base,const char *db,
- const char *table_name);
+ const char *table_name, uint flags);
void close_cached_table(THD *thd, TABLE *table);
bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent);
bool mysql_change_db(THD *thd,const char *name,bool no_access_check);
@@ -879,11 +879,9 @@ bool mysql_recreate_table(THD *thd, TABL
bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
HA_CREATE_INFO *create_info,
Table_ident *src_table);
-bool mysql_rename_table(handlerton *base,
- const char *old_db,
- const char * old_name,
- const char *new_db,
- const char * new_name);
+bool mysql_rename_table(handlerton *base, const char *old_db,
+ const char * old_name, const char *new_db,
+ const char * new_name, uint flags);
bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
bool mysql_drop_index(THD *thd, TABLE_LIST *table_list,
ALTER_INFO *alter_info);
@@ -1826,7 +1824,12 @@ uint strconvert(CHARSET_INFO *from_cs, c
uint filename_to_tablename(const char *from, char *to, uint to_length);
uint tablename_to_filename(const char *from, char *to, uint to_length);
uint build_table_filename(char *buff, size_t bufflen, const char *db,
- const char *table, const char *ext);
+ const char *table, const char *ext, uint flags);
+/* Flags for conversion functions. */
+#define FN_FROM_IS_TMP (1 << 0)
+#define FN_TO_IS_TMP (1 << 1)
+#define FN_IS_TMP (FN_FROM_IS_TMP | FN_TO_IS_TMP)
+
/* from hostname.cc */
struct in_addr;
my_string ip_to_hostname(struct in_addr *in,uint *errors);
--- 1.201/sql/sql_acl.cc 2006-08-02 18:10:59 +02:00
+++ 1.202/sql/sql_acl.cc 2006-08-02 18:10:59 +02:00
@@ -2962,7 +2962,7 @@ bool mysql_table_grant(THD *thd, TABLE_L
{
char buf[FN_REFLEN];
build_table_filename(buf, sizeof(buf), table_list->db,
- table_list->table_name, reg_ext);
+ table_list->table_name, reg_ext, 0);
fn_format(buf, buf, "", "", MY_UNPACK_FILENAME | MY_RESOLVE_SYMLINKS |
MY_RETURN_REAL_PATH | MY_APPEND_EXT);
if (access(buf,F_OK))
--- 1.334/sql/sql_base.cc 2006-08-02 18:10:59 +02:00
+++ 1.335/sql/sql_base.cc 2006-08-02 18:10:59 +02:00
@@ -254,7 +254,7 @@ uint cached_table_definitions(void)
Get TABLE_SHARE for a table.
get_table_share()
- thd Table share
+ thd Thread handle
table_list Table that should be opened
key Table cache key
key_length Length of key
@@ -1500,15 +1500,18 @@ TABLE *find_temporary_table(THD *thd, TA
char key[MAX_DBKEY_LENGTH];
uint key_length;
TABLE *table;
+ DBUG_ENTER("find_temporary_table");
+ DBUG_PRINT("enter", ("table: '%s'.'%s'",
+ table_list->db, table_list->table_name));
key_length= create_table_def_key(thd, key, table_list, 1);
for (table=thd->temporary_tables ; table ; table= table->next)
{
if (table->s->table_cache_key.length == key_length &&
!memcmp(table->s->table_cache_key.str, key, key_length))
- return table;
+ DBUG_RETURN(table);
}
- return 0; // Not a temporary table
+ DBUG_RETURN(0); // Not a temporary table
}
@@ -1949,7 +1952,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *
char path[FN_REFLEN];
enum legacy_db_type not_used;
build_table_filename(path, sizeof(path) - 1,
- table_list->db, table_list->table_name, reg_ext);
+ table_list->db, table_list->table_name, reg_ext, 0);
if (mysql_frm_type(thd, path, ¬_used) == FRMTYPE_VIEW)
{
/*
@@ -3509,6 +3512,8 @@ TABLE *open_temporary_table(THD *thd, co
uint key_length;
TABLE_LIST table_list;
DBUG_ENTER("open_temporary_table");
+ DBUG_PRINT("enter", ("table: '%s'.'%s' path: '%s'",
+ db, table_name, path));
table_list.db= (char*) db;
table_list.table_name= (char*) table_name;
--- 1.139/sql/sql_db.cc 2006-08-02 18:10:59 +02:00
+++ 1.140/sql/sql_db.cc 2006-08-02 18:10:59 +02:00
@@ -560,7 +560,7 @@ bool mysql_create_db(THD *thd, char *db,
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
/* Check directory */
- path_len= build_table_filename(path, sizeof(path), db, "", "");
+ path_len= build_table_filename(path, sizeof(path), db, "", "", 0);
path[path_len-1]= 0; // Remove last '/' from path
if (my_stat(path,&stat_info,MYF(0)))
@@ -704,7 +704,7 @@ bool mysql_alter_db(THD *thd, const char
We pass MY_DB_OPT_FILE as "extension" to avoid
"table name to file name" encoding.
*/
- build_table_filename(path, sizeof(path), db, "", MY_DB_OPT_FILE);
+ build_table_filename(path, sizeof(path), db, "", MY_DB_OPT_FILE, 0);
if ((error=write_db_opt(thd, path, create_info)))
goto exit;
@@ -797,7 +797,7 @@ bool mysql_rm_db(THD *thd,char *db,bool
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
- length= build_table_filename(path, sizeof(path), db, "", "");
+ length= build_table_filename(path, sizeof(path), db, "", "", 0);
strmov(path+length, MY_DB_OPT_FILE); // Append db option file name
del_dbopt(path); // Remove dboption hash entry
path[length]= '\0'; // Remove file name
@@ -1324,7 +1324,7 @@ bool mysql_change_db(THD *thd, const cha
}
}
#endif
- path_length= build_table_filename(path, sizeof(path), db_name, "", "");
+ path_length= build_table_filename(path, sizeof(path), db_name, "", "", 0);
if (path_length && path[path_length-1] == FN_LIBCHAR)
path[path_length-1]= '\0'; // remove ending '\'
if (my_access(path,F_OK))
@@ -1469,11 +1469,12 @@ bool mysql_rename_db(THD *thd, LEX_STRIN
if (thd->db && !strcmp(thd->db, old_db->str))
change_to_newdb= 1;
- build_table_filename(path, sizeof(path)-1, old_db->str, "", MY_DB_OPT_FILE);
+ build_table_filename(path, sizeof(path)-1,
+ old_db->str, "", MY_DB_OPT_FILE, 0);
if ((load_db_opt(thd, path, &create_info)))
create_info.default_table_charset= thd->variables.collation_server;
- length= build_table_filename(path, sizeof(path)-1, old_db->str, "", "");
+ length= build_table_filename(path, sizeof(path)-1, old_db->str, "", "", 0);
if (length && path[length-1] == FN_LIBCHAR)
path[length-1]=0; // remove ending '\'
if ((error= my_access(path,F_OK)))
@@ -1538,9 +1539,10 @@ bool mysql_rename_db(THD *thd, LEX_STRIN
If some tables were left in the new directory, rmdir() will fail.
It garantees we never loose any tables.
*/
- build_table_filename(path, sizeof(path)-1, new_db->str,"",MY_DB_OPT_FILE);
+ build_table_filename(path, sizeof(path)-1,
+ new_db->str,"",MY_DB_OPT_FILE, 0);
my_delete(path, MYF(MY_WME));
- length= build_table_filename(path, sizeof(path)-1, new_db->str, "", "");
+ length= build_table_filename(path, sizeof(path)-1, new_db->str, "", "", 0);
if (length && path[length-1] == FN_LIBCHAR)
path[length-1]=0; // remove ending '\'
rmdir(path);
@@ -1592,9 +1594,9 @@ bool mysql_rename_db(THD *thd, LEX_STRIN
/* pass empty file name, and file->name as extension to avoid encoding */
build_table_filename(oldname, sizeof(oldname)-1,
- old_db->str, "", file->name);
+ old_db->str, "", file->name, 0);
build_table_filename(newname, sizeof(newname)-1,
- new_db->str, "", file->name);
+ new_db->str, "", file->name, 0);
my_rename(oldname, newname, MYF(MY_WME));
}
my_dirend(dirp);
--- 1.188/sql/sql_delete.cc 2006-08-02 18:10:59 +02:00
+++ 1.189/sql/sql_delete.cc 2006-08-02 18:10:59 +02:00
@@ -888,7 +888,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST
}
path_length= build_table_filename(path, sizeof(path), table_list->db,
- table_list->table_name, reg_ext);
+ table_list->table_name, reg_ext, 0);
if (!dont_send_ok)
{
--- 1.213/sql/sql_insert.cc 2006-08-02 18:10:59 +02:00
+++ 1.214/sql/sql_insert.cc 2006-08-02 18:10:59 +02:00
@@ -2803,7 +2803,8 @@ static TABLE *create_table_from_items(TH
((thd->prelocked_mode == PRELOCKED) ?
MYSQL_OPEN_IGNORE_LOCKED_TABLES:0)))))
quick_rm_table(create_info->db_type, create_table->db,
- table_case_name(create_info, create_table->table_name));
+ table_case_name(create_info, create_table->table_name),
+ 0);
}
reenable_binlog(thd);
if (!table) // open failed
@@ -2825,7 +2826,7 @@ static TABLE *create_table_from_items(TH
hash_delete(&open_cache,(byte*) table);
VOID(pthread_mutex_unlock(&LOCK_open));
quick_rm_table(create_info->db_type, create_table->db,
- table_case_name(create_info, create_table->table_name));
+ table_case_name(create_info, create_table->table_name), 0);
DBUG_RETURN(0);
}
table->file->extra(HA_EXTRA_WRITE_CACHE);
@@ -3006,7 +3007,8 @@ void select_create::abort()
table->s->version= 0;
hash_delete(&open_cache,(byte*) table);
if (!create_info->table_existed)
- quick_rm_table(table_type, create_table->db, create_table->table_name);
+ quick_rm_table(table_type, create_table->db,
+ create_table->table_name, 0);
/* Tell threads waiting for refresh that something has happened */
if (version != refresh_version)
broadcast_refresh();
--- 1.358/sql/sql_show.cc 2006-08-02 18:11:00 +02:00
+++ 1.359/sql/sql_show.cc 2006-08-02 18:11:00 +02:00
@@ -467,7 +467,6 @@ mysql_find_files(THD *thd,List<char> *fi
uint col_access=thd->col_access;
#endif
TABLE_LIST table_list;
- char tbbuff[FN_REFLEN];
DBUG_ENTER("mysql_find_files");
if (wild && !wild[0])
@@ -484,8 +483,6 @@ mysql_find_files(THD *thd,List<char> *fi
DBUG_RETURN(-1);
}
- VOID(tablename_to_filename(tmp_file_prefix, tbbuff, sizeof(tbbuff)));
-
for (i=0 ; i < (uint) dirp->number_off_files ; i++)
{
char uname[NAME_LEN*3+1]; /* Unencoded name */
@@ -523,7 +520,7 @@ mysql_find_files(THD *thd,List<char> *fi
{
// Return only .frm files which aren't temp files.
if (my_strcasecmp(system_charset_info, ext=fn_rext(file->name),reg_ext) ||
- is_prefix(file->name,tbbuff))
+ is_prefix(file->name, tmp_file_prefix))
continue;
*ext=0;
VOID(filename_to_tablename(file->name, uname, sizeof(uname)));
@@ -692,7 +689,7 @@ bool mysqld_show_create_db(THD *thd, cha
}
else
{
- length= build_table_filename(path, sizeof(path), dbname, "", "");
+ length= build_table_filename(path, sizeof(path), dbname, "", "", 0);
found_libchar= 0;
if (length && path[length-1] == FN_LIBCHAR)
{
@@ -2558,7 +2555,7 @@ int get_all_tables(THD *thd, TABLE_LIST
}
else
{
- len= build_table_filename(path, sizeof(path), base_name, "", "");
+ len= build_table_filename(path, sizeof(path), base_name, "", "", 0);
end= path + len;
len= FN_LEN - len;
if (mysql_find_files(thd, &files, base_name,
@@ -2712,7 +2709,7 @@ int fill_schema_shemata(THD *thd, TABLE_
(grant_option && !check_grant_db(thd, file_name)))
#endif
{
- length= build_table_filename(path, sizeof(path), file_name, "", "");
+ length= build_table_filename(path, sizeof(path), file_name, "", "", 0);
found_libchar= 0;
if (length && path[length-1] == FN_LIBCHAR)
{
--- 1.360/sql/sql_table.cc 2006-08-02 18:11:00 +02:00
+++ 1.361/sql/sql_table.cc 2006-08-02 18:11:00 +02:00
@@ -51,31 +51,77 @@ static int mysql_prepare_table(THD *thd,
#define MYSQL50_TABLE_NAME_PREFIX "#mysql50#"
#define MYSQL50_TABLE_NAME_PREFIX_LENGTH 9
+
+/*
+ Translate a file name to a table name (WL #1324).
+
+ SYNOPSIS
+ filename_to_tablename()
+ from The file name in my_charset_filename.
+ to OUT The table name in system_charset_info.
+ to_length The size of the table name buffer.
+
+ RETURN
+ Table name length.
+*/
+
uint filename_to_tablename(const char *from, char *to, uint to_length)
{
- uint errors, res= strconvert(&my_charset_filename, from,
- system_charset_info, to, to_length, &errors);
- if (errors) // Old 5.0 name
+ uint errors;
+ uint res;
+ DBUG_ENTER("filename_to_tablename");
+ DBUG_PRINT("enter", ("from '%s'", from));
+
+ if (!memcmp(from, tmp_file_prefix, tmp_file_prefix_length))
{
- res= strxnmov(to, to_length, MYSQL50_TABLE_NAME_PREFIX, from, NullS) - to;
- sql_print_error("Invalid (old?) table or database name '%s'", from);
- /*
- TODO: add a stored procedure for fix table and database names,
- and mention its name in error log.
- */
+ /* Temporary table name. */
+ res= (strnmov(to, from, to_length) - to);
}
- return res;
+ else
+ {
+ res= strconvert(&my_charset_filename, from,
+ system_charset_info, to, to_length, &errors);
+ if (errors) // Old 5.0 name
+ {
+ res= (strxnmov(to, to_length, MYSQL50_TABLE_NAME_PREFIX, from, NullS) -
+ to);
+ sql_print_error("Invalid (old?) table or database name '%s'", from);
+ /*
+ TODO: add a stored procedure for fix table and database names,
+ and mention its name in error log.
+ */
+ }
+ }
+
+ DBUG_PRINT("exit", ("to '%s'", to));
+ DBUG_RETURN(res);
}
+/*
+ Translate a table name to a file name (WL #1324).
+
+ SYNOPSIS
+ tablename_to_filename()
+ from The table name in system_charset_info.
+ to OUT The file name in my_charset_filename.
+ to_length The size of the file name buffer.
+
+ RETURN
+ File name length.
+*/
+
uint tablename_to_filename(const char *from, char *to, uint to_length)
{
uint errors, length;
+ DBUG_ENTER("tablename_to_filename");
+ DBUG_PRINT("enter", ("from '%s'", from));
+
if (from[0] == '#' && !strncmp(from, MYSQL50_TABLE_NAME_PREFIX,
MYSQL50_TABLE_NAME_PREFIX_LENGTH))
- return (uint) (strmake(to, from+MYSQL50_TABLE_NAME_PREFIX_LENGTH,
- to_length-1) -
- (from + MYSQL50_TABLE_NAME_PREFIX_LENGTH));
+ DBUG_RETURN((uint) (strmake(to, from+MYSQL50_TABLE_NAME_PREFIX_LENGTH,
+ to_length-1) -
+ (from + MYSQL50_TABLE_NAME_PREFIX_LENGTH)));
length= strconvert(system_charset_info, from,
&my_charset_filename, to, to_length, &errors);
if (check_if_legal_tablename(to) &&
@@ -84,7 +130,8 @@ uint tablename_to_filename(const char *f
memcpy(to + length, "@@@", 4);
length+= 3;
}
- return length;
+ DBUG_PRINT("exit", ("to '%s'", to));
+ DBUG_RETURN(length);
}
@@ -93,52 +140,87 @@ uint tablename_to_filename(const char *f
SYNOPSIS
build_table_filename()
- buff where to write result
- bufflen buff size
- db database name, in system_charset_info
- table table name, in system_charset_info
- ext file extension
+ buff Where to write result in my_charset_filename.
+ bufflen buff size
+ db Database name in system_charset_info.
+ table_name Table name in system_charset_info.
+ ext File extension.
+ flags FN_FROM_IS_TMP or FN_TO_IS_TMP or FN_IS_TMP
+ table_name is temporary, do not change.
NOTES
Uses database and table name, and extension to create
a file name in mysql_data_dir. Database and table
names are converted from system_charset_info into "fscs".
+ Unless flags indicate a temporary table name.
+ 'db' is always converted.
'ext' is not converted.
- RETURN
+ The conversion suppression is required for ALTER TABLE. This
+ statement creates intermediate tables. These are regular
+ (non-temporary) tables with a temporary name. Their path names must
+ be derivable from the table name. So we cannot use
+ build_tmptable_filename() for them.
+ RETURN
+ path length
*/
-
uint build_table_filename(char *buff, size_t bufflen, const char *db,
- const char *table, const char *ext)
+ const char *table_name, const char *ext, uint flags)
{
uint length;
char dbbuff[FN_REFLEN];
char tbbuff[FN_REFLEN];
- VOID(tablename_to_filename(table, tbbuff, sizeof(tbbuff)));
+ DBUG_ENTER("build_table_filename");
+
+ if (flags & FN_IS_TMP) // FN_FROM_IS_TMP | FN_TO_IS_TMP
+ strnmov(tbbuff, table_name, sizeof(tbbuff));
+ else
+ VOID(tablename_to_filename(table_name, tbbuff, sizeof(tbbuff)));
+
VOID(tablename_to_filename(db, dbbuff, sizeof(dbbuff)));
- strxnmov(buff, bufflen,
- mysql_data_home, "/", dbbuff, "/", tbbuff, ext, NullS);
- length= unpack_filename(buff, buff);
- return length;
+ length= strxnmov(buff, bufflen, mysql_data_home, "/", dbbuff,
+ "/", tbbuff, ext, NullS) - buff;
+ DBUG_PRINT("exit", ("buff: '%s'", buff));
+ DBUG_RETURN(length);
}
+/*
+ Creates path to a file: mysql_tmpdir/#sql1234_12_1.ext
+
+ SYNOPSIS
+ build_tmptable_filename()
+ thd The thread handle.
+ buff Where to write result in my_charset_filename.
+ bufflen buff size
+
+ NOTES
+
+ Uses current_pid, thread_id, and tmp_table counter to create
+ a file name in mysql_tmpdir.
+
+ RETURN
+ path length
+*/
+
uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen)
{
uint length;
- char tbbuff[FN_REFLEN];
char tmp_table_name[tmp_file_prefix_length+22+22+22+3];
+ DBUG_ENTER("build_tmptable_filename");
+
my_snprintf(tmp_table_name, sizeof(tmp_table_name),
"%s%lx_%lx_%x",
tmp_file_prefix, current_pid,
thd->thread_id, thd->tmp_table++);
- VOID(tablename_to_filename(tmp_table_name, tbbuff, sizeof(tbbuff)));
- strxnmov(buff, bufflen, mysql_tmpdir, "/", tbbuff, reg_ext, NullS);
+
+ strxnmov(buff, bufflen, mysql_tmpdir, "/", tmp_table_name, reg_ext, NullS);
length= unpack_filename(buff, buff);
- return length;
+ DBUG_PRINT("exit", ("buff: '%s'", buff));
+ DBUG_RETURN(length);
}
/*
@@ -1201,7 +1283,7 @@ bool mysql_write_frm(ALTER_PARTITION_PAR
Build shadow frm file name
*/
build_table_filename(shadow_path, sizeof(shadow_path), lpt->db,
- lpt->table_name, "#");
+ lpt->table_name, "#", 0);
strxmov(shadow_frm_name, shadow_path, reg_ext, NullS);
if (flags & WFRM_WRITE_SHADOW)
{
@@ -1285,7 +1367,7 @@ bool mysql_write_frm(ALTER_PARTITION_PAR
Build frm file name
*/
build_table_filename(path, sizeof(path), lpt->db,
- lpt->table_name, "");
+ lpt->table_name, "", 0);
strxmov(frm_name, path, reg_ext, NullS);
/*
When we are changing to use new frm file we need to ensure that we
@@ -1606,7 +1688,7 @@ int mysql_rm_table_part2(THD *thd, TABLE
alias= (lower_case_table_names == 2) ? table->alias : table->table_name;
/* remove .frm file and engine files */
path_length= build_table_filename(path, sizeof(path),
- db, alias, reg_ext);
+ db, alias, reg_ext, 0);
}
if (drop_temporary ||
(table_type == NULL &&
@@ -1730,15 +1812,30 @@ int mysql_rm_table_part2(THD *thd, TABLE
}
+/*
+ Quickly remove a table.
+
+ SYNOPSIS
+ quick_rm_table()
+ base The handlerton handle.
+ db The database name.
+ table_name The table name.
+ flags flags for build_table_filename().
+
+ RETURN
+ 0 OK
+ != 0 Error
+*/
+
bool quick_rm_table(handlerton *base,const char *db,
- const char *table_name)
+ const char *table_name, uint flags)
{
char path[FN_REFLEN];
bool error= 0;
DBUG_ENTER("quick_rm_table");
uint path_length= build_table_filename(path, sizeof(path),
- db, table_name, reg_ext);
+ db, table_name, reg_ext, flags);
if (my_delete(path,MYF(0)))
error= 1; /* purecov: inspected */
path[path_length - reg_ext_length]= '\0'; // Remove reg_ext
@@ -2889,7 +2986,7 @@ static void set_table_default_charset(TH
HA_CREATE_INFO db_info;
char path[FN_REFLEN];
/* Abuse build_table_filename() to build the path to the db.opt file */
- build_table_filename(path, sizeof(path), db, "", MY_DB_OPT_FILE);
+ build_table_filename(path, sizeof(path), db, "", MY_DB_OPT_FILE, 0);
load_db_opt(thd, path, &db_info);
create_info->default_table_charset= db_info.default_table_charset;
}
@@ -3072,6 +3169,8 @@ bool mysql_create_table_internal(THD *th
handler *file;
bool error= TRUE;
DBUG_ENTER("mysql_create_table_internal");
+ DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d",
+ db, table_name, internal_tmp_table));
if (use_copy_create_info)
{
@@ -3291,7 +3390,8 @@ bool mysql_create_table_internal(THD *th
start++;
}
#endif
- path_length= build_table_filename(path, sizeof(path), db, alias, reg_ext);
+ path_length= build_table_filename(path, sizeof(path), db, alias, reg_ext,
+ internal_tmp_table ? FN_IS_TMP : 0);
}
/* Check if table already exists */
@@ -3335,9 +3435,13 @@ bool mysql_create_table_internal(THD *th
*/
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
+ char dbbuff[FN_REFLEN];
+ char tbbuff[FN_REFLEN];
bool create_if_not_exists =
create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS;
- if (ha_table_exists_in_engine(thd, db, table_name))
+ VOID(tablename_to_filename(db, dbbuff, sizeof(dbbuff)));
+ VOID(tablename_to_filename(table_name, tbbuff, sizeof(tbbuff)));
+ if (ha_table_exists_in_engine(thd, dbbuff, tbbuff))
{
DBUG_PRINT("info", ("Table with same name already existed in handler"));
@@ -3489,12 +3593,30 @@ make_unique_key_name(const char *field_n
** Alter a table definition
****************************************************************************/
+
+/*
+ Rename a table.
+
+ SYNOPSIS
+ mysql_rename_table()
+ base The handlerton handle.
+ old_db The old database name.
+ old_name The old table name.
+ new_db The new database name.
+ new_name The new table name.
+ flags flags for build_table_filename().
+ FN_FROM_IS_TMP old_name is temporary.
+ FN_TO_IS_TMP new_name is temporary.
+
+ RETURN
+ 0 OK
+ != 0 Error
+*/
+
bool
-mysql_rename_table(handlerton *base,
- const char *old_db,
- const char *old_name,
- const char *new_db,
- const char *new_name)
+mysql_rename_table(handlerton *base, const char *old_db,
+ const char *old_name, const char *new_db,
+ const char *new_name, uint flags)
{
THD *thd= current_thd;
char from[FN_REFLEN], to[FN_REFLEN], lc_from[FN_REFLEN], lc_to[FN_REFLEN];
@@ -3503,12 +3625,16 @@ mysql_rename_table(handlerton *base,
handler *file;
int error=0;
DBUG_ENTER("mysql_rename_table");
+ DBUG_PRINT("enter", ("old: '%s'.'%s' new: '%s'.'%s'",
+ old_db, old_name, new_db, new_name));
file= (base == NULL ? 0 :
get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base));
- build_table_filename(from, sizeof(from), old_db, old_name, "");
- build_table_filename(to, sizeof(to), new_db, new_name, "");
+ build_table_filename(from, sizeof(from), old_db, old_name, "",
+ flags & FN_FROM_IS_TMP);
+ build_table_filename(to, sizeof(to), new_db, new_name, "",
+ flags & FN_TO_IS_TMP);
/*
If lower_case_table_names == 2 (case-preserving but case-insensitive
@@ -3520,12 +3646,14 @@ mysql_rename_table(handlerton *base,
{
strmov(tmp_name, old_name);
my_casedn_str(files_charset_info, tmp_name);
- build_table_filename(lc_from, sizeof(lc_from), old_db, tmp_name, "");
+ build_table_filename(lc_from, sizeof(lc_from), old_db, tmp_name, "",
+ flags & FN_FROM_IS_TMP);
from_base= lc_from;
strmov(tmp_name, new_name);
my_casedn_str(files_charset_info, tmp_name);
- build_table_filename(lc_to, sizeof(lc_to), new_db, tmp_name, "");
+ build_table_filename(lc_to, sizeof(lc_to), new_db, tmp_name, "",
+ flags & FN_TO_IS_TMP);
to_base= lc_to;
}
@@ -3661,7 +3789,8 @@ static int prepare_for_restore(THD* thd,
if (fn_format_relative_to_data_home(src_path, uname, backup_dir, reg_ext))
DBUG_RETURN(-1); // protect buffer overflow
- build_table_filename(dst_path, sizeof(dst_path), db, table_name, reg_ext);
+ build_table_filename(dst_path, sizeof(dst_path),
+ db, table_name, reg_ext, 0);
if (lock_and_wait_for_table_name(thd,table))
DBUG_RETURN(-1);
@@ -3738,6 +3867,15 @@ static int prepare_for_repair(THD *thd,
table= &tmp_table;
pthread_mutex_unlock(&LOCK_open);
}
+ /*
+ REPAIR TABLE ... USE_FRM for temporary tables makes little sense.
+ */
+ if (table->s->tmp_table)
+ {
+ error= send_check_errmsg(thd, table_list, "repair",
+ "Cannot repair temporary table from .frm file");
+ goto end;
+ }
/*
User gave us USE_FRM which means that the header in the index file is
@@ -4435,7 +4573,7 @@ bool mysql_create_like_table(THD* thd, T
else
{
build_table_filename(src_path, sizeof(src_path),
- src_db, src_table, reg_ext);
+ src_db, src_table, reg_ext, 0);
/* Resolve symlinks (for windows) */
unpack_filename(src_path, src_path);
if (lower_case_table_names)
@@ -4474,7 +4612,7 @@ bool mysql_create_like_table(THD* thd, T
else
{
dst_path_length= build_table_filename(dst_path, sizeof(dst_path),
- db, table_name, reg_ext);
+ db, table_name, reg_ext, 0);
if (!access(dst_path, F_OK))
goto table_exists;
}
@@ -4524,7 +4662,7 @@ bool mysql_create_like_table(THD* thd, T
else if (err)
{
(void) quick_rm_table(create_info->db_type, db,
- table_name); /* purecov: inspected */
+ table_name, 0); /* purecov: inspected */
goto err; /* purecov: inspected */
}
@@ -5001,8 +5139,8 @@ bool mysql_alter_table(THD *thd,char *ne
db=table_list->db;
if (!new_db || !my_strcasecmp(table_alias_charset, new_db, db))
new_db= db;
- build_table_filename(reg_path, sizeof(reg_path), db, table_name, reg_ext);
- build_table_filename(path, sizeof(path), db, table_name, "");
+ build_table_filename(reg_path, sizeof(reg_path), db, table_name, reg_ext, 0);
+ build_table_filename(path, sizeof(path), db, table_name, "", 0);
used_fields=create_info->used_fields;
@@ -5019,6 +5157,7 @@ bool mysql_alter_table(THD *thd,char *ne
/* Check that we are not trying to rename to an existing table */
if (new_name)
{
+ DBUG_PRINT("info", ("new_db.new_name: '%s'.'%s'", new_db, new_name));
strmov(new_name_buff,new_name);
strmov(new_alias= new_alias_buff, new_name);
if (lower_case_table_names)
@@ -5051,11 +5190,9 @@ bool mysql_alter_table(THD *thd,char *ne
}
else
{
- char dir_buff[FN_REFLEN];
- strxnmov(dir_buff, sizeof(dir_buff)-1,
- mysql_real_data_home, new_db, NullS);
- if (!access(fn_format(new_name_buff,new_name_buff,dir_buff,reg_ext,0),
- F_OK))
+ build_table_filename(new_name_buff, sizeof(new_name_buff),
+ new_db, new_name_buff, reg_ext, 0);
+ if (!access(new_name_buff, F_OK))
{
/* Table will be closed in do_command() */
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
@@ -5136,13 +5273,13 @@ bool mysql_alter_table(THD *thd,char *ne
*fn_ext(new_name)=0;
table->s->version= 0; // Force removal of table def
close_cached_table(thd, table);
- if (mysql_rename_table(old_db_type,db,table_name,new_db,new_alias))
+ if (mysql_rename_table(old_db_type,db,table_name,new_db,new_alias, 0))
error= -1;
else if (Table_triggers_list::change_table_name(thd, db, table_name,
new_db, new_alias))
{
VOID(mysql_rename_table(old_db_type, new_db, new_alias, db,
- table_name));
+ table_name, 0));
error= -1;
}
}
@@ -5773,7 +5910,8 @@ bool mysql_alter_table(THD *thd,char *ne
{
char path[FN_REFLEN];
/* table is a normal table: Create temporary table in same directory */
- build_table_filename(path, sizeof(path), new_db, tmp_name, "");
+ build_table_filename(path, sizeof(path), new_db, tmp_name, "",
+ FN_IS_TMP);
new_table=open_temporary_table(thd, path, new_db, tmp_name,0);
}
if (!new_table)
@@ -5986,7 +6124,7 @@ bool mysql_alter_table(THD *thd,char *ne
VOID(pthread_mutex_lock(&LOCK_open));
if (error)
{
- VOID(quick_rm_table(new_db_type,new_db,tmp_name));
+ VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP));
VOID(pthread_mutex_unlock(&LOCK_open));
goto err;
}
@@ -6008,7 +6146,7 @@ bool mysql_alter_table(THD *thd,char *ne
{
error=1;
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_name_buff);
- VOID(quick_rm_table(new_db_type,new_db,tmp_name));
+ VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP));
VOID(pthread_mutex_unlock(&LOCK_open));
goto err;
}
@@ -6036,22 +6174,24 @@ bool mysql_alter_table(THD *thd,char *ne
error=0;
if (!need_copy_table)
new_db_type=old_db_type= NULL; // this type cannot happen in regular ALTER
- if (mysql_rename_table(old_db_type,db,table_name,db,old_name))
+ if (mysql_rename_table(old_db_type, db, table_name, db, old_name,
+ FN_TO_IS_TMP))
{
error=1;
- VOID(quick_rm_table(new_db_type,new_db,tmp_name));
+ VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP));
}
else if (mysql_rename_table(new_db_type,new_db,tmp_name,new_db,
- new_alias) ||
+ new_alias, FN_FROM_IS_TMP) ||
(new_name != table_name || new_db != db) && // we also do rename
Table_triggers_list::change_table_name(thd, db, table_name,
new_db, new_alias))
-
- { // Try to get everything back
+ {
+ /* Try to get everything back. */
error=1;
- VOID(quick_rm_table(new_db_type,new_db,new_alias));
- VOID(quick_rm_table(new_db_type,new_db,tmp_name));
- VOID(mysql_rename_table(old_db_type,db,old_name,db,alias));
+ VOID(quick_rm_table(new_db_type,new_db,new_alias, 0));
+ VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP));
+ VOID(mysql_rename_table(old_db_type, db, old_name, db, alias,
+ FN_FROM_IS_TMP));
}
if (error)
{
@@ -6095,7 +6235,7 @@ bool mysql_alter_table(THD *thd,char *ne
table->s->version= 0; // Force removal of table def
close_cached_table(thd,table);
}
- VOID(quick_rm_table(old_db_type,db,old_name));
+ VOID(quick_rm_table(old_db_type, db, old_name, FN_IS_TMP));
}
else
{
@@ -6112,7 +6252,7 @@ bool mysql_alter_table(THD *thd,char *ne
/* end threads waiting on lock */
mysql_lock_abort(thd,table, TRUE);
}
- VOID(quick_rm_table(old_db_type,db,old_name));
+ VOID(quick_rm_table(old_db_type, db, old_name, FN_IS_TMP));
if (close_data_tables(thd,db,table_name) ||
reopen_tables(thd,1,0))
{ // This shouldn't happen
@@ -6162,7 +6302,7 @@ bool mysql_alter_table(THD *thd,char *ne
shutdown.
*/
char path[FN_REFLEN];
- build_table_filename(path, sizeof(path), new_db, table_name, "");
+ build_table_filename(path, sizeof(path), new_db, table_name, "", 0);
table=open_temporary_table(thd, path, new_db, tmp_name,0);
if (table)
{
@@ -6193,7 +6333,7 @@ end_temporary:
close_temporary_table(thd, new_table, 1, 1);
}
else
- VOID(quick_rm_table(new_db_type,new_db,tmp_name));
+ VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP));
err:
DBUG_RETURN(TRUE);
--- 1.234/sql/table.cc 2006-08-02 18:11:00 +02:00
+++ 1.235/sql/table.cc 2006-08-02 18:11:00 +02:00
@@ -68,7 +68,7 @@ static byte *get_field_name(Field **buff
char *fn_rext(char *name)
{
char *res= strrchr(name, '.');
- if (res && !strcmp(res, ".frm"))
+ if (res && !strcmp(res, reg_ext))
return res;
return name + strlen(name);
}
@@ -95,10 +95,13 @@ TABLE_SHARE *alloc_table_share(TABLE_LIS
TABLE_SHARE *share;
char path[FN_REFLEN];
uint path_length;
+ DBUG_ENTER("alloc_table_share");
+ DBUG_PRINT("enter", ("table: '%s'.'%s'",
+ table_list->db, table_list->table_name));
path_length= build_table_filename(path, sizeof(path) - 1,
table_list->db,
- table_list->table_name, "");
+ table_list->table_name, "", 0);
init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
if ((share= (TABLE_SHARE*) alloc_root(&mem_root,
sizeof(*share) + key_length +
@@ -148,7 +151,7 @@ TABLE_SHARE *alloc_table_share(TABLE_LIS
pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&share->cond, NULL);
}
- return share;
+ DBUG_RETURN(share);
}
@@ -179,6 +182,7 @@ void init_tmp_table_share(TABLE_SHARE *s
const char *path)
{
DBUG_ENTER("init_tmp_table_share");
+ DBUG_PRINT("enter", ("table: '%s'.'%s'", key, table_name));
bzero((char*) share, sizeof(*share));
init_sql_alloc(&share->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
@@ -286,7 +290,8 @@ int open_table_def(THD *thd, TABLE_SHARE
char path[FN_REFLEN];
MEM_ROOT **root_ptr, *old_root;
DBUG_ENTER("open_table_def");
- DBUG_PRINT("enter", ("name: '%s.%s'",share->db.str, share->table_name.str));
+ DBUG_PRINT("enter", ("table: '%s'.'%s' path: '%s'", share->db.str,
+ share->table_name.str, share->normalized_path.str));
error= 1;
error_given= 0;
--- 1.96/sql/sql_view.cc 2006-08-02 18:11:00 +02:00
+++ 1.97/sql/sql_view.cc 2006-08-02 18:11:00 +02:00
@@ -606,11 +606,11 @@ static int mysql_register_view(THD *thd,
/* print file name */
dir.length= build_table_filename(dir_buff, sizeof(dir_buff),
- view->db, "", "");
+ view->db, "", "", 0);
dir.str= dir_buff;
path.length= build_table_filename(path_buff, sizeof(path_buff),
- view->db, view->table_name, reg_ext);
+ view->db, view->table_name, reg_ext, 0);
path.str= path_buff;
file.str= path.str + dir.length;
@@ -1246,7 +1246,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIS
TABLE_SHARE *share;
bool type= 0;
build_table_filename(path, sizeof(path),
- view->db, view->table_name, reg_ext);
+ view->db, view->table_name, reg_ext, 0);
VOID(pthread_mutex_lock(&LOCK_open));
if (access(path, F_OK) ||
(type= (mysql_frm_type(thd, path, ¬_used) != FRMTYPE_VIEW)))
--- 1.62/sql/sql_trigger.cc 2006-08-02 18:11:00 +02:00
+++ 1.63/sql/sql_trigger.cc 2006-08-02 18:11:00 +02:00
@@ -468,12 +468,12 @@ bool Table_triggers_list::create_trigger
*/
file.length= build_table_filename(file_buff, FN_REFLEN-1,
tables->db, tables->table_name,
- triggers_file_ext);
+ triggers_file_ext, 0);
file.str= file_buff;
trigname_file.length= build_table_filename(trigname_buff, FN_REFLEN-1,
tables->db,
lex->spname->m_name.str,
- trigname_file_ext);
+ trigname_file_ext, 0);
trigname_file.str= trigname_buff;
/* Use the filesystem to enforce trigger namespace constraints. */
@@ -579,7 +579,7 @@ err_with_cleanup:
static bool rm_trigger_file(char *path, const char *db,
const char *table_name)
{
- build_table_filename(path, FN_REFLEN-1, db, table_name, triggers_file_ext);
+ build_table_filename(path, FN_REFLEN-1, db, table_name, triggers_file_ext, 0);
return my_delete(path, MYF(MY_WME));
}
@@ -602,7 +602,8 @@ static bool rm_trigger_file(char *path,
static bool rm_trigname_file(char *path, const char *db,
const char *trigger_name)
{
- build_table_filename(path, FN_REFLEN-1, db, trigger_name, trigname_file_ext);
+ build_table_filename(path, FN_REFLEN-1,
+ db, trigger_name, trigname_file_ext, 0);
return my_delete(path, MYF(MY_WME));
}
@@ -628,7 +629,7 @@ static bool save_trigger_file(Table_trig
LEX_STRING file;
file.length= build_table_filename(file_buff, FN_REFLEN-1, db, table_name,
- triggers_file_ext);
+ triggers_file_ext, 0);
file.str= file_buff;
return sql_create_definition_file(NULL, &file, &triggers_file_type,
(gptr)triggers, triggers_file_parameters,
@@ -803,7 +804,7 @@ bool Table_triggers_list::check_n_load(T
DBUG_ENTER("Table_triggers_list::check_n_load");
path.length= build_table_filename(path_buff, FN_REFLEN-1,
- db, table_name, triggers_file_ext);
+ db, table_name, triggers_file_ext, 0);
path.str= path_buff;
// QQ: should we analyze errno somehow ?
@@ -1159,7 +1160,7 @@ static TABLE_LIST *add_table_for_trigger
path.length= build_table_filename(path_buff, FN_REFLEN-1,
trig->m_db.str, trig->m_name.str,
- trigname_file_ext);
+ trigname_file_ext, 0);
path.str= path_buff;
if (access(path_buff, F_OK))
@@ -1366,7 +1367,7 @@ Table_triggers_list::change_table_name_i
{
trigname_file.length= build_table_filename(trigname_buff, FN_REFLEN-1,
db_name, trigger->str,
- trigname_file_ext);
+ trigname_file_ext, 0);
trigname_file.str= trigname_buff;
trigname.trigger_table= *new_table_name;
--- 1.345/sql/ha_ndbcluster.cc 2006-08-02 18:11:00 +02:00
+++ 1.346/sql/ha_ndbcluster.cc 2006-08-02 18:11:00 +02:00
@@ -5801,7 +5801,7 @@ int ndbcluster_discover(THD* thd, const
DBUG_RETURN(HA_ERR_NO_CONNECTION);
ndb->setDatabaseName(db);
NDBDICT* dict= ndb->getDictionary();
- build_table_filename(key, sizeof(key), db, name, "");
+ build_table_filename(key, sizeof(key), db, name, "", 0);
NDB_SHARE *share= get_share(key, 0, false);
if (share && get_ndb_share_state(share) == NSS_ALTERED)
{
@@ -5944,7 +5944,7 @@ int ndbcluster_drop_database_impl(const
// Drop any tables belonging to database
char full_path[FN_REFLEN];
char *tmp= full_path +
- build_table_filename(full_path, sizeof(full_path), dbname, "", "");
+ build_table_filename(full_path, sizeof(full_path), dbname, "", "", 0);
ndb->setDatabaseName(dbname);
List_iterator_fast<char> it(drop_list);
@@ -6067,7 +6067,7 @@ int ndbcluster_find_all_files(THD *thd)
/* check if database exists */
char *end= key +
- build_table_filename(key, sizeof(key), elmt.database, "", "");
+ build_table_filename(key, sizeof(key), elmt.database, "", "", 0);
if (my_access(key, F_OK))
{
/* no such database defined, skip table */
@@ -6210,7 +6210,7 @@ int ndbcluster_find_files(THD *thd,const
}
// File is not in NDB, check for .ndb file with this name
- build_table_filename(name, sizeof(name), db, file_name, ha_ndb_ext);
+ build_table_filename(name, sizeof(name), db, file_name, ha_ndb_ext, 0);
DBUG_PRINT("info", ("Check access for %s", name));
if (my_access(name, F_OK))
{
@@ -6235,7 +6235,7 @@ int ndbcluster_find_files(THD *thd,const
/* setup logging to binlog for all discovered tables */
{
char *end, *end1= name +
- build_table_filename(name, sizeof(name), db, "", "");
+ build_table_filename(name, sizeof(name), db, "", "", 0);
for (i= 0; i < ok_tables.records; i++)
{
file_name= (char*)hash_element(&ok_tables, i);
@@ -6257,7 +6257,7 @@ int ndbcluster_find_files(THD *thd,const
file_name= hash_element(&ndb_tables, i);
if (!hash_search(&ok_tables, file_name, strlen(file_name)))
{
- build_table_filename(name, sizeof(name), db, file_name, reg_ext);
+ build_table_filename(name, sizeof(name), db, file_name, reg_ext, 0);
if (my_access(name, F_OK))
{
DBUG_PRINT("info", ("%s must be discovered", file_name));
@@ -6808,7 +6808,7 @@ uint ndb_get_commitcount(THD *thd, char
NDB_SHARE *share;
DBUG_ENTER("ndb_get_commitcount");
- build_table_filename(name, sizeof(name), dbname, tabname, "");
+ build_table_filename(name, sizeof(name), dbname, tabname, "", 0);
DBUG_PRINT("enter", ("name: %s", name));
pthread_mutex_lock(&ndbcluster_mutex);
if (!(share=(NDB_SHARE*) hash_search(&ndbcluster_open_tables,
--- 1.81/sql/sql_partition.cc 2006-08-02 18:11:00 +02:00
+++ 1.82/sql/sql_partition.cc 2006-08-02 18:11:00 +02:00
@@ -3441,7 +3441,7 @@ bool mysql_unpack_partition(THD *thd, co
char *src_db= table_ident->db.str ? table_ident->db.str : thd->db;
char *src_table= table_ident->table.str;
char buf[FN_REFLEN];
- build_table_filename(buf, sizeof(buf), src_db, src_table, "");
+ build_table_filename(buf, sizeof(buf), src_db, src_table, "", 0);
if (partition_default_handling(table, part_info,
FALSE, buf))
{
@@ -4715,7 +4715,7 @@ static bool mysql_change_partitions(ALTE
handler *file= lpt->table->file;
DBUG_ENTER("mysql_change_partitions");
- build_table_filename(path, sizeof(path), lpt->db, lpt->table_name, "");
+ build_table_filename(path, sizeof(path), lpt->db, lpt->table_name, "", 0);
if ((error= file->change_partitions(lpt->create_info, path, &lpt->copied,
&lpt->deleted, lpt->pack_frm_data,
lpt->pack_frm_len)))
@@ -4755,7 +4755,7 @@ static bool mysql_rename_partitions(ALTE
int error;
DBUG_ENTER("mysql_rename_partitions");
- build_table_filename(path, sizeof(path), lpt->db, lpt->table_name, "");
+ build_table_filename(path, sizeof(path), lpt->db, lpt->table_name, "", 0);
if ((error= lpt->table->file->rename_partitions(path)))
{
if (error != 1)
@@ -4796,7 +4796,7 @@ static bool mysql_drop_partitions(ALTER_
int error;
DBUG_ENTER("mysql_drop_partitions");
- build_table_filename(path, sizeof(path), lpt->db, lpt->table_name, "");
+ build_table_filename(path, sizeof(path), lpt->db, lpt->table_name, "", 0);
if ((error= lpt->table->file->drop_partitions(path)))
{
lpt->table->file->print_error(error, MYF(0));
@@ -5147,7 +5147,7 @@ static bool write_log_drop_shadow_frm(AL
DBUG_ENTER("write_log_drop_shadow_frm");
build_table_filename(shadow_path, sizeof(shadow_path), lpt->db,
- lpt->table_name, "#");
+ lpt->table_name, "#", 0);
pthread_mutex_lock(&LOCK_gdl);
if (write_log_replace_delete_frm(lpt, 0UL, NULL,
(const char*)shadow_path, FALSE))
@@ -5195,9 +5195,9 @@ static bool write_log_rename_frm(ALTER_P
part_info->first_log_entry= NULL;
build_table_filename(path, sizeof(path), lpt->db,
- lpt->table_name, "");
+ lpt->table_name, "", 0);
build_table_filename(shadow_path, sizeof(shadow_path), lpt->db,
- lpt->table_name, "#");
+ lpt->table_name, "#", 0);
pthread_mutex_lock(&LOCK_gdl);
if (write_log_replace_delete_frm(lpt, 0UL, shadow_path, path, TRUE))
goto error;
@@ -5249,9 +5249,9 @@ static bool write_log_drop_partition(ALT
part_info->first_log_entry= NULL;
build_table_filename(path, sizeof(path), lpt->db,
- lpt->table_name, "");
+ lpt->table_name, "", 0);
build_table_filename(tmp_path, sizeof(tmp_path), lpt->db,
- lpt->table_name, "#");
+ lpt->table_name, "#", 0);
pthread_mutex_lock(&LOCK_gdl);
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
FALSE))
@@ -5306,9 +5306,9 @@ static bool write_log_add_change_partiti
DBUG_ENTER("write_log_add_change_partition");
build_table_filename(path, sizeof(path), lpt->db,
- lpt->table_name, "");
+ lpt->table_name, "", 0);
build_table_filename(tmp_path, sizeof(tmp_path), lpt->db,
- lpt->table_name, "#");
+ lpt->table_name, "#", 0);
pthread_mutex_lock(&LOCK_gdl);
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
FALSE))
@@ -5363,9 +5363,9 @@ static bool write_log_final_change_parti
part_info->first_log_entry= NULL;
build_table_filename(path, sizeof(path), lpt->db,
- lpt->table_name, "");
+ lpt->table_name, "", 0);
build_table_filename(shadow_path, sizeof(shadow_path), lpt->db,
- lpt->table_name, "#");
+ lpt->table_name, "#", 0);
pthread_mutex_lock(&LOCK_gdl);
if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
lpt->alter_info->flags & ALTER_REORGANIZE_PARTITION))
| Thread |
|---|
| • bk commit into 5.1 tree (ingo:1.2276) | ingo | 2 Aug |