List:Commits« Previous MessageNext Message »
From:damien Date:October 18 2007 11:51pm
Subject:bk commit into 5.1 tree (dkatz:1.2589) BUG#31539
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of dkatz. When dkatz 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-10-18 19:51:30-04:00, dkatz@stripped +6 -0
  Bug#31539 ALTER EVENT RENAME TO... resets STATUS to 'ENABLED
  Bug#27407 Events: altering changes 'on completion preserve'
  
  To fix bugs with "alter events", added "changed" flags to Event_parse_data, so we can tell if a completion or status value has been explicitly stated in the SQL, or if it's the default settings.

  mysql-test/r/events.result@stripped, 2007-10-18 19:51:24-04:00, dkatz@stripped +18 -0
    Test cases for alter event bugs.

  mysql-test/t/events.test@stripped, 2007-10-18 19:51:24-04:00, dkatz@stripped +23 -0
    Test cases for alter event bugs.

  sql/event_data_objects.cc@stripped, 2007-10-18 19:51:25-04:00, dkatz@stripped +2 -2
    To fix "alter event" bugs, added "changed" flags to Event_parse_data, so we can tell if a completion or status value has been explicitly stated in the SQL, or if it's the default settings.

  sql/event_data_objects.h@stripped, 2007-10-18 19:51:25-04:00, dkatz@stripped +4 -0
    To fix "alter event" bugs, added "changed" flags to Event_parse_data, so we can tell if a completion or status value has been explicitly stated in the SQL, or if it's the default settings.

  sql/event_db_repository.cc@stripped, 2007-10-18 19:51:25-04:00, dkatz@stripped +7 -3
    To fix "alter event" bugs, added "changed" flags to Event_parse_data, so we can tell if a completion or status value has been explicitly stated in the SQL, or if it's the default settings.

  sql/sql_yacc.yy@stripped, 2007-10-18 19:51:25-04:00, dkatz@stripped +5 -0
    To fix "alter event" bugs, added "changed" flags to Event_parse_data, so we can tell if a completion or status value has been explicitly stated in the SQL, or if it's the default settings.

diff -Nrup a/mysql-test/r/events.result b/mysql-test/r/events.result
--- a/mysql-test/r/events.result	2007-08-31 10:49:39 -04:00
+++ b/mysql-test/r/events.result	2007-10-18 19:51:24 -04:00
@@ -517,6 +517,24 @@ create table t_16 (s1 int);
 create trigger t_16_bi before insert on t_16 for each row create event  e_16 on schedule every 1 second do set @a=5;
 ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present
 drop table t_16;
+create event e on schedule at current_timestamp on completion preserve DISABLE ON SLAVE do set @a=5;
+select event_name,on_completion,status from information_schema.events;
+event_name	on_completion	status
+e	PRESERVE	SLAVESIDE_DISABLED
+alter event e on schedule at current_timestamp;
+select event_name,on_completion,status from information_schema.events;
+event_name	on_completion	status
+e	PRESERVE	SLAVESIDE_DISABLED
+drop event e;
+create event e on schedule at current_timestamp on completion preserve DISABLE ON SLAVE do set @a=5;
+select event_name,on_completion,status from information_schema.events;
+event_name	on_completion	status
+e	PRESERVE	SLAVESIDE_DISABLED
+alter event e rename to e1;
+select event_name,on_completion,status from information_schema.events;
+event_name	on_completion	status
+e1	PRESERVE	SLAVESIDE_DISABLED
+drop event e1;
 create event white_space
 on schedule every 10 hour
 disable
diff -Nrup a/mysql-test/t/events.test b/mysql-test/t/events.test
--- a/mysql-test/t/events.test	2007-09-06 07:57:32 -04:00
+++ b/mysql-test/t/events.test	2007-10-18 19:51:24 -04:00
@@ -526,6 +526,29 @@ drop table t_16;
 ####
 
 #
+# START:  Bug#31539 ALTER EVENT RENAME TO... resets STATUS to 'ENABLED
+#         Bug#27407 Events: altering changes 'on completion preserve'
+#
+
+# make sure when we change something about an event,
+# the on_completion and status don't changed.
+create event e on schedule at current_timestamp on completion preserve DISABLE ON SLAVE do set @a=5;
+select event_name,on_completion,status from information_schema.events;
+alter event e on schedule at current_timestamp;
+select event_name,on_completion,status from information_schema.events;
+drop event e;
+
+create event e on schedule at current_timestamp on completion preserve DISABLE ON SLAVE do set @a=5;
+select event_name,on_completion,status from information_schema.events;
+alter event e rename to e1;
+select event_name,on_completion,status from information_schema.events;
+drop event e1;
+  
+#
+# END:    Bug#31539 Bug#27407
+#
+
+#
 # START: BUG #17453: Creating Event crash the server
 #
 create event white_space
