Commit d89fc62e authored by andrey@lmy004's avatar andrey@lmy004

Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into lmy004.:/work/mysql-5.1-bug16406
parents 65dbd03b 3c82af94
...@@ -171,7 +171,7 @@ set names latin1; ...@@ -171,7 +171,7 @@ set names latin1;
CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test intact_check root@localhost RECURRING NULL 10 10 HOUR # # ENABLED events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
ALTER TABLE mysql.event ADD dummy INT FIRST; ALTER TABLE mysql.event ADD dummy INT FIRST;
SHOW EVENTS; SHOW EVENTS;
ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 17. Table probably corrupted ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 17. Table probably corrupted
...@@ -181,7 +181,7 @@ ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 17. Table ...@@ -181,7 +181,7 @@ ERROR HY000: Column count of mysql.event is wrong. Expected 16, found 17. Table
ALTER TABLE mysql.event DROP dummy2; ALTER TABLE mysql.event DROP dummy2;
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test intact_check root@localhost RECURRING NULL 10 10 HOUR # # ENABLED events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
CREATE TABLE event_like LIKE mysql.event; CREATE TABLE event_like LIKE mysql.event;
INSERT INTO event_like SELECT * FROM mysql.event; INSERT INTO event_like SELECT * FROM mysql.event;
ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin default ''; ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin default '';
...@@ -212,7 +212,7 @@ ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin d ...@@ -212,7 +212,7 @@ ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin d
"This should work" "This should work"
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test intact_check root@localhost RECURRING NULL 10 10 HOUR # # ENABLED events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log. ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
...@@ -228,15 +228,15 @@ INSERT INTO mysql.event SELECT * FROM event_like; ...@@ -228,15 +228,15 @@ INSERT INTO mysql.event SELECT * FROM event_like;
DROP TABLE event_like; DROP TABLE event_like;
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test intact_check root@localhost RECURRING NULL 10 10 HOUR # # ENABLED events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
DROP EVENT intact_check; DROP EVENT intact_check;
create event one_event on schedule every 10 second do select 123; create event one_event on schedule every 10 second do select 123;
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event root@localhost RECURRING NULL 10 10 SECOND # # ENABLED events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events; SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost select 123 RECURRING NULL 10 10 SECOND ENABLED NOT PRESERVE NULL events_test one_event root@localhost select 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
CREATE DATABASE events_test2; CREATE DATABASE events_test2;
CREATE USER ev_test@localhost; CREATE USER ev_test@localhost;
GRANT ALL ON events_test.* to ev_test@localhost; GRANT ALL ON events_test.* to ev_test@localhost;
...@@ -270,20 +270,20 @@ create event three_event on schedule every 20 second on completion preserve comm ...@@ -270,20 +270,20 @@ create event three_event on schedule every 20 second on completion preserve comm
"Now we should see 3 events:"; "Now we should see 3 events:";
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test one_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
"This should show us only 3 events:"; "This should show us only 3 events:";
SHOW FULL EVENTS; SHOW FULL EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test one_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
"This should show us only 2 events:"; "This should show us only 2 events:";
SHOW FULL EVENTS LIKE 't%event'; SHOW FULL EVENTS LIKE 't%event';
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test three_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
"This should show us no events:"; "This should show us no events:";
SHOW FULL EVENTS FROM test LIKE '%'; SHOW FULL EVENTS FROM test LIKE '%';
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
...@@ -291,20 +291,20 @@ DROP DATABASE events_test2; ...@@ -291,20 +291,20 @@ DROP DATABASE events_test2;
"should see 1 event:"; "should see 1 event:";
SHOW EVENTS; SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event root@localhost RECURRING NULL 10 10 SECOND # # ENABLED events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
"we should see 4 events now:"; "we should see 4 events now:";
SHOW FULL EVENTS; SHOW FULL EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test one_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test three_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED events_test two_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test one_event root@localhost RECURRING NULL 10 10 SECOND # # ENABLED events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events; SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event ev_test@localhost select 123 RECURRING NULL 20 20 SECOND ENABLED NOT PRESERVE NULL events_test one_event ev_test@localhost select 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
NULL events_test three_event ev_test@localhost select 123 RECURRING NULL 20 20 SECOND ENABLED PRESERVE three event NULL events_test three_event ev_test@localhost select 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
NULL events_test two_event ev_test@localhost select 123 RECURRING NULL 20 20 SECOND ENABLED NOT PRESERVE two event NULL events_test two_event ev_test@localhost select 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test one_event root@localhost select 123 RECURRING NULL 10 10 SECOND ENABLED NOT PRESERVE NULL events_test one_event root@localhost select 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
drop event one_event; drop event one_event;
drop event two_event; drop event two_event;
drop event three_event; drop event three_event;
...@@ -383,6 +383,7 @@ show processlist; ...@@ -383,6 +383,7 @@ show processlist;
Id User Host db Command Time State Info Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist # root localhost events_test Query # NULL show processlist
# event_scheduler connecting host NULL Connect # Sleeping NULL # event_scheduler connecting host NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock("test_lock2_1", 20)
"Release the lock so the child process should finish. Hence the scheduler also" "Release the lock so the child process should finish. Hence the scheduler also"
select release_lock("test_lock2_1"); select release_lock("test_lock2_1");
release_lock("test_lock2_1") release_lock("test_lock2_1")
......
...@@ -458,10 +458,6 @@ event_reconstruct_interval_expression(String *buf, ...@@ -458,10 +458,6 @@ event_reconstruct_interval_expression(String *buf,
if (close_quote) if (close_quote)
buf->append('\''); buf->append('\'');
buf->append(' ');
LEX_STRING *ival= &interval_type_to_name[interval];
buf->append(ival->str, ival->length);
return 0; return 0;
} }
...@@ -1092,6 +1088,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock, ...@@ -1092,6 +1088,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock,
{ {
//ToDo : Add definer to the tuple (db, name) to become triple //ToDo : Add definer to the tuple (db, name) to become triple
uint i; uint i;
int ret= 0;
DBUG_ENTER("evex_remove_from_cache"); DBUG_ENTER("evex_remove_from_cache");
/* /*
...@@ -1126,6 +1123,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock, ...@@ -1126,6 +1123,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock,
DBUG_PRINT("evex_remove_from_cache", ("delete from queue")); DBUG_PRINT("evex_remove_from_cache", ("delete from queue"));
evex_queue_delete_element(&EVEX_EQ_NAME, i); evex_queue_delete_element(&EVEX_EQ_NAME, i);
// ok, we have cleaned // ok, we have cleaned
ret= 0;
goto done; goto done;
} }
} }
...@@ -1134,7 +1132,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock, ...@@ -1134,7 +1132,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock,
if (use_lock) if (use_lock)
VOID(pthread_mutex_unlock(&LOCK_event_arrays)); VOID(pthread_mutex_unlock(&LOCK_event_arrays));
DBUG_RETURN(0); DBUG_RETURN(ret);
} }
......
...@@ -985,6 +985,7 @@ event_timed::update_fields(THD *thd) ...@@ -985,6 +985,7 @@ event_timed::update_fields(THD *thd)
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
extern LEX_STRING interval_type_to_name[];
/* /*
Get SHOW CREATE EVENT as string Get SHOW CREATE EVENT as string
...@@ -1025,6 +1026,9 @@ event_timed::get_create_event(THD *thd, String *buf) ...@@ -1025,6 +1026,9 @@ event_timed::get_create_event(THD *thd, String *buf)
{ {
buf->append(STRING_WITH_LEN("EVERY ")); buf->append(STRING_WITH_LEN("EVERY "));
buf->append(expr_buf); buf->append(expr_buf);
buf->append(' ');
LEX_STRING *ival= &interval_type_to_name[interval];
buf->append(ival->str, ival->length);
} }
else else
{ {
......
...@@ -3920,6 +3920,7 @@ static interval_type get_real_interval_type(interval_type i_type) ...@@ -3920,6 +3920,7 @@ static interval_type get_real_interval_type(interval_type i_type)
return INTERVAL_SECOND; return INTERVAL_SECOND;
} }
extern LEX_STRING interval_type_to_name[];
static int static int
fill_events_copy_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table) fill_events_copy_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
...@@ -3958,14 +3959,16 @@ fill_events_copy_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table) ...@@ -3958,14 +3959,16 @@ fill_events_copy_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
//execute_at //execute_at
sch_table->field[6]->set_null(); sch_table->field[6]->set_null();
//interval_value //interval_value
sch_table->field[7]->set_notnull();
sch_table->field[7]->store((longlong) et.expression);
//interval_type //interval_type
if (event_reconstruct_interval_expression(&show_str, et.interval, if (event_reconstruct_interval_expression(&show_str, et.interval,
et.expression)) et.expression))
DBUG_RETURN(1); DBUG_RETURN(1);
sch_table->field[7]->set_notnull();
sch_table->field[7]->store(show_str.c_ptr(), show_str.length(), scs);
LEX_STRING *ival= &interval_type_to_name[et.interval];
sch_table->field[8]->set_notnull(); sch_table->field[8]->set_notnull();
sch_table->field[8]->store(show_str.c_ptr(), show_str.length(), scs); sch_table->field[8]->store(ival->str, ival->length, scs);
//starts & ends //starts & ends
sch_table->field[10]->set_notnull(); sch_table->field[10]->set_notnull();
sch_table->field[10]->store_time(&et.starts, MYSQL_TIMESTAMP_DATETIME); sch_table->field[10]->store_time(&et.starts, MYSQL_TIMESTAMP_DATETIME);
...@@ -4792,7 +4795,7 @@ ST_FIELD_INFO events_fields_info[]= ...@@ -4792,7 +4795,7 @@ ST_FIELD_INFO events_fields_info[]=
{"EVENT_BODY", 65535, MYSQL_TYPE_STRING, 0, 0, 0}, {"EVENT_BODY", 65535, MYSQL_TYPE_STRING, 0, 0, 0},
{"EVENT_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type"}, {"EVENT_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type"},
{"EXECUTE_AT", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Execute at"}, {"EXECUTE_AT", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Execute at"},
{"INTERVAL_VALUE", 11, MYSQL_TYPE_LONG, 0, 1, "Interval value"}, {"INTERVAL_VALUE", 256, MYSQL_TYPE_STRING, 0, 1, "Interval value"},
{"INTERVAL_FIELD", 18, MYSQL_TYPE_STRING, 0, 1, "Interval field"}, {"INTERVAL_FIELD", 18, MYSQL_TYPE_STRING, 0, 1, "Interval field"},
{"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 1, 0}, {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 1, 0},
{"STARTS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Starts"}, {"STARTS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Starts"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment