summaryrefslogtreecommitdiff
path: root/mysql-test/t/events_restart_phase1.test
blob: 6a94ef12222cada2cf6f334298c87babd19fcadd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
#
# Test that when the server is restarted, it checks mysql.event table,
# and disables the scheduler if it's not up to date.
#

# Switch off the scheduler for now.
set global event_scheduler=off;

--disable_warnings
drop database if exists events_test;
--enable_warnings
create database events_test;
use events_test;
create table execution_log(name char(10));

create event abc1 on schedule every 1 second do
  insert into execution_log value('abc1');
create event abc2 on schedule every 1 second do
  insert into execution_log value('abc2');
create event abc3 on schedule every 1 second do 
  insert into execution_log value('abc3');
#
# There are various conditions when a server would regard mysql.event
# table as damaged:
# - the table has more column than specified in the compiled in value, but
# the version of the server which created the table is the same
# - the column count in the table is less than the compiled in value
# - some column has an incompatible type specification (for what is an
# incompatible type specification please refer to the comments in the source
#
# Unfortunately, in order to test a condition, we need to restart the
# server. Therefore, here we test only one simple case: changing the data
# type of the 'body' field to blob.
#
# First, let's do a backup to not depend on actual definition of mysql.event
create table event_like like mysql.event;
insert into event_like select * from mysql.event;
# Now let's alter the table and restart the server
alter table mysql.event
  change column body  body longtext character set utf8 collate utf8_bin;
--echo "Now we restart the server"