List:Commits« Previous MessageNext Message »
From:reggie Date:January 24 2006 5:20am
Subject:bk commit into 5.1 tree (reggie:1.2056) BUG#14354
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of reggie. When reggie 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.2056 06/01/23 23:20:23 reggie@stripped +7 -0
  bug #14354 - data directory and index directory not working for partitions

  sql/sql_partition.cc
    1.21 06/01/23 23:20:15 reggie@stripped +12 -4
    add_keyword_string was not writing keyword value with quotes

  sql/sql_parse.cc
    1.510 06/01/23 23:20:15 reggie@stripped +2 -4
    moving append_file_to_dir to mysql_priv.h

  sql/mysql_priv.h
    1.367 06/01/23 23:20:14 reggie@stripped +2 -0
    move append_file_to_dir to mysql_priv.h

  sql/ha_partition.h
    1.9 06/01/23 23:20:14 reggie@stripped +4 -2
    added partition_name_with_path to set_up_table_before_create

  sql/ha_partition.cc
    1.21 06/01/23 23:20:14 reggie@stripped +13 -3
    pass partition filename with pathname into 
    set_up_table_before_create.
    
    remove the path from the passed in value and then append the filename
    to the data_file_name or index_file_name if those values were
    specified.

  mysql-test/t/partition_mgm_err.test
    1.3 06/01/23 23:20:14 reggie@stripped +16 -0
    test for bug #14354
    first make sure /tmp/bug14354 is not there, then make the dir
    create a partitioned table with the partition using
    /tmp/bug14354 as it's data dir
    we are disabling query logging since we are using $MYSQL_TEST_DIR
    and we are not certain where the tmp files will be created.

  mysql-test/r/partition_mgm_err.result
    1.3 06/01/23 23:20:14 reggie@stripped +1 -0
    only the single drop table since we have disabled query logging for the create table

# 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:	reggie
# Host:	linux.site
# Root:	/home/reggie/work/mysql-5.1-bug14354

--- 1.366/sql/mysql_priv.h	2006-01-12 12:50:31 -06:00
+++ 1.367/sql/mysql_priv.h	2006-01-23 23:20:14 -06:00
@@ -636,6 +636,8 @@
 		      char* packet, uint packet_length);
 void log_slow_statement(THD *thd);
 bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
+bool append_file_to_dir(THD *thd, const char **filename_ptr, 
+                        const char *table_name);
 
 bool table_cache_init(void);
 void table_cache_free(void);

--- 1.509/sql/sql_parse.cc	2006-01-13 10:09:23 -06:00
+++ 1.510/sql/sql_parse.cc	2006-01-23 23:20:15 -06:00
@@ -68,8 +68,6 @@
 static bool check_multi_update_lock(THD *thd);
 static void remove_escape(char *name);
 static void refresh_status(THD *thd);
-static bool append_file_to_dir(THD *thd, const char **filename_ptr,
-			       const char *table_name);
 
 const char *any_db="*any*";	// Special symbol for check_access
 
@@ -6733,8 +6731,8 @@
 
 	/* If pointer is not a null pointer, append filename to it */
 
