THE EVENT STATUS.
Any ALTER EVENT statement on a disabled event enabled it back
(unless this ALTER EVENT statement explicitly disabled the event).
The problem was that during processing of an ALTER EVENT statement
value of status field was overwritten unconditionally even if new
value was not specified explicitly. As a consequence this field
was set to default value for status which corresponds to ENABLE.
The solution is to check if status field was explicitly specified in
ALTER EVENT statement before assigning new value to status field.
mysql-test/r/events_bugs.result:
test's result for Bug#11764334 was added.
mysql-test/t/events_bugs.test:
new test for Bug#11764334 was added.
sql/event_db_repository.cc:
mysql_event_fill_row() was modified: set value for status field
in events tables only in case if statement CREATE EVENT
is being processed or if this value was set in ALTER EVENT
statement.
Event_db_repository::create_event was modified: removed redundant
setting of status field after return from call to mysql_event_fill_row().
sql/event_parse_data.h:
Event_parse_data structure was modified: added flag
status_changed that is set to true if status's value
was changed in ALTER EVENT statement.
sql/sql_yacc.yy:
Set flag status_changed if status was set in ALTER EVENT
statement.
Fix some bugs where we stored values other than 0 or 1 in my_bool
Fixed some compiler warnings
client/mysql.cc:
Changed interrupted_query from my_bool to int, as we stored 2 in it.
client/mysqladmin.cc:
Changed return variable type to same type as function value type
client/mysqltest.cc:
Changed 'found' to int as we store other values than 0 or 1 into it
Changed type for parameter of set_reconnect() to match usage.
extra/libevent/evbuffer.c:
Added __attribute__((unused))
extra/libevent/event.c:
Added __attribute__((unused))
extra/libevent/signal.c:
Added __attribute__((unused))
sql/event_data_objects.h:
my_bool -> bool
sql/event_db_repository.cc:
my_bool -> bool
sql/event_db_repository.h:
my_bool -> bool
sql/event_parse_data.h:
my_bool -> bool
sql/events.cc:
my_bool -> bool
sql/events.h:
my_bool -> bool
sql/field.cc:
my_bool -> bool
sql/field.h:
my_bool -> bool
sql/hash_filo.h:
my_bool -> bool
sql/item.cc:
my_bool -> bool
sql/item.h:
my_bool -> bool
sql/item_cmpfunc.h:
my_bool -> bool
Changed result_for_null_param from my_bool to int as we stored -1 in it.
sql/item_func.cc:
my_bool -> bool
Modified udf wrapper functions so that the UDF functions would continue to use my_bool. (To keep compatibility with UDF:s)
sql/item_func.h:
my_bool -> bool
sql/item_subselect.h:
my_bool -> bool
sql/item_sum.cc:
Modified udf wrapper functions so that the UDF functions would continue to use my_bool. (To keep compatibility with UDF:s)
sql/parse_file.h:
my_bool -> bool
sql/rpl_mi.h:
my_bool -> bool
sql/sp_rcontext.h:
my_bool -> bool
sql/sql_analyse.h:
my_bool -> bool
sql/sql_base.cc:
Change some assignments so that we don't initialize bool variables with int's.
sql/sql_bitmap.h:
my_bool -> bool
sql/sql_cache.cc:
my_bool -> bool
sql/sql_cache.h:
my_bool -> bool
sql/sql_class.h:
my_bool -> bool
sql/sql_insert.cc:
Change some assignments so that we don't initialize bool variables with int's.
sql/sql_prepare.cc:
my_bool -> bool
sql/table.h:
my_bool -> bool
storage/maria/ma_check.c:
Removed duplicate assignment
strings/decimal.c:
Fixed wrong variable usage.
Don't do complex arithmetic on bool when simple works.
If [NOT] PRESERVE was not given, parser always defaulted to NOT
PRESERVE, making it impossible for the "not given = no change"
rule to work in ALTER EVENT. Leaving out the PRESERVE-clause
defaults to NOT PRESERVE on CREATE now, and to "no change" in
ALTER.
mysql-test/r/events_2.result:
show that giving no PRESERVE-clause to ALTER EVENT
results in no change. show that giving no PRESERVE-clause
to CREATE EVENT defaults to NOT PRESERVE as per the docs.
Show specifically that this is also handled correctly when
trying to ALTER EVENTs into the past.
mysql-test/t/events_2.test:
show that giving no PRESERVE-clause to ALTER EVENT
results in no change. show that giving no PRESERVE-clause
to CREATE EVENT defaults to NOT PRESERVE as per the docs.
Show specifically that this is also handled correctly when
trying to ALTER EVENTs into the past.
sql/event_db_repository.cc:
If ALTER EVENT was given no PRESERVE-clause (meaning "no change"),
we don't know the previous PRESERVE-setting by the time we check
the parse-data. If ALTER EVENT was given dates that are in the past,
we don't know how to react, lacking the PRESERVE-setting. Heal this
by running the check later when we have actually read the previous
EVENT-data.
sql/event_parse_data.cc:
Change default for ON COMPLETION to indicate, "not specified."
Also defer throwing errors when ALTER EVENT is given dates in
the past but not PRESERVE-clause until we know the previous
PRESERVE-value.
sql/event_parse_data.h:
Add third state for ON COMPLETION [NOT] PRESERVE (preserve,
don't, not specified).
Make check_dates() public so we can defer this check until
deeper in the callstack where we have all the required data.
sql/sql_yacc.yy:
If CREATE EVENT is not given ON COMPLETION [NOT] PRESERVE,
we default to NOT, as per the docs.
The event scheduler was not designed to work in embedded mode. This
patch disables and excludes the event scheduler when the server is
compiled for embedded build.
libmysqld/Makefile.am:
Reduce the amount of event code in an embedded build.
mysql-test/t/events_trans.test:
Disable test if run in embedded mode.
sql/Makefile.am:
Introduce definition HAVE_EVENT_SCHEDULER and one new source file.
sql/event_data_objects.cc:
Refactor Event_parse_data to new file.
sql/event_data_objects.h:
Refactor Event_parse_data to new file.
Move global definitions to new file.
sql/event_queue.cc:
Move all parsed items to Event_parse_data for easier modularization.
sql/events.cc:
Move all parsed items to Event_parse_data for easier modularization.
sql/mysqld.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/set_var.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/set_var.h:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_db.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_parse.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_show.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_test.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_yacc.yy:
Only include event-code needed for parsing to reduce impact on embedded
build.
Move all constants to Event_parse_data class.
mysql-test/r/events_embedded.result:
Add test case to make sure the 'event_scheduler' can't be activated
in embedded mode.
mysql-test/r/is_embedded.require:
Add test case to make sure the 'event_scheduler' can't be activated
in embedded mode.
mysql-test/t/events_embedded.test:
Add test case to make sure the 'event_scheduler' can't be activated
in embedded mode.
sql/event_parse_data.cc:
New file. Extracted Event_parse data into a new file.
sql/event_parse_data.h:
New file. Extracted Event_parse data into a new file.