List:Commits« Previous MessageNext Message »
From:Dmitry Shulga Date:June 9 2011 5:25pm
Subject:bzr push into mysql-5.5 branch (Dmitry.Shulga:3434 to 3435) Bug#11764334
View as plain text  
 3435 Dmitry Shulga	2011-06-10 [merge]
      Auto-merge of patch for bug#11764334 from mysql-5.1 tree.

    modified:
      mysql-test/r/events_bugs.result
      mysql-test/t/events_bugs.test
      sql/event_db_repository.cc
      sql/event_parse_data.cc
      sql/event_parse_data.h
      sql/sql_yacc.yy
 3434 Dmitry Lenev	2011-06-09
      Fix for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
      STATEMENTS FAIL".
      
      Attempt to execute CREATE TABLE LIKE statement on a MyISAM
      table with INDEX or DATA DIRECTORY options specified as a
      source resulted in "MyISAM table '...' is in use..." error.
      According to our documentation such a statement should create
      a copy of source table with DATA/INDEX DIRECTORY options
      omitted.
      
      The problem was that new implementation of CREATE TABLE LIKE
      statement in 5.5 tried to copy value of INDEX and DATA DIRECTORY
      parameters from the source table. Since in description of source
      table this parameters also included name of this table, attempt
      to create target table with these parameter led to file name
      conflict and error.
      
      This fix addresses the problem by preserving documented and
      backward-compatible behavior. I.e. by ensuring that contents
      of DATA/INDEX DIRECTORY clauses for the source table is
      ignored when target table is created.
     @ mysql-test/r/symlink.result
        Added test for bug #11759990 - "52354: 'CREATE TABLE ..
        LIKE ... ' STATEMENTS FAIL".
     @ mysql-test/t/symlink.test
        Added test for bug #11759990 - "52354: 'CREATE TABLE ..
        LIKE ... ' STATEMENTS FAIL".
     @ sql/sql_table.cc
        Changed CREATE TABLE LIKE implementation to ignore contents
        of DATA/INDEX DIRECTORY clauses for source table when target
        table is created. This is documented and backward-compatible
        behavior.

    modified:
      mysql-test/r/symlink.result
      mysql-test/t/symlink.test
      sql/sql_table.cc
=== modified file 'mysql-test/r/events_bugs.result'
--- a/mysql-test/r/events_bugs.result	2011-05-27 11:42:28 +0000
+++ b/mysql-test/r/events_bugs.result	2011-06-09 17:07:03 +0000
@@ -419,7 +419,7 @@ SET TIME_ZONE= '+04:00';
 ALTER EVENT e1 DO SELECT 2;
 SHOW EVENTS;
 Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
-events_test	e1	root@localhost	-03:00	RECURRING	NULL	1	DAY	2005-12-31 20:58:59	2030-01-03 00:00:00	ENABLED	1	latin1	latin1_swedish_ci	latin1_swedish_ci
+events_test	e1	root@localhost	-03:00	RECURRING	NULL	1	DAY	2005-12-31 20:58:59	2030-01-03 00:00:00	DISABLED	1	latin1	latin1_swedish_ci	latin1_swedish_ci
 DROP EVENT e1;
 SET TIME_ZONE='+05:00';
 CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
@@ -796,6 +796,20 @@ COUNT(*)
 DROP EVENT IF EXISTS event_Bug12546938;
 DROP TABLE table_bug12546938;
 SET GLOBAL EVENT_SCHEDULER = OFF;
+DROP DATABASE IF EXISTS event_test11764334;
+CREATE DATABASE event_test11764334;
+USE event_test11764334;
+CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
+event_test11764334	ev1	root@localhost	SYSTEM	RECURRING	NULL	3	SECOND	2011-06-09 19:59:01	NULL	DISABLED	1	latin1	latin1_swedish_ci	latin1_swedish_ci
+ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
+event_test11764334	ev1	root@localhost	SYSTEM	RECURRING	NULL	4	SECOND	2011-06-09 19:59:01	NULL	DISABLED	1	latin1	latin1_swedish_ci	latin1_swedish_ci
+DROP EVENT ev1;
+DROP DATABASE event_test11764334;
+USE test;
 DROP DATABASE events_test;
 SET GLOBAL event_scheduler= 'ON';
 SET @@global.concurrent_insert= @concurrent_insert;

=== modified file 'mysql-test/t/events_bugs.test'
--- a/mysql-test/t/events_bugs.test	2011-05-27 11:42:28 +0000
+++ b/mysql-test/t/events_bugs.test	2011-06-09 17:07:03 +0000
@@ -1286,6 +1286,21 @@ DROP EVENT IF EXISTS event_Bug12546938;
 DROP TABLE table_bug12546938;
 SET GLOBAL EVENT_SCHEDULER = OFF;
 
+#
+# Bug#11764334 - 57156: ALTER EVENT CHANGES THE EVENT STATUS
+#
+--disable_warnings
+DROP DATABASE IF EXISTS event_test11764334;
+--enable_warnings
+CREATE DATABASE event_test11764334;
+USE event_test11764334;
+CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+DROP EVENT ev1;
+DROP DATABASE event_test11764334;
+USE test; 
 ###########################################################################
 #
 # End of tests

