List:Commits« Previous MessageNext Message »
From:kgeorge Date:June 8 2007 2:12pm
Subject:bk commit into 5.1 tree (gkodinov:1.2551) BUG#27816
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kgeorge. When kgeorge 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, 2007-06-08 17:12:42+03:00, gkodinov@stripped +4 -0
  Bug #27816: Log tables ran with partitions crashes the server 
   when logging is enabled.
  Currently the partition engine doesn't allow log tables to
  be partitioned. But this was not checked and the server crashed.
  Fixed by adding a check in ALTER TABLE to disable partitioning the
  log tables.
  While working on the cause of the problem improved the way the log
  thread structures are initialized before opening the log tables.

  mysql-test/r/partition.result@stripped, 2007-06-08 17:12:40+03:00, gkodinov@stripped +8 -0
    Bug #27816: test case

  mysql-test/t/partition.test@stripped, 2007-06-08 17:12:40+03:00, gkodinov@stripped +14 -0
    Bug #27816: test case

  sql/log.cc@stripped, 2007-06-08 17:12:40+03:00, gkodinov@stripped +2 -0
    Bug #27816: optional
     Improved initialization of the log threads before opening 
     the log table.
     Remedies problems that arise from open_table() et. al. 
     depending on a correctly initialized thd.
     Prerequisite for handling partitioned log tables :
     they call the parser while reading the .frm file.

  sql/sql_table.cc@stripped, 2007-06-08 17:12:40+03:00, gkodinov@stripped +23 -13
    Bug #27816: throw an error when paritioning the log tables : 
     not supported by the partition engine.

# 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:	gkodinov
# Host:	magare.gmz
# Root:	/home/kgeorge/mysql/work/B27816-5.1-opt

--- 1.283/sql/log.cc	2007-05-31 17:45:16 +03:00
+++ 1.284/sql/log.cc	2007-06-08 17:12:40 +03:00
@@ -296,6 +296,8 @@ bool Log_to_csv_event_handler::open_log_
   table->db= log_thd->db;
   table->db_length= log_thd->db_length;
 
+  lex_start(log_thd);
+  log_thd->clear_error();
   if (simple_open_n_lock_tables(log_thd, table) ||
       table->table->file->extra(HA_EXTRA_MARK_AS_LOG_TABLE) ||
       table->table->file->ha_rnd_init(0))

--- 1.430/sql/sql_table.cc	2007-06-06 12:23:54 +03:00
+++ 1.431/sql/sql_table.cc	2007-06-08 17:12:40 +03:00
@@ -5747,21 +5747,31 @@ bool mysql_alter_table(THD *thd,char *ne
                                    table_list->table_name_length,
                                    table_list->table_name, 0);
 
-    /* Disable alter of enabled log tables */
-    if (table_kind && logger.is_log_table_enabled(table_kind))
+    if (table_kind)
     {
-      my_error(ER_BAD_LOG_STATEMENT, MYF(0), "ALTER");
-      DBUG_RETURN(TRUE);
-    }
+      /* Disable alter of enabled log tables */
+      if (logger.is_log_table_enabled(table_kind))
+      {
+        my_error(ER_BAD_LOG_STATEMENT, MYF(0), "ALTER");
+        DBUG_RETURN(TRUE);
+      }
 
-    /* Disable alter of log tables to unsupported engine */
-    if (table_kind &&
-        (create_info->used_fields & HA_CREATE_USED_ENGINE) &&
-        (!create_info->db_type || /* unknown engine */
-        !(create_info->db_type->flags & HTON_SUPPORT_LOG_TABLES)))
-    {
-      my_error(ER_UNSUPORTED_LOG_ENGINE, MYF(0));
-      DBUG_RETURN(TRUE);
+      /* Disable alter of log tables to unsupported engine */
+      if ((create_info->used_fields & HA_CREATE_USED_ENGINE) &&
+          (!create_info->db_type || /* unknown engine */
+           !(create_info->db_type->flags & HTON_SUPPORT_LOG_TABLES)))
+      {
+        my_error(ER_UNSUPORTED_LOG_ENGINE, MYF(0));
+        DBUG_RETURN(TRUE);
+      }
+
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+      if (alter_info->flags & ALTER_PARTITION)
+      {
+	my_error(ER_WRONG_USAGE, MYF(0), "PARTITION", "log table");
+        DBUG_RETURN(TRUE);
+      }
+#endif
     }
   }
 

--- 1.64/mysql-test/r/partition.result	2007-06-04 18:56:05 +03:00
+++ 1.65/mysql-test/r/partition.result	2007-06-08 17:12:40 +03:00
@@ -1245,4 +1245,12 @@ INSERT INTO t1 SELECT a + 8, b FROM t1;
 ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (64));
 ALTER TABLE t1 DROP PARTITION p1;
 DROP TABLE t1;
+USE mysql;
+SET GLOBAL general_log = 0;
+ALTER TABLE general_log ENGINE = MyISAM;
+ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
+(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
+ERROR HY000: Incorrect usage of PARTITION and log table
+ALTER TABLE general_log ENGINE = CSV;
+SET GLOBAL general_log = default;
 End of 5.1 tests

--- 1.58/mysql-test/t/partition.test	2007-06-04 18:56:06 +03:00
+++ 1.59/mysql-test/t/partition.test	2007-06-08 17:12:40 +03:00
@@ -1465,4 +1465,18 @@ ALTER TABLE t1 DROP PARTITION p1;
 
 DROP TABLE t1;
 
+#
+# Bug #27816: Log tables ran with partitions crashes the server when logging
+# is enabled.
+#
+
+USE mysql;
+SET GLOBAL general_log = 0;
+ALTER TABLE general_log ENGINE = MyISAM;
+--error ER_WRONG_USAGE
+ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
+  (PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
+ALTER TABLE general_log ENGINE = CSV;
+SET GLOBAL general_log = default;
+
 --echo End of 5.1 tests
Thread
bk commit into 5.1 tree (gkodinov:1.2551) BUG#27816kgeorge8 Jun