diff -Nrup a/sql/event_data_objects.cc b/sql/event_data_objects.cc
--- a/sql/event_data_objects.cc	2007-08-15 11:08:40 -04:00
+++ b/sql/event_data_objects.cc	2007-10-18 19:51:25 -04:00
@@ -215,8 +215,8 @@ Event_parse_data::new_instance(THD *thd)
 */
 
 Event_parse_data::Event_parse_data()
-  :on_completion(Event_basic::ON_COMPLETION_DROP),
-  status(Event_basic::ENABLED),
+  :on_completion(Event_basic::ON_COMPLETION_DROP), on_completion_changed(FALSE),
+  status(Event_basic::ENABLED), status_changed(FALSE),
   do_not_create(FALSE),
   body_changed(FALSE),
   item_starts(NULL), item_ends(NULL), item_execute_at(NULL),
diff -Nrup a/sql/event_data_objects.h b/sql/event_data_objects.h
--- a/sql/event_data_objects.h	2007-08-15 11:08:40 -04:00
+++ b/sql/event_data_objects.h	2007-10-18 19:51:25 -04:00
@@ -206,7 +206,11 @@ class Event_parse_data : public Sql_allo
 public:
 
   int on_completion;
+  bool on_completion_changed; /* TRUE when explicitly set, FALSE when default */
+  
   int status;
+  bool status_changed; /* TRUE when explicitly set, FALSE when default */
+  
   longlong originator;
   /*
     do_not_create will be set if STARTS time is in the past and
diff -Nrup a/sql/event_db_repository.cc b/sql/event_db_repository.cc
--- a/sql/event_db_repository.cc	2007-08-25 04:43:10 -04:00
+++ b/sql/event_db_repository.cc	2007-10-18 19:51:25 -04:00
@@ -205,9 +205,13 @@ mysql_event_fill_row(THD *thd,
     goto err_truncate;
 
   /* both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull()*/
-  fields[ET_FIELD_ON_COMPLETION]->store((longlong)et->on_completion, TRUE);
-
-  fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
+  /* optional on updates */
+  if (et->on_completion_changed || !is_update)
+    fields[ET_FIELD_ON_COMPLETION]->store((longlong)et->on_completion, TRUE);
+  
+  /* optional on updates */
+  if (et->status_changed || !is_update)
+    fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
 
   fields[ET_FIELD_ORIGINATOR]->store((longlong)et->originator, TRUE);
 
diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
--- a/sql/sql_yacc.yy	2007-10-16 22:47:04 -04:00
+++ b/sql/sql_yacc.yy	2007-10-18 19:51:25 -04:00
@@ -1820,16 +1820,19 @@ opt_ev_status:
         | ENABLE_SYM
           {
             Lex->event_parse_data->status= Event_basic::ENABLED;
+            Lex->event_parse_data->status_changed= TRUE;
             $$= 1;
           }
         | DISABLE_SYM ON SLAVE
           {
             Lex->event_parse_data->status= Event_basic::SLAVESIDE_DISABLED;
+            Lex->event_parse_data->status_changed= TRUE;
             $$= 1;
           }
         | DISABLE_SYM
           {
             Lex->event_parse_data->status= Event_basic::DISABLED;
+            Lex->event_parse_data->status_changed= TRUE;
             $$= 1;
           }
         ;
@@ -1863,12 +1866,14 @@ ev_on_completion:
           {
             Lex->event_parse_data->on_completion=
                                   Event_basic::ON_COMPLETION_PRESERVE;
+            Lex->event_parse_data->on_completion_changed= TRUE;
             $$= 1;
           }
         | ON COMPLETION_SYM NOT_SYM PRESERVE_SYM
           {
             Lex->event_parse_data->on_completion=
                                   Event_basic::ON_COMPLETION_DROP;
+            Lex->event_parse_data->on_completion_changed= TRUE;
             $$= 1;
           }
         ;
Thread
bk commit into 5.1 tree (dkatz:1.2589) BUG#31539damien19 Oct
  • Re: bk commit into 5.1 tree (dkatz:1.2589) BUG#31539Marc Alff26 Oct