=== modified file 'sql/event_db_repository.cc'
--- a/sql/event_db_repository.cc	2011-05-27 11:42:28 +0000
+++ b/sql/event_db_repository.cc	2011-06-09 17:07:03 +0000
@@ -235,9 +235,16 @@ mysql_event_fill_row(THD *thd,
   if (fields[f_num= ET_FIELD_NAME]->store(et->name.str, et->name.length, scs))
     goto err_truncate;
 
-  /* both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull()*/
+  /* ON_COMPLETION field is NOT NULL thus not calling set_notnull()*/
   rs|= fields[ET_FIELD_ON_COMPLETION]->store((longlong)et->on_completion, TRUE);
-  rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
+
+  /*
+    Set STATUS value unconditionally in case of CREATE EVENT.
+    For ALTER EVENT set it only if value of this field was changed.
+    Since STATUS field is NOT NULL call to set_notnull() is not needed.
+  */
+  if (!is_update || et->status_changed)
+    rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
   rs|= fields[ET_FIELD_ORIGINATOR]->store((longlong)et->originator, TRUE);
 
   /*
@@ -716,8 +723,6 @@ Event_db_repository::create_event(THD *t
   if (mysql_event_fill_row(thd, table, parse_data, sp, saved_mode, FALSE))
     goto end;
 
-  table->field[ET_FIELD_STATUS]->store((longlong)parse_data->status, TRUE);
-
   if ((ret= table->file->ha_write_row(table->record[0])))
   {
     table->file->print_error(ret, MYF(0));

=== modified file 'sql/event_parse_data.cc'
--- a/sql/event_parse_data.cc	2010-03-31 14:05:33 +0000
+++ b/sql/event_parse_data.cc	2011-06-09 17:07:03 +0000
@@ -48,9 +48,8 @@ Event_parse_data::new_instance(THD *thd)
 
 Event_parse_data::Event_parse_data()
   :on_completion(Event_parse_data::ON_COMPLETION_DEFAULT),
-  status(Event_parse_data::ENABLED),
-  do_not_create(FALSE),
-  body_changed(FALSE),
+  status(Event_parse_data::ENABLED), status_changed(false),
+  do_not_create(FALSE), body_changed(FALSE),
   item_starts(NULL), item_ends(NULL), item_execute_at(NULL),
   starts_null(TRUE), ends_null(TRUE), execute_at_null(TRUE),
   item_expression(NULL), expression(0)
@@ -142,6 +141,7 @@ Event_parse_data::check_if_in_the_past(T
   else if (status == Event_parse_data::ENABLED)
   {
     status= Event_parse_data::DISABLED;
+    status_changed= true;
     push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
                  ER_EVENT_EXEC_TIME_IN_THE_PAST,
                  ER(ER_EVENT_EXEC_TIME_IN_THE_PAST));
@@ -571,7 +571,10 @@ void Event_parse_data::check_originator_
     DBUG_PRINT("info", ("Invoked object status set to SLAVESIDE_DISABLED."));
     if ((status == Event_parse_data::ENABLED) ||
         (status == Event_parse_data::DISABLED))
-      status = Event_parse_data::SLAVESIDE_DISABLED;
+    {
+      status= Event_parse_data::SLAVESIDE_DISABLED;
+      status_changed= true;
+    }
     originator = thd->server_id;
   }
   else

=== modified file 'sql/event_parse_data.h'
--- a/sql/event_parse_data.h	2010-03-31 14:05:33 +0000
+++ b/sql/event_parse_data.h	2011-06-09 17:07:03 +0000
@@ -55,6 +55,7 @@ public:
 
   int on_completion;
   int status;
+  bool status_changed;
   longlong originator;
   /*
     do_not_create will be set if STARTS time is in the past and

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2011-05-12 05:23:16 +0000
+++ b/sql/sql_yacc.yy	2011-06-09 17:07:03 +0000
@@ -2227,16 +2227,19 @@ opt_ev_status:
         | ENABLE_SYM
           {
             Lex->event_parse_data->status= Event_parse_data::ENABLED;
+            Lex->event_parse_data->status_changed= true;
             $$= 1;
           }
         | DISABLE_SYM ON SLAVE
           {
             Lex->event_parse_data->status= Event_parse_data::SLAVESIDE_DISABLED;
+            Lex->event_parse_data->status_changed= true; 
             $$= 1;
           }
         | DISABLE_SYM
           {
             Lex->event_parse_data->status= Event_parse_data::DISABLED;
+            Lex->event_parse_data->status_changed= true;
             $$= 1;
           }
         ;


Attachment: [text/bzr-bundle] bzr/dmitry.shulga@oracle.com-20110609170703-lniwsmcv42pnjdij.bundle
Thread
bzr push into mysql-5.5 branch (Dmitry.Shulga:3434 to 3435) Bug#11764334Dmitry Shulga9 Jun