- fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work)
- this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements
by committing the currently open transaction before they are executed.
- this Changeset also fixes a trailing space problem since the very early days
of the internal cron
- adds sophisticated checking of whether mysql.event was tampered accidentally
or with purpose by an user.
- adds a lot of inline function documentation - documents everything left
uncodumented
- INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD
WL#1034 (Internal CRON)
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
add test cases for SHOW CREATE EVENT
add test cases where the structure of mysql.event is changed and error reporting in this case
sql/event.cc:
- do a lot more checking on mysql.event whether it's valid
introduced generic function table_check_intact() which can be used also
for checking whether a system table (mysql.*) has been tampered by user
and report an error in this case. The checking is quite strict, thus
maybe some mechanism can be added later that loosens this like some
session variable, for instance, i_am_aware_that_i_can_damage_my_data
so the table will be opened nevertheless we think that it's not valid.
- add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer)
- document a loooot. not a single function left undocumented.
sql/event.h:
- add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer)
- change get_show_create_event() to get_create_event()
- add TABLE_FIELD_W_TYPE used by table_check_intact()
- add event_timed::sql_mode so it can be used by show create event. currently
always 0, will be fixed by a patch for another bug. At least makes the code
of show create event complete.
sql/event_executor.cc:
- add evex_check_system_tables() that checks on boot and event
main thread startup that mysql.db and mysql.user tables are correct.
- document everything!
sql/event_priv.h:
remove a line
sql/event_timed.cc:
- implement SHOW CREATE EVENT
- document undocumented functions!
sql/share/errmsg.txt:
- fix an error message and add two new
sql/sql_acl.cc:
- add mysql.db table definition to use by table_check_intact()
- exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h)
sql/sql_acl.h:
- define the structure of mysql.db table
sql/sql_parse.cc:
- handle SQLCOM_SHOW_CREATE_EVENT
- end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL
statement
sql/sql_show.cc:
- remove interval_type_to_name
- use common function event_reconstruct_interval_expression()
that reconstructs the expression given at create/alter, to some
extent - interval of 2:62 MINUTE_SECOND will be reconstructed as
interval of 3:02 MINUTE_SECOND!
sql/sql_yacc.yy:
init the definer of event_timed also when doing SHOW CREATE EVENT
because it's needed for checking into mysql.event
sql/table.cc:
- remove stale code. only mysql.event should be a 'system_table'
- add table_check_intact() to check the consistency of a table.
mostly usable with mysql.xxx tables.
sql/table.h:
- export TABLE_FIELD_W_TYPE and table_check_intact() which are used for
checking the structure of a table. mostly usable for mysql.xxx tables.
WL#1034 (Internal CRON)
mysql-test/r/events.result:
fix result of t/events (post-merge fix of bug #16642)
mysql-test/r/system_mysql_db.result:
fix result(post-merge fix of bug #16642)
mysql-test/t/events.test:
fix test, use --echo instead of select, fix failing create event statement
sql/event_timed.cc:
add a bit more debug information
This bug was fixed through other patches. This test case just shows
that it is fixed.
mysql-test/r/partition_hash.result:
result block for bug #14524
mysql-test/t/partition_hash.test:
test block for bug# 14524
mysql-test/lib/init_db.sql:
Auto merged
scripts/mysql_create_system_tables.sh:
Auto merged
scripts/mysql_fix_privilege_tables.sql:
Auto merged
sql/event.cc:
Auto merged
sql/event.h:
Auto merged
sql/event_executor.cc:
Auto merged
sql/event_priv.h:
Auto merged
sql/event_timed.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/r/events.result:
manual merge
mysql-test/r/system_mysql_db.result:
manual merge
mysql-test/t/events.test:
manual merge
post-review change - use pointer instead of copy on the stack.
WL#1034 (Internal CRON)
This patch adds INFORMATION_SCHEMA.EVENTS table with the following format:
EVENT_CATALOG - MYSQL_TYPE_STRING (Always NULL)
EVENT_SCHEMA - MYSQL_TYPE_STRING (the database)
EVENT_NAME - MYSQL_TYPE_STRING (the name)
DEFINER - MYSQL_TYPE_STRING (user@host)
EVENT_BODY - MYSQL_TYPE_STRING (the body from mysql.event)
EVENT_TYPE - MYSQL_TYPE_STRING ("ONE TIME" | "RECURRING")
EXECUTE_AT - MYSQL_TYPE_TIMESTAMP (set for "ONE TIME" otherwise NULL)
INTERVAL_VALUE - MYSQL_TYPE_LONG (set for RECURRING otherwise NULL)
INTERVAL_FIELD - MYSQL_TYPE_STRING (set for RECURRING otherwise NULL)
SQL_MODE - MYSQL_TYPE_STRING (for now NULL)
STARTS - MYSQL_TYPE_TIMESTAMP (starts from mysql.event)
ENDS - MYSQL_TYPE_TIMESTAMP (ends from mysql.event)
STATUS - MYSQL_TYPE_STRING (ENABLED | DISABLED)
ON_COMPLETION - MYSQL_TYPE_STRING (NOT PRESERVE | PRESERVE)
CREATED - MYSQL_TYPE_TIMESTAMP
LAST_ALTERED - MYSQL_TYPE_TIMESTAMP
LAST_EXECUTED - MYSQL_TYPE_TIMESTAMP
EVENT_COMMENT - MYSQL_TYPE_STRING
SQL_MODE is NULL for now, because the value is still not stored in mysql.event .
Support will be added as a fix for another bug.
This patch also adds SHOW [FULL] EVENTS [FROM db] [LIKE pattern]
1. SHOW EVENTS shows always only the events on the same user,
because the PK of mysql.event is (definer, db, name) several
users may have event with the same name -> no information disclosure.
2. SHOW FULL EVENTS - shows the events (in the current db as SHOW EVENTS)
of all users. The user has to have PROCESS privilege, if not then
SHOW FULL EVENTS behave like SHOW EVENTS.
3. If [FROM db] is specified then this db is considered.
4. Event names can be filtered with LIKE pattern.
SHOW EVENTS returns table with the following columns, which are subset of
the data which is returned by SELECT * FROM I_S.EVENTS
Db
Name
Definer
Type
Execute at
Interval value
Interval field
Starts
Ends
Status
mysql-test/lib/init_db.sql:
change the PK - (definer, db, name)
quicker searches when SHOW EVENTS;
allow also different users to have events with the same name ->
no information disclosure
mysql-test/r/events.result:
result of new tests
mysql-test/r/information_schema.result:
result of new tests
mysql-test/r/information_schema_db.result:
result of new tests
mysql-test/r/system_mysql_db.result:
result of new tests
mysql-test/t/events.test:
new tests for information_schema.events
scripts/mysql_create_system_tables.sh:
change the PK of mysql.event to (definer, db, name)
scripts/mysql_fix_privilege_tables.sql:
change the PK of mysql.event to (definer, db, name)
sql/event.cc:
pass around the definer of the event because of the new PK
which is (definer, db, name). It's needed for index searching.
sql/event.h:
- make enum evex_table_field again public so it can be used
in sql_show.cc
- make created and modified ulonglong, because they should be such
- make public evex_open_event_table so it can be used in sql_show.cc
sql/event_executor.cc:
- cosmetics
sql/event_priv.h:
- moved enum evex_table_field and evex_open_event_table()
to event.h (made them therefore public)
sql/event_timed.cc:
- in event_timed::init_definer() always fill this.definer with
the concatenated value of definer_user@definer_host. Makes
later the work easier.
- pass around the definer wherever is needed for searching
(new prototype of evex_db_find_evex_aux)
sql/mysqld.cc:
- add counter for SHOW EVENTS
sql/sql_lex.h:
- register SHOW EVENTS as command
sql/sql_parse.cc:
- handle SCH_EVENTS (I_S.EVENTS like SCH_TRIGGERS)
- make additional check in case of SHOW EVENTS (check for EVENT on
the current database. if it is null check_access() gives appropriate
message back.
sql/sql_show.cc:
- add INFORMATION_SCHEMA.EVENTS and SHOW EVENTS
- I_S.EVENTS.SQL_MODE is NULL for now -> not implemented. Trudy
asked to be added so bug #16642 can be completely closed. There
is another bug report which will fix the lack of storage of
SQL_MODE during event creation.
sql/sql_yacc.yy:
- always call event_timed::init_definer() when CREATE/ALTER/DROP
EVENT but not when just compiling the body of the event because
in this case this operation is not needed, it takes memory and
CPU time and at the end the result is not used. event_timed::definer
is used only on SQLCOM_CREATE/ALTER/DROP_EVENT execution not on
statement compilation.
- add SHOW [FULL] EVENTS [FROM db] [LIKE pattern]
in case of FULL and the user has PROCESS privilege then he will see
also others' events in the current database, otherwise the output
is the same as of SHOW EVENTS. Because the events are per DB only
the events from the current database are shown. pattern is applied
against event name. FROM db is self explanatory.
sql/table.h:
add SCH_EVENTS as part of INFORMATION_SCHEMA
Final patch
-----------
This WL is about using this bitmap in all parts of the partition handler.
Thus for:
rnd_init/rnd_next
index_init/index_next and all other variants of index scans
read_range_... the various range scans implemented in the partition handler.
Also use those bitmaps in the various other calls that currently loop over all
partitions.
mysql-test/r/partition_pruning.result:
WL# 2986
New results reflecting bitmap being used to determine if a partition is to be
included
mysql-test/t/partition_pruning.test:
WL# 2986
New tests to show bitmap being used in ha_partition
sql/ha_partition.cc:
WL# 2986
Used work from 2682 and removed the partition select code.
Added do {} while loop to any iteration over partitions to now utilise
m_part_info->used_partitions bitmap to determine if a partition should be
used.
sql/ha_partition.h:
WL# 2986
Removed unused member
sql/handler.h:
WL# 2986
Removed unused member
sql/opt_range.cc:
WL# 2986
Added bitmap_clear_all to clear bitmap prior to pruning
DBUG code for testing
sql/sql_partition.cc:
WL# 2986
Changed < to <=, which fixes the problem with edge cases going awry.
mysql-test/t/disabled.def:
blobs: set_null is not enough, must also set empty buffer
sql/ha_ndbcluster.cc:
blobs: set_null is not enough, must also set empty buffer
It is ok for a partitioned table to have only 1 partition. This test is just to show that
doing the ALTER TABLE ADD PARTITION doesn't crash the server.
partition_mgm_err.result:
Added result block for test of bug #15820
partition_mgm_err.test:
Added test block for bug #15820
mysql-test/t/partition_mgm_err.test:
Added test block for bug #15820
mysql-test/r/partition_mgm_err.result:
Added result block for test of bug #15820
WL#1034 (Internal CRON)
mysql-test/lib/init_db.sql:
fix for bug #16401, varchar -> char
mysql-test/r/system_mysql_db.result:
fix the result of the test after pull (currently system_mysql_db is disabled)
WL#1034 (Internal CRON)
(not interesting for the Changelog)
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
update test after pull after comit of fix for bug 16419
WL #1034 (Internal CRON)
mysql-test/r/events.result:
update test result
mysql-test/t/events.test:
add tests
sql/event_timed.cc:
- remove stupid check of val_int()
- fix for bug #16419 (Events: can't use timestamp in the schedule)
=> don't use val_int() but only get_date() and use the date!
sql/share/errmsg.txt:
- fix an error message, one more "einen"
sql/sql_yacc.yy:
- handle new return value of event_timed::init_execute_at()
into mysql.com:/opt/local/work/mysql-5.1-merge1
mysql-test/r/ps.result:
Auto merged
mysql-test/t/ps.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/sql_select.cc:
Auto merged
Remove implicit limit for query word number.
mysql-test/r/fulltext.result:
Reoder results.
storage/myisam/ft_boolean_search.c:
Remove implicit limit for query word number. Instead compute
number of elements and allocate exactly needed memory.
/var/tmp in my path when testing data diretory. the var directory
exists in a src tree but may not exist in a different testing
build setup.
mysql-test/r/partition_mgm_err.result:
added a row insert just to make sure the data and index files are made
mysql-test/t/partition_mgm_err.test:
removed the /var/tmp path elements since there is not guarantee that
other build setups will include this path
into linux.site:/home/reggie/work/mysql-5.1-bug14354
mysql-test/r/partition_mgm_err.result:
Auto merged
sql/ha_partition.cc:
Auto merged
sql/ha_partition.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_partition.cc:
Auto merged
mysql-test/t/partition_mgm_err.test:
SCCS merged
WL#1034 (Internal CRON)
mysql-test/r/events.result:
fix results file
mysql-test/t/events.test:
change test for the fix of bug#16404
sql/lex.h:
enabled/disabled were only for events, going back to enable/disable
fix for bug#16404
sql/sql_yacc.yy:
ENABLED -> ENABLE
DISABLED -> DISABLE
fix for bug#16404 (Events: keyword is ENABLED rather than ENABLE)
into mysql.com:/home/psergey/mysql-5.1-ppruning-r5-push
mysql-test/r/binlog_row_ctype_cp932.result:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_class.cc:
Auto merged
Updated to remove ndb_dd_disk2memory
ndb_dd_disk2memory.result:
Updated results to match change to show create table for NDB tables. WL 2604
mysql-test/r/ndb_dd_disk2memory.result:
Updated results to match change to show create table for NDB tables. WL 2604
mysql-test/t/disabled.def:
Updated to remove ndb_dd_disk2memory
mysql-test/r/partition_mgm_err.result:
only the single drop table since we have disabled query logging for the create table
mysql-test/t/partition_mgm_err.test:
test for bug #14354
first make sure /tmp/bug14354 is not there, then make the dir
create a partitioned table with the partition using
/tmp/bug14354 as it's data dir
we are disabling query logging since we are using $MYSQL_TEST_DIR
and we are not certain where the tmp files will be created.
sql/ha_partition.cc:
pass partition filename with pathname into
set_up_table_before_create.
remove the path from the passed in value and then append the filename
to the data_file_name or index_file_name if those values were
specified.
sql/ha_partition.h:
added partition_name_with_path to set_up_table_before_create
sql/mysql_priv.h:
move append_file_to_dir to mysql_priv.h
sql/sql_parse.cc:
moving append_file_to_dir to mysql_priv.h
sql/sql_partition.cc:
add_keyword_string was not writing keyword value with quotes
"make test" != "mysql-test-run && mysql-test-run --ps-protocol". "make test" is what should be used;
had it been, the failure would have been noticed earlier. Putting back cxx flags I had by accident removed.
Disclaimer: 5.1-new is in a sorry state: log_tables and some ndb* fail, mysqlslap test crashes randomly in a row-based replication assertion (sql_class.cc:2207).
BUILD/SETUP.sh:
Putting back flags which I, by accident, removed during the push of row-based replication (I had removed
them in my tree because they cause tens of wrong warnings with my gcc4.0.0, and committed that by accident).
mysql-test/r/binlog_row_ctype_cp932.result:
result update (people should run "make test" now, it tests row-based replication too).
this was fixed by WL 2604
mysql-test/r/partition_mgm_err.result:
result block for bug#15523
mysql-test/t/partition_mgm_err.test:
test block for bug #15523
This bug was fixed as part of the large WL 2604 push.
mysql-test/r/partition_mgm_err.result:
results block for bug #16534
mysql-test/t/partition_mgm_err.test:
test block for bug# 16534
change status variable from have_partition_engine to have_partitioning.
mysql-test/include/have_partition.inc:
updated to use new status variable
mysql-test/r/have_partition.require:
updated to use new status variable
sql/set_var.cc:
change status variable from have_partition_engine to have_partitioning.