Below is the list of changes that have just been committed into a local
4.1 repository of mydev. When mydev 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
1.2201 05/04/28 18:28:50 ingo@stripped +4 -0
BUG#5964 - 4.1 MERGE tables regression from 4.0
Changed the creation of the .MRG file so that only the table name
is written when the MyISAM table is in the same database as the
MERGE table, a relative path is used in other cases in mysqld,
and possibly an absolute path is used in an embedded server.
No test case is added as the external behaviour is unchanged.
Only the file names within the .MRG file are changed.
sql/ha_myisammrg.cc
1.54 05/04/28 18:28:44 ingo@stripped +24 -4
BUG#5964 - 4.1 MERGE tables regression from 4.0
Changed the creation of the .MRG file so that only the table name
is written when the MyISAM table is in the same database as the
MERGE table, a relative path is used in other cases in mysqld,
and possibly an absolute path is used in an embedded server.
mysys/my_getwd.c
1.13 05/04/28 18:28:44 ingo@stripped +22 -0
BUG#5964 - 4.1 MERGE tables regression from 4.0
Added a new functions which checks for absolute _or_
relative paths.
myisammrg/myrg_open.c
1.28 05/04/28 18:28:44 ingo@stripped +1 -1
BUG#5964 - 4.1 MERGE tables regression from 4.0
Changed check for absolute path to check for any path.
include/my_sys.h
1.134 05/04/28 18:28:44 ingo@stripped +1 -0
BUG#5964 - 4.1 MERGE tables regression from 4.0
Added declaration for a new function.
# 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-4.1-bug5964
--- 1.133/include/my_sys.h Fri Mar 25 23:21:47 2005
+++ 1.134/include/my_sys.h Thu Apr 28 18:28:44 2005
@@ -609,6 +609,7 @@
extern uint dirname_length(const char *name);
#define base_name(A) (A+dirname_length(A))
extern int test_if_hard_path(const char *dir_name);
+extern my_bool has_path(const char *name);
extern char *convert_dirname(char *to, const char *from, const char *from_end);
extern void to_unix_path(my_string name);
extern my_string fn_ext(const char *name);
--- 1.27/myisammrg/myrg_open.c Tue Sep 7 14:19:05 2004
+++ 1.28/myisammrg/myrg_open.c Thu Apr 28 18:28:44 2005
@@ -80,7 +80,7 @@
continue; /* Skip comments */
}
- if (!test_if_hard_path(buff))
+ if (!has_path(buff))
{
VOID(strmake(name_buff+dir_length,buff,
sizeof(name_buff)-1-dir_length));
--- 1.12/mysys/my_getwd.c Mon Aug 23 12:46:49 2004
+++ 1.13/mysys/my_getwd.c Thu Apr 28 18:28:44 2005
@@ -192,3 +192,25 @@
return FALSE;
#endif
} /* test_if_hard_path */
+
+
+/*
+ Test if a name contains an (absolute or relative) path.
+
+ SYNOPSIS
+ has_path()
+ name The name to test.
+
+ RETURN
+ TRUE name contains a path.
+ FALSE name does not contain a path.
+*/
+
+my_bool has_path(const char *name)
+{
+ return test(strchr(name, FN_LIBCHAR))
+#ifdef FN_DEVCHAR
+ || test(strchr(name, FN_DEVCHAR))
+#endif
+ ;
+}
--- 1.53/sql/ha_myisammrg.cc Mon Dec 27 13:01:59 2004
+++ 1.54/sql/ha_myisammrg.cc Thu Apr 28 18:28:44 2005
@@ -381,6 +381,7 @@
char buff[FN_REFLEN],**table_names,**pos;
TABLE_LIST *tables= (TABLE_LIST*) create_info->merge_list.first;
THD *thd= current_thd;
+ uint dirlgt= dirname_length(name);
DBUG_ENTER("ha_myisammrg::create");
if (!(table_names= (char**) thd->alloc((create_info->merge_list.elements+1)*
@@ -394,11 +395,30 @@
tbl= find_temporary_table(thd, tables->db, tables->real_name);
if (!tbl)
{
- uint length= my_snprintf(buff,FN_REFLEN,"%s%s/%s",
- mysql_real_data_home,
+ /*
+ Construct the path to the MyISAM table. Try to meet two conditions:
+ 1.) Allow to include MyISAM tables from different databases, and
+ 2.) allow for moving DATADIR around in the file system.
+ The first means that we need paths in the .MRG file. The second
+ means that we should not have absolute paths in the .MRG file.
+ The best, we can do, is to use 'mysql_data_home', which is '.'
+ in mysqld and may be an absolute path in an embedded server.
+ This means that it might not be possible to move the DATADIR of
+ an embedded server without changing the paths in the .MRG file.
+ */
+ uint length= my_snprintf(buff, FN_REFLEN, "%s/%s/%s", mysql_data_home,
tables->db, tables->real_name);
- if (!(table_name= thd->strmake(buff, length)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ /*
+ 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
+ DATADIR can easily be moved even for an embedded server as long
+ as the MyISAM tables are from the same database as the MERGE table.
+ */
+ if ((dirname_length(buff) == dirlgt) && ! memcmp(buff, name, dirlgt))
+ table_name= tables->real_name;
+ else
+ if (! (table_name= thd->strmake(buff, length)))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
else
table_name=(*tbl)->path;
| Thread |
|---|
| • bk commit into 4.1 tree (ingo:1.2201) BUG#5964 | ingo | 28 Apr |