-static bool append_file_to_dir(THD *thd, const char **filename_ptr,
-			       const char *table_name)
+bool append_file_to_dir(THD *thd, const char **filename_ptr,
+                        const char *table_name)
 {
   char buff[FN_REFLEN],*ptr, *end;
   if (!*filename_ptr)

--- 1.20/sql/ha_partition.cc	2006-01-11 02:26:01 -06:00
+++ 1.21/sql/ha_partition.cc	2006-01-23 23:20:14 -06:00
@@ -507,7 +507,7 @@
       error= (*file)->delete_table((const char*) from_buff);
     else
     {
-      set_up_table_before_create(table_arg, create_info, i);
+      set_up_table_before_create(table_arg, from_buff, create_info, i);
       error= (*file)->create(from_buff, table_arg, create_info);
     }
     name_buffer_ptr= strend(name_buffer_ptr) + 1;
@@ -550,8 +550,9 @@
 
 
 void ha_partition::set_up_table_before_create(TABLE *table,
-					      HA_CREATE_INFO *info,
-					      uint part_id)
+                   const char *partition_name_with_path, 
+                   HA_CREATE_INFO *info,
+                   uint part_id)
 {
   /*
     Set up
@@ -565,6 +566,15 @@
     return;                                     // Fatal error
   table->s->max_rows= part_elem->part_max_rows;
   table->s->min_rows= part_elem->part_min_rows;
+  char *partition_name= strrchr(partition_name_with_path, FN_LIBCHAR);
+  if (part_elem->index_file_name)
+    append_file_to_dir(current_thd,
+                       (const char**)&part_elem->index_file_name,
+                       partition_name+1);
+  if (part_elem->data_file_name)
+    append_file_to_dir(current_thd,
+                       (const char**)&part_elem->data_file_name,
+                       partition_name+1);
   info->index_file_name= part_elem->index_file_name;
   info->data_file_name= part_elem->data_file_name;
 }

--- 1.8/sql/ha_partition.h	2006-01-10 09:42:20 -06:00
+++ 1.9/sql/ha_partition.h	2006-01-23 23:20:14 -06:00
@@ -197,8 +197,10 @@
   bool new_handlers_from_part_info();
   bool create_handlers();
   void clear_handler_file();
-  void set_up_table_before_create(TABLE * table_arg, HA_CREATE_INFO * info,
-				  uint part_id);
+  void set_up_table_before_create(TABLE *table_arg,
+                                  const char *partition_name_with_path,
+                                  HA_CREATE_INFO *info,
+                                  uint part_id);
   partition_element *find_partition_element(uint part_id);
 public:
 

--- 1.20/sql/sql_partition.cc	2006-01-16 15:23:18 -06:00
+++ 1.21/sql/sql_partition.cc	2006-01-23 23:20:15 -06:00
@@ -1936,13 +1936,18 @@
 }
 
 static int add_keyword_string(File fptr, const char *keyword,
+                              bool should_use_quotes, 
                               const char *keystr)
 {
   int err= add_string(fptr, keyword);
   err+= add_space(fptr);
   err+= add_equal(fptr);
   err+= add_space(fptr);
+  if (should_use_quotes)
+    err+= add_string(fptr, "'");
   err+= add_string(fptr, keystr);
+  if (should_use_quotes)
+    err+= add_string(fptr, "'");
   return err + add_space(fptr);
 }
 
@@ -1968,7 +1973,8 @@
 {
   int err= 0;
   if (p_elem->tablespace_name)
-    err+= add_keyword_string(fptr,"TABLESPACE",p_elem->tablespace_name);
+    err+= add_keyword_string(fptr,"TABLESPACE", FALSE, 
+                             p_elem->tablespace_name);
   if (p_elem->nodegroup_id != UNDEF_NODEGROUP)
     err+= add_keyword_int(fptr,"NODEGROUP",(longlong)p_elem->nodegroup_id);
   if (p_elem->part_max_rows)
@@ -1976,11 +1982,13 @@
   if (p_elem->part_min_rows)
     err+= add_keyword_int(fptr,"MIN_ROWS",(longlong)p_elem->part_min_rows);
   if (p_elem->data_file_name)
-    err+= add_keyword_string(fptr,"DATA DIRECTORY",p_elem->data_file_name);
+    err+= add_keyword_string(fptr, "DATA DIRECTORY", TRUE, 
+                             p_elem->data_file_name);
   if (p_elem->index_file_name)
-    err+= add_keyword_string(fptr,"INDEX DIRECTORY",p_elem->index_file_name);
+    err+= add_keyword_string(fptr, "INDEX DIRECTORY", TRUE, 
+                             p_elem->index_file_name);
   if (p_elem->part_comment)
-    err+= add_keyword_string(fptr, "COMMENT",p_elem->part_comment);
+    err+= add_keyword_string(fptr, "COMMENT", FALSE, p_elem->part_comment);
   return err + add_engine(fptr,p_elem->engine_type);
 }
 

--- 1.2/mysql-test/r/partition_mgm_err.result	2005-12-15 05:22:59 -06:00
+++ 1.3/mysql-test/r/partition_mgm_err.result	2006-01-23 23:20:14 -06:00
@@ -107,3 +107,4 @@
 ALTER TABLE t1 DROP PARTITION x0;
 ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
 DROP TABLE t1;
+DROP TABLE t1;

--- 1.2/mysql-test/t/partition_mgm_err.test	2005-12-15 05:22:59 -06:00
+++ 1.3/mysql-test/t/partition_mgm_err.test	2006-01-23 23:20:14 -06:00
@@ -158,3 +158,19 @@
 ALTER TABLE t1 DROP PARTITION x0;
 
 DROP TABLE t1;
+
+#
+# BUG: 14354 Partitions: data directory clause fails
+#
+--exec rm -rf $MYSQL_TEST_DIR/var/tmp/bug14354
+--exec mkdir $MYSQL_TEST_DIR/var/tmp/bug14354
+disable_query_log;
+eval CREATE TABLE t1 (id int) PARTITION BY RANGE(id) (
+PARTITION p1 VALUES LESS THAN (20) ENGINE=myiasm 
+DATA DIRECTORY="$MYSQL_TEST_DIR/var/tmp/bug14354" 
+INDEX DIRECTORY="$MYSQL_TEST_DIR/var/tmp/bug14354");
+enable_query_log;
+--exec test -f $MYSQL_TEST_DIR/var/tmp/bug14354/t1_p1.MYD
+--exec test -f $MYSQL_TEST_DIR/var/tmp/bug14354/t1_p1.MYI
+DROP TABLE t1;
+--exec rm -rf $MYSQL_TEST_DIR/var/tmp/bug14354
Thread
bk commit into 5.1 tree (reggie:1.2056) BUG#14354reggie24 Jan