summaryrefslogtreecommitdiff
path: root/mysql-test/t/create.test
Commit message (Collapse)AuthorAgeFilesLines
* Merge next-mr -> next-4284.Konstantin Osipov2010-02-061-5/+4
|\ | | | | | | | | | | | | | | | | | | | | | | mysql-test/t/disabled.def: Restore disabled ssl tests: SSL certificates were updated. Disable sp_sync.test, the test case can't work in next-4284. mysql-test/t/partition_innodb.test: Disable parsing of the test case for Bug#47343, the test can not work in next-4284. mysql-test/t/ps_ddl.test: Update results (CREATE TABLE IF NOT EXISTS takes into account existence of the temporary table).
| * Auto-merge from mysql-trunk-merge.Alexander Nozdrin2010-01-271-5/+4
| |\
| | * BUG#47418 RBR fails, failure with mixup of base/temporary/view unknown2010-01-161-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'CREATE TABLE IF NOT EXISTS ... SELECT' statement were causing 'CREATE TEMPORARY TABLE ...' to be written to the binary log in row-based mode (a.k.a. RBR), when there was a temporary table with the same name. Because the 'CREATE TABLE ... SELECT' statement was executed as 'INSERT ... SELECT' into the temporary table. Since in RBR mode no other statements related to temporary tables are written into binary log, this sometimes broke replication. This patch changes behavior of 'CREATE TABLE [IF NOT EXISTS] ... SELECT ...'. it ignores existence of temporary table with the same name as table being created and is interpreted as attempt to create/insert into base table. This makes behavior of 'CREATE TABLE [IF NOT EXISTS] ... SELECT' consistent with how ordinary 'CREATE TABLE' and 'CREATE TABLE ... LIKE' behave.
* | | Backport of revno: 2617.76.2Jon Olav Hauglid2009-12-091-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #47107 assert in notify_shared_lock on incorrect CREATE TABLE , HANDLER Attempts to create a table (using CREATE TABLE, CREATE TABLE LIKE or CREATE TABLE SELECT statements) which already existed and was opened by the same connection through HANDLER statement, led to a stalled connection (for production builds of the server) or to the server being aborted due to an assertion failure (for debug builds of the server). This problem was introduced by the new implementation of a metadata locking subsystem and didn't affect earlier versions of the server. The cause of the problem was that the HANDLER was not closed by CREATE TABLE before CREATE tried to open and lock the table. Acquiring an exclusive MDL lock on the table to be created would therefore fail since HANDLER already had a shared MDL lock. This triggered an assert as the HANDLER and CREATE statements came from the same thread (self-deadlock). This patch resolves the issue by closing any open HANDLERs on tables to be created by CREATE TABLE, similar to what is already done for DROP and ALTER TABLE. Test case added to create.test.
* | | Initial import of WL#3726 "DDL locking for all metadata objects".Konstantin Osipov2009-11-301-2/+6
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of: ------------------------------------------------------------ revno: 2630.4.1 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Fri 2008-05-23 17:54:03 +0400 message: WL#3726 "DDL locking for all metadata objects". After review fixes in progress. ------------------------------------------------------------ This is the first patch in series. It transforms the metadata locking subsystem to use a dedicated module (mdl.h,cc). No significant changes in the locking protocol. The import passes the test suite with the exception of deprecated/removed 6.0 features, and MERGE tables. The latter are subject to a fix by WL#4144. Unfortunately, the original changeset comments got lost in a merge, thus this import has its own (largely insufficient) comments. This patch fixes Bug#25144 "replication / binlog with view breaks". Warning: this patch introduces an incompatible change: Under LOCK TABLES, it's no longer possible to FLUSH a table that was not locked for WRITE. Under LOCK TABLES, it's no longer possible to DROP a table or VIEW that was not locked for WRITE. ****** Backport of: ------------------------------------------------------------ revno: 2630.4.2 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Sat 2008-05-24 14:03:45 +0400 message: WL#3726 "DDL locking for all metadata objects". After review fixes in progress. ****** Backport of: ------------------------------------------------------------ revno: 2630.4.3 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Sat 2008-05-24 14:08:51 +0400 message: WL#3726 "DDL locking for all metadata objects" Fixed failing Windows builds by adding mdl.cc to the lists of files needed to build server/libmysqld on Windows. ****** Backport of: ------------------------------------------------------------ revno: 2630.4.4 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Sat 2008-05-24 21:57:58 +0400 message: WL#3726 "DDL locking for all metadata objects". Fix for assert failures in kill.test which occured when one tried to kill ALTER TABLE statement on merge table while it was waiting in wait_while_table_is_used() for other connections to close this table. These assert failures stemmed from the fact that cleanup code in this case assumed that temporary table representing new version of table was open with adding to THD::temporary_tables list while code which were opening this temporary table wasn't always fulfilling this. This patch changes code that opens new version of table to always do this linking in. It also streamlines cleanup process for cases when error occurs while we have new version of table open. ****** WL#3726 "DDL locking for all metadata objects" Add libmysqld/mdl.cc to .bzrignore. ****** Backport of: ------------------------------------------------------------ revno: 2630.4.6 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-6.0-3726-w timestamp: Sun 2008-05-25 00:33:22 +0400 message: WL#3726 "DDL locking for all metadata objects". Addition to the fix of assert failures in kill.test caused by changes for this worklog. Make sure we close the new table only once. .bzrignore: Add libmysqld/mdl.cc libmysqld/CMakeLists.txt: Added mdl.cc to the list of files needed for building of libmysqld. libmysqld/Makefile.am: Added files implementing new meta-data locking subsystem to the server. mysql-test/include/handler.inc: Use separate connection for waiting while threads performing DDL operations conflicting with open HANDLER tables reach blocked state. This is required because now we check and close tables open by HANDLER statements in this connection conflicting with DDL in another each time open_tables() is called and thus select from I_S which is used for waiting will unblock DDL operations if issued from connection with open HANDLERs. mysql-test/r/create.result: Adjusted test case after change in implementation of CREATE TABLE ... SELECT. We no longer have special check in open_table() which catches the case when we select from the table created. Instead we rely on unique_table() call which happens after opening and locking all tables. mysql-test/r/flush.result: FLUSH TABLES WITH READ LOCK can no longer happen under LOCK TABLES. Updated test accordingly. mysql-test/r/flush_table.result: Under LOCK TABLES we no longer allow to do FLUSH TABLES for tables locked for read. Updated test accordingly. mysql-test/r/handler_innodb.result: Use separate connection for waiting while threads performing DDL operations conflicting with open HANDLER tables reach blocked state. This is required because now we check and close tables open by HANDLER statements in this connection conflicting with DDL in another each time open_tables() is called and thus select from I_S which is used for waiting will unblock DDL operations if issued from connection with open HANDLERs. mysql-test/r/handler_myisam.result: Use separate connection for waiting while threads performing DDL operations conflicting with open HANDLER tables reach blocked state. This is required because now we check and close tables open by HANDLER statements in this connection conflicting with DDL in another each time open_tables() is called and thus select from I_S which is used for waiting will unblock DDL operations if issued from connection with open HANDLERs. mysql-test/r/information_schema.result: Additional test for WL#3726 "DDL locking for all metadata objects". Check that we use high-priority metadata lock requests when filling I_S tables. Rearrange tests to match 6.0 better (fewer merge conflicts). mysql-test/r/kill.result: Added tests checking that DDL and DML statements waiting for metadata locks can be interrupted by KILL command. mysql-test/r/lock.result: One no longer is allowed to do DROP VIEW under LOCK TABLES even if this view is locked by LOCK TABLES. The problem is that in such situation write locks on view are not mutually exclusive so upgrading metadata lock which is required for dropping of view will lead to deadlock. mysql-test/r/partition_column_prune.result: Update results (same results in 6.0), WL#3726 mysql-test/r/partition_pruning.result: Update results (same results in 6.0), WL#3726 mysql-test/r/ps_ddl.result: We no longer invalidate prepared CREATE TABLE ... SELECT statement if target table changes. This is OK since it is not strictly necessary. The first change is wrong, is caused by FLUSH TABLE now flushing all unused tables. This is a regression that Dmitri fixed in 6.0 in a follow up patch. mysql-test/r/sp.result: Under LOCK TABLES we no longer allow accessing views which were not explicitly locked. To access view we need to obtain metadata lock on it and doing this under LOCK TABLES may lead to deadlocks. mysql-test/r/view.result: One no longer is allowed to do DROP VIEW under LOCK TABLES even if this view is locked by LOCK TABLES. The problem is that in such situation even "write locks" on view are not mutually exclusive so upgrading metadata lock which is required for dropping of view will lead to deadlock mysql-test/r/view_grant.result: ALTER VIEW implementation was changed to open a view only after checking that user which does alter has appropriate privileges on it. This means that in case when user's privileges are insufficient for this we won't check that new view definer is the same as original one or user performing alter has SUPER privilege. Adjusted test case accordingly. mysql-test/r/view_multi.result: Added test case for bug#25144 "replication / binlog with view breaks". mysql-test/suite/rpl/t/disabled.def: Disable test for deprecated features (they don't work with new MDL). mysql-test/t/create.test: Adjusted test case after change in implementation of CREATE TABLE ... SELECT. We no longer have special check in open_table() which catches the case when we select from the table created. Instead we rely on unique_table() call which happens after opening and locking all tables. mysql-test/t/disabled.def: Disable merge.test, subject of WL#4144 mysql-test/t/flush.test: FLUSH TABLES WITH READ LOCK can no longer happen under LOCK TABLES. Updated test accordingly. mysql-test/t/flush_table.test: Under LOCK TABLES we no longer allow to do FLUSH TABLES for tables locked for read. Updated test accordingly. mysql-test/t/information_schema.test: Additional test for WL#3726 "DDL locking for all metadata objects". Check that we use high-priority metadata lock requests when filling I_S tables. Rearrange the results for easier merges with 6.0. mysql-test/t/kill.test: Added tests checking that DDL and DML statements waiting for metadata locks can be interrupted by KILL command. mysql-test/t/lock.test: One no longer is allowed to do DROP VIEW under LOCK TABLES even if this view is locked by LOCK TABLES. The problem is that in such situation write locks on view are not mutually exclusive so upgrading metadata lock which is required for dropping of view will lead to deadlock. mysql-test/t/lock_multi.test: Adjusted test case to the changes of status in various places caused by change in implementation FLUSH TABLES WITH READ LOCK, which is now takes global metadata lock before flushing tables and therefore waits on at these places. mysql-test/t/ps_ddl.test: We no longer invalidate prepared CREATE TABLE ... SELECT statement if target table changes. This is OK since it is not strictly necessary. The first change is wrong, is caused by FLUSH TABLE now flushing all unused tables. This is a regression that Dmitri fixed in 6.0 in a follow up patch. mysql-test/t/sp.test: Under LOCK TABLES we no longer allow accessing views which were not explicitly locked. To access view we need to obtain metadata lock on it and doing this under LOCK TABLES may lead to deadlocks. mysql-test/t/trigger_notembedded.test: Adjusted test case to the changes of status in various places caused by change in implementation FLUSH TABLES WITH READ LOCK, which is now takes global metadata lock before flushing tables and therefore waits on at these places. mysql-test/t/view.test: One no longer is allowed to do DROP VIEW under LOCK TABLES even if this view is locked by LOCK TABLES. The problem is that in such situation even "write locks" on view are not mutually exclusive so upgrading metadata lock which is required for dropping of view will lead to deadlock. mysql-test/t/view_grant.test: ALTER VIEW implementation was changed to open a view only after checking that user which does alter has appropriate privileges on it. This means that in case when user's privileges are insufficient for this we won't check that new view definer is the same as original one or user performing alter has SUPER privilege. Adjusted test case accordingly. mysql-test/t/view_multi.test: Added test case for bug#25144 "replication / binlog with view breaks". sql/CMakeLists.txt: Added mdl.cc to the list of files needed for building of server. sql/Makefile.am: Added files implementing new meta-data locking subsystem to the server. sql/event_db_repository.cc: Allocate metadata lock requests objects (MDL_LOCK) on execution memory root in cases when TABLE_LIST objects is also allocated there or on stack. sql/ha_ndbcluster.cc: Adjusted code to work nicely with new metadata locking subsystem. close_cached_tables() no longer has wait_for_placeholder argument. Instead of relying on this parameter and related behavior FLUSH TABLES WITH READ LOCK now takes global shared metadata lock. sql/ha_ndbcluster_binlog.cc: Adjusted code to work with new metadata locking subsystem. close_cached_tables() no longer has wait_for_placeholder argument. Instead of relying on this parameter and related behavior FLUSH TABLES WITH READ LOCK now takes global shared metadata lock. sql/handler.cc: update_frm_version(): Directly update TABLE_SHARE::mysql_version member instead of going through all TABLE instances for this table (old code was a legacy from pre-table-definition-cache days). sql/lock.cc: Use new metadata locking subsystem. Threw away most of functions related to name locking as now one is supposed to use metadata locking API instead. In lock_global_read_lock() and unlock_global_read_lock() in order to avoid problems with global read lock sneaking in at the moment when we perform FLUSH TABLES or ALTER TABLE under LOCK TABLES and when tables being reopened are protected only by metadata locks we also have to take global shared meta data lock. sql/log_event.cc: Adjusted code to work with new metadata locking subsystem. For tables open by slave thread for applying RBR events allocate memory for lock request object in the same chunk of memory as TABLE_LIST objects for them. In order to ensure that we keep these objects around until tables are open always close tables before calling Relay_log_info::clear_tables_to_lock(). Use new auxiliary Relay_log_info::slave_close_thread_tables() method to enforce this. sql/log_event_old.cc: Adjusted code to work with new metadata locking subsystem. Since for tables open by slave thread for applying RBR events memory for lock request object is allocated in the same chunk of memory as TABLE_LIST objects for them we have to ensure that we keep these objects around until tables are open. To ensure this we always close tables before calling Relay_log_info::clear_tables_to_lock(). To enfore this we use new auxiliary Relay_log_info::slave_close_thread_tables() method. sql/mdl.cc: Implemented new metadata locking subsystem and API described in WL3726 "DDL locking for all metadata objects". sql/mdl.h: Implemented new metadata locking subsystem and API described in WL3726 "DDL locking for all metadata objects". sql/mysql_priv.h: - close_thread_tables()/close_tables_for_reopen() now has one more argument which indicates that metadata locks should be released but not removed from the context in order to be used later in mdl_wait_for_locks() and tdc_wait_for_old_version(). - close_cached_table() routine is no longer public. - Thread waiting in wait_while_table_is_used() can be now killed so this function returns boolean to make caller aware of such situation. - We no longer have table cache as separate entity instead used and unused TABLE instances are linked to TABLE_SHARE objects in table definition cache. - Now third argument of open_table() is also used for requesting table repair or auto-discovery of table's new definition. So its type was changed from bool to enum. - Added tdc_open_view() function for opening view by getting its definition from disk (and table cache in future). - reopen_name_locked_table() no longer needs "link_in" argument as now we have exclusive metadata locks instead of dummy TABLE instances when this function is called. - find_locked_table() now takes head of list of TABLE instances instead of always scanning through THD::open_tables list. Also added find_write_locked_table() auxiliary. - reopen_tables(), close_cached_tables() no longer have mark_share_as_old and wait_for_placeholder arguments. Instead of relying on this parameters and related behavior FLUSH TABLES WITH READ LOCK now takes global shared metadata lock. - We no longer need drop_locked_tables() and abort_locked_tables(). - mysql_ha_rm_tables() now always assume that LOCK_open is not acquired by caller. - Added notify_thread_having_shared_lock() callback invoked by metadata locking subsystem when acquiring an exclusive lock, for each thread that has a conflicting shared metadata lock. - Introduced expel_table_from_cache() as replacement for remove_table_from_cache() (the main difference is that this new function assumes that caller follows metadata locking protocol and never waits). - Threw away most of functions related to name locking. One should use new metadata locking subsystem and API instead. sql/mysqld.cc: Got rid of call initializing/deinitializing table cache since now it is embedded into table definition cache. Added calls for initializing/ deinitializing metadata locking subsystem. sql/rpl_rli.cc: Introduced auxiliary Relay_log_info::slave_close_thread_tables() method which is used for enforcing that we always close tables open for RBR before deallocating TABLE_LIST elements and MDL_LOCK objects for them. sql/rpl_rli.h: Introduced auxiliary Relay_log_info::slave_close_thread_tables() method which is used for enforcing that we always close tables open for RBR before deallocating TABLE_LIST elements and MDL_LOCK objects for them. sql/set_var.cc: close_cached_tables() no longer has wait_for_placeholder argument. Instead of relying on this parameter and related behavior FLUSH TABLES WITH READ LOCK now takes global shared metadata lock. sql/sp_head.cc: For tables added to the statement's table list by prelocking algorithm we allocate these objects either on the same memory as corresponding table list elements or on THD::locked_tables_root (if we are building table list for LOCK TABLES). sql/sql_acl.cc: Allocate metadata lock requests objects (MDL_LOCK) on execution memory root in cases when we use stack TABLE_LIST objects to open tables. Got rid of redundant code by using unlock_locked_tables() function. sql/sql_base.cc: Changed code to use new MDL subsystem. Got rid of separate table cache. Now used and unused TABLE instances are linked to the TABLE_SHAREs in table definition cache. check_unused(): Adjusted code to the fact that we no longer have separate table cache. Removed dead code. table_def_free(): Free TABLE instances referenced from TABLE_SHARE objects before destroying table definition cache. get_table_share(): Added assert which ensures that noone will be able to access table (and its share) without acquiring some kind of metadata lock first. close_handle_and_leave_table_as_lock(): Adjusted code to the fact that TABLE instances now are linked to list in TABLE_SHARE. list_open_tables(): Changed this function to use table definition cache instead of table cache. free_cache_entry(): Unlink freed TABLE elements from the list of all TABLE instances for the table in TABLE_SHARE. kill_delayed_thread_for_table(): Added auxiliary for killing delayed insert threads for particular table. close_cached_tables(): Got rid of wait_for_refresh argument as we now rely on global shared metadata lock to prevent FLUSH WITH READ LOCK sneaking in when we are reopening tables. Heavily reworked this function to use new MDL code and not to rely on separate table cache entity. close_open_tables(): We no longer have separate table cache. close_thread_tables(): Release metadata locks after closing all tables. Added skip_mdl argument which allows us not to remove metadata lock requests from the context in case when we are going to use this requests later in mdl_wait_for_locks() and tdc_wait_for_old_versions(). close_thread_table()/close_table_for_reopen(): Since we no longer have separate table cache and all TABLE instances are linked to TABLE_SHARE objects in table definition cache we have to link/unlink TABLE object to/from appropriate lists in the share. name_lock_locked_table(): Moved redundant code to find_write_locked_table() function and adjusted code to the fact that wait_while_table_is_used() can now return with an error if our thread is killed. reopen_table_entry(): We no longer need "link_in" argument as with MDL we no longer call this function with dummy TABLE object pre-allocated and added to the THD::open_tables. Also now we add newly-open TABLE instance to the list of share's used TABLE instances. table_cache_insert_placeholder(): Got rid of name-locking legacy. lock_table_name_if_not_cached(): Moved to sql_table.cc the only place where it is used. It was also reimplemented using new MDL API. open_table(): - Reworked this function to use new MDL subsystem. - Changed code to deal with table definition cache directly instead of going through separate table cache. - Now third argument is also used for requesting table repair or auto-discovery of table's new definition. So its type was changed from bool to enum. find_locked_table()/find_write_locked_table(): Accept head of list of TABLE objects as first argument and use this list instead of always searching in THD::open_tables list. Also added auxiliary for finding write-locked locked tables. reopen_table(): Adjusted function to work with new MDL subsystem and to properly manuipulate with lists of used/unused TABLE instaces in TABLE_SHARE. reopen_tables(): Removed mark_share_as_old parameter. Instead of relying on it and related behavior FLUSH TABLES WITH READ LOCK now takes global shared metadata lock. Changed code after removing separate table cache. drop_locked_tables()/abort_locked_tables(): Got rid of functions which are no longer needed. unlock_locked_tables(): Moved this function from sql_parse.cc and changed it to release memory which was used for allocating metadata lock requests for tables open and locked by LOCK TABLES. tdc_open_view(): Intoduced function for opening a view by getting its definition from disk (and table cache in future). reopen_table_entry(): Introduced function for opening table definitions while holding exclusive metatadata lock on it. open_unireg_entry(): Got rid of this function. Most of its functionality is relocated to open_table() and open_table_fini() functions, and some of it to reopen_table_entry() and tdc_open_view(). Also code resposible for auto-repair and auto-discovery of tables was moved to separate function. open_table_entry_fini(): Introduced function which contains common actions which finalize process of TABLE object creation. auto_repair_table(): Moved code responsible for auto-repair of table being opened here. handle_failed_open_table_attempt() Moved code responsible for handling failing attempt to open table to one place (retry due to lock conflict/old version, auto-discovery and repair). open_tables(): - Flush open HANDLER tables if they have old version of if there is conflicting metadata lock against them (before this moment we had this code in open_table()). - When we open view which should be processed via derived table on the second execution of prepared statement or stored routine we still should call open_table() for it in order to obtain metadata lock on it and prepare its security context. - In cases when we discover that some special handling of failure to open table is needed call handle_failed_open_table_attempt() which handles all such scenarios. open_ltable(): Handling of various special scenarios of failure to open a table was moved to separate handle_failed_open_table_attempt() function. remove_db_from_cache(): Removed this function as it is no longer used. notify_thread_having_shared_lock(): Added callback which is invoked by MDL subsystem when acquiring an exclusive lock, for each thread that has a conflicting shared metadata lock. expel_table_from_cache(): Introduced function for removing unused TABLE instances. Unlike remove_table_from_cache() it relies on caller following MDL protocol and having appropriate locks when calling it and thus does not do any waiting if table is still in use. tdc_wait_for_old_version(): Added function which allows open_tables() to wait in cases when we discover that we should back-off due to presence of old version of table. abort_and_upgrade_lock(): Use new MDL calls. mysql_wait_completed_table(): Got rid of unused function. open_system_tables_for_read/for_update()/performance_schema_table(): Allocate MDL_LOCK objects on execution memory root in cases when TABLE_LIST objects for corresponding tables is allocated on stack. close_performance_schema_table(): Release metadata locks after closing tables. ****** Use I_P_List for free/used tables list in the table share. sql/sql_binlog.cc: Use Relay_log_info::slave_close_thread_tables() method to enforce that we always close tables open for RBR before deallocating TABLE_LIST elements and MDL_LOCK objects for them. sql/sql_class.cc: Added meta-data locking contexts as part of Open_tables_state context. Also introduced THD::locked_tables_root memory root which is to be used for allocating MDL_LOCK objects for tables in LOCK TABLES statement (end of lifetime for such objects is UNLOCK TABLES so we can't use statement or execution root for them). sql/sql_class.h: Added meta-data locking contexts as part of Open_tables_state context. Also introduced THD::locked_tables_root memory root which is to be used for allocating MDL_LOCK objects for tables in LOCK TABLES statement (end of lifetime for such objects is UNLOCK TABLES so we can't use statement or execution root for them). Note: handler_mdl_context and locked_tables_root and mdl_el_root will be removed by subsequent patches. sql/sql_db.cc: mysql_rm_db() does not really need to call remove_db_from_cache() as it drops each table in the database using mysql_rm_table_part2(), which performs all necessary operations on table (definition) cache. sql/sql_delete.cc: Use the new metadata locking API for TRUNCATE. sql/sql_handler.cc: Changed HANDLER implementation to use new metadata locking subsystem. Note that MDL_LOCK objects for HANDLER tables are allocated in the same chunk of heap memory as TABLE_LIST object for those tables. sql/sql_insert.cc: mysql_insert(): find_locked_table() now takes head of list of TABLE object as its argument instead of always scanning through THD::open_tables list. handle_delayed_insert(): Allocate metadata lock request object for table open by delayed insert thread on execution memroot. create_table_from_items(): We no longer allocate dummy TABLE objects for tables being created if they don't exist. As consequence reopen_name_locked_table() no longer has link_in argument. open_table() now has one more argument which is not relevant for temporary tables. sql/sql_parse.cc: - Moved unlock_locked_tables() routine to sql_base.cc and made available it in other files. Got rid of some redundant code by using this function. - Replaced boolean TABLE_LIST::create member with enum open_table_type member. - Use special memory root for allocating MDL_LOCK objects for tables open and locked by LOCK TABLES (these object should live till UNLOCK TABLES so we can't allocate them on statement nor execution memory root). Also properly set metadata lock upgradability attribure for those tables. - Under LOCK TABLES it is no longer allowed to flush tables which are not write-locked as this breaks metadata locking protocol and thus potentially might lead to deadlock. - Added auxiliary adjust_mdl_locks_upgradability() function. sql/sql_partition.cc: Adjusted code to the fact that reopen_tables() no longer has "mark_share_as_old" argument. Got rid of comments which are no longer true. sql/sql_plist.h: Added I_P_List template class for parametrized intrusive doubly linked lists and I_P_List_iterator for corresponding iterator. Unlike for I_List<> list elements of such list can participate in several lists. Unlike List<> such lists are doubly-linked and intrusive. sql/sql_plugin.cc: Allocate metadata lock requests objects (MDL_LOCK) on execution memory root in cases when we use stack TABLE_LIST objects to open tables. sql/sql_prepare.cc: Replaced boolean TABLE_LIST::create member with enum open_table_type member. This allows easily handle situation in which instead of opening the table we want only to take exclusive metadata lock on it. sql/sql_rename.cc: Use new metadata locking subsystem in implementation of RENAME TABLE. sql/sql_servers.cc: Allocate metadata lock requests objects (MDL_LOCK) on execution memory root in cases when we use stack TABLE_LIST objects to open tables. Got rid of redundant code by using unlock_locked_tables() function. sql/sql_show.cc: Acquire shared metadata lock when we are getting information for I_S table directly from TABLE_SHARE without doing full-blown table open. We use high priority lock request in this situation in order to avoid deadlocks. Also allocate metadata lock requests objects (MDL_LOCK) on execution memory root in cases when TABLE_LIST objects are also allocated there sql/sql_table.cc: mysql_rm_table(): Removed comment which is no longer relevant. mysql_rm_table_part2(): Now caller of mysql_ha_rm_tables() should not own LOCK_open. Adjusted code to use new metadata locking subsystem instead of name-locks. lock_table_name_if_not_cached(): Moved this function from sql_base.cc to this file and reimplemented it using metadata locking API. mysql_create_table(): Adjusted code to use new MDL API. wait_while_table_is_used(): Changed function to use new MDL subsystem. Made thread waiting in it killable (this also led to introduction of return value so caller can distinguish successful executions from situations when waiting was aborted). close_cached_tables(): Thread waiting in this function is killable now. As result it has return value for distinguishing between succes and failure. Got rid of redundant boradcast_refresh() call. prepare_for_repair(): Use MDL subsystem instead of name-locks. mysql_admin_table(): mysql_ha_rm_tables() now always assumes that caller doesn't own LOCK_open. mysql_repair_table(): We should mark all elements of table list as requiring upgradable metadata locks. mysql_create_table_like(): Use new MDL subsystem instead of name-locks. create_temporary_tables(): We don't need to obtain metadata locks when creating temporary table. mysql_fast_or_online_alter_table(): Thread waiting in wait_while_table_is_used() is now killable. mysql_alter_table(): Adjusted code to work with new MDL subsystem and to the fact that threads waiting in what_while_table_is_used() and close_cached_table() are now killable. sql/sql_test.cc: We no longer have separate table cache. TABLE instances are now associated with/linked to TABLE_SHARE objects in table definition cache. sql/sql_trigger.cc: Adjusted code to work with new metadata locking subsystem. Also reopen_tables() no longer has mark_share_as_old argument (Instead of relying on this parameter and related behavior FLUSH TABLES WITH READ LOCK now takes global shared metadata lock). sql/sql_udf.cc: Allocate metadata lock requests objects (MDL_LOCK) on execution memory root in cases when we use stack TABLE_LIST objects to open tables. sql/sql_update.cc: Adjusted code to work with new meta-data locking subsystem. sql/sql_view.cc: Added proper meta-data locking to implementations of CREATE/ALTER/DROP VIEW statements. Now we obtain exclusive meta-data lock on a view before creating/ changing/dropping it. This ensures that all concurrent statements that use this view will finish before our statement will proceed and therefore we will get correct order of statements in the binary log. Also ensure that TABLE_LIST::mdl_upgradable attribute is properly propagated for underlying tables of view. sql/table.cc: Added auxiliary alloc_mdl_locks() function for allocating metadata lock request objects for all elements of table list. sql/table.h: TABLE_SHARE: Got rid of unused members. Introduced members for storing lists of used and unused TABLE objects for this share. TABLE: Added members for linking TABLE objects into per-share lists of used and unused TABLE instances. Added member for holding pointer to metadata lock for this table. TABLE_LIST: Replaced boolean TABLE_LIST::create member with enum open_table_type member. This allows easily handle situation in which instead of opening the table we want only to take exclusive meta-data lock on it (we need this in order to handle ALTER VIEW and CREATE VIEW statements). Introduced new mdl_upgradable member for marking elements of table list for which we need to take upgradable shared metadata lock instead of plain shared metadata lock. Added pointer for holding pointer to MDL_LOCK for the table. Added auxiliary alloc_mdl_locks() function for allocating metadata lock requests objects for all elements of table list. Added auxiliary set_all_mdl_upgradable() function for marking all elements in table list as requiring upgradable metadata locks. storage/myisammrg/ha_myisammrg.cc: Allocate MDL_LOCK objects for underlying tables of MERGE table. To be reworked once Ingo pushes his patch for WL4144.
* | Bug #43054 Assertion `!table->auto_increment_field_not_null' failed when ↵Magne Mahre2009-10-151-0/+53
|/ | | | | | | | | | | | | | | | | | | | redefining trigger The 'table->auto_increment_field_not_null' flag is only valid within processing of a single row, and should be set to FALSE before navigating to the next row, or exiting the operation. This bug was caused by an SQL error occuring while executing a trigger after the flag had been set, so the normal resetting was bypassed. The table object was then returned to the table share's cache in a dirty condition. When the table object was reused, an assert caught that the flag was set. This patch explicitly clears the flag on error/abort. Backported from mysql-6.0-codebase revid: 2617.52.1
* merge mysql-5.0-bugteam to mysql-5.1-bugteamSatya B2009-09-041-0/+17
|\
| * Fix for BUG#46384 - mysqld segfault when trying to create table with same Satya B2009-09-041-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | name as existing view When trying to create a table with the same name as existing view with join, mysql server crashes. The problem is when create table is issued with the same name as view, while verifying with the existing tables, we assume that base table object is created always. In this case, since it is a view over multiple tables, we don't have the mysql derived table object. Fixed the logic which checks if there is an existing table to not to assume that table object is created when the base table is view over multiple tables. mysql-test/r/create.result: BUG#46384 - mysqld segfault when trying to create table with same name as existing view Testcase for the bug mysql-test/t/create.test: BUG#46384 - mysqld segfault when trying to create table with same name as existing view Testcase for the bug sql/sql_insert.cc: BUG#46384 - mysqld segfault when trying to create table with same name as existing view Fixed create_table_from_items() method to properly check, if the base table is a view over multiple tables.
* | Bug#45829 "CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE ↵Guilhem Bichot2009-07-291-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | accepted, does nothing": those keywords do nothing in 5.1 (they are meant for future versions, for example featuring the Maria engine) so they are here removed from the syntax. Adding those keywords to future versions when needed is: - WL#5034 "Add TRANSACTIONA=0|1 and PAGE_CHECKSUM=0|1 clauses to CREATE TABLE" - WL#5037 "New ROW_FORMAT value for CREATE TABLE: PAGE" mysql-test/r/create.result: test that syntax is not accepted mysql-test/t/create.test: test that syntax is not accepted sql/handler.cc: remove ROW_FORMAT=PAGE sql/handler.h: Mark unused objects, but I don't remove them by fear of breaking any plugin which includes this file (see also table.h) sql/lex.h: removing syntax sql/sql_show.cc: removing output of noise keywords in SHOW CREATE TABLE and INFORMATION_SCHEMA.TABLES sql/sql_table.cc: removing TRANSACTIONAL sql/sql_yacc.yy: removing syntax sql/table.cc: removing TRANSACTIONAL, PAGE_CHECKSUM. Their place in the frm file is not reclaimed, for compatibility with older 5.1. sql/table.h: Mark unused objects, but I don't remove them by fear of breaking any plugin which includes this file (and there are several engines which use the content TABLE_SHARE and thus rely on a certain binary layout of this structure).
* | merge: 5.1 -> 5.1-rplLuis Soares2009-01-231-0/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | conflicts: Text conflict in client/mysqltest.cc Text conflict in mysql-test/include/wait_until_connected_again.inc Text conflict in mysql-test/lib/mtr_report.pm Text conflict in mysql-test/mysql-test-run.pl Text conflict in mysql-test/r/events_bugs.result Text conflict in mysql-test/r/log_state.result Text conflict in mysql-test/r/myisam_data_pointer_size_func.result Text conflict in mysql-test/r/mysqlcheck.result Text conflict in mysql-test/r/query_cache.result Text conflict in mysql-test/r/status.result Text conflict in mysql-test/suite/binlog/r/binlog_index.result Text conflict in mysql-test/suite/binlog/r/binlog_innodb.result Text conflict in mysql-test/suite/rpl/r/rpl_packet.result Text conflict in mysql-test/suite/rpl/t/rpl_packet.test Text conflict in mysql-test/t/disabled.def Text conflict in mysql-test/t/events_bugs.test Text conflict in mysql-test/t/log_state.test Text conflict in mysql-test/t/myisam_data_pointer_size_func.test Text conflict in mysql-test/t/mysqlcheck.test Text conflict in mysql-test/t/query_cache.test Text conflict in mysql-test/t/rpl_init_slave_func.test Text conflict in mysql-test/t/status.test
| * | Bug#40104 regression with table names?Sergey Glukhov2008-12-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Winodws FN_DEVCHAR is ':' symbol. There is a check in mysql_create_table_no_lock() func on FN_DEVCHAR presence but this code is obsolete and unnecessary. So the fix is to remove unnecessary code. mysql-test/r/create.result: test result mysql-test/t/create.test: test case sql/sql_table.cc: On Winodws FN_DEVCHAR is ':' symbol. There is a check in mysql_create_table_no_lock() func on FN_DEVCHAR presence but this code is obsolete and unnecessary. So the fix is to remove unnecessary code.
* | | Merging 5.1 main into 5.1-rplMats Kindahl2008-10-231-0/+5
|\ \ \ | |/ /
| * | 5.0->5.1 bugteam mergeSergey Glukhov2008-10-021-0/+5
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql-test/r/create.result: automerge mysql-test/t/create.test: automerge sql/mysql_priv.h: manual merge sql/sql_parse.cc: manual merge sql/sql_yacc.yy: manual merge
| | * Bug#35924 DEFINER should be stored 'quoted' in I_SSergey Glukhov2008-10-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The '@' symbol can not be used in the host name according to rfc952. The fix: added function check_host_name(LEX_STRING *str) which checks that all symbols in host name string are valid and host name length is not more than max host name length (just moved check_string_length() function from the parser into check_host_name()). mysql-test/r/create.result: test result mysql-test/t/create.test: test case sql/mysql_priv.h: added function check_host_name(LEX_STRING *str) sql/sql_parse.cc: added function check_host_name(LEX_STRING *str) which checks that all symbols in host name string are valid and host name length is not more than max host name length(HOSTNAME_LENGTH). sql/sql_yacc.yy: using newly added function check_host_name()
* | | Merging 5.1 main into 5.1-rpl.Mats Kindahl2008-10-061-0/+18
|\ \ \ | |/ /
| * | MergeRamil Kalimullin2008-09-051-0/+18
| |\ \ | | |/
| | * Fix for bug#38821: Assert table->auto_increment_field_not_null failed Ramil Kalimullin2008-09-031-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in open_table() Problem: repeating "CREATE... ( AUTOINCREMENT) ... SELECT" may lead to an assertion failure. Fix: reset table->auto_increment_field_not_null after each record writing. mysql-test/r/create.result: Fix for bug#38821: Assert table->auto_increment_field_not_null failed in open_table() - test result. mysql-test/t/create.test: Fix for bug#38821: Assert table->auto_increment_field_not_null failed in open_table() - test case. sql/sql_insert.cc: Fix for bug#38821: Assert table->auto_increment_field_not_null failed in open_table() - reset table->auto_increment_field_not_null after writing a record for "{CREATE, INSERT}..SELECT".
* | | Merge 5.1->5.1-rplMagnus Svensson2008-05-301-11/+0
|\ \ \ | |/ / | | | | | | Fix paths and name of a few files to make it work with new mtr.pl
| * | Bug#35997 Event scheduler seems to let the server crash, if it is embedded.unknown2008-05-131-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed build failure depending on events in embedded build. mysql-test/r/create.result: Moved test with events to another test file sine embedded build doesn't support event scheduler. mysql-test/r/events_2.result: Moved test with events to another test file sine embedded build doesn't support event scheduler. mysql-test/r/sp.result: Removed 'show privileges' from test as result is depending on if event sheduler is built in. mysql-test/t/create.test: Moved test with events to another test file sine embedded build doesn't support event scheduler. mysql-test/t/events_2.test: Moved test with events to another test file sine embedded build doesn't support event scheduler. mysql-test/t/sp.test: Removed 'show privileges' from test as result is depending on if event sheduler is built in.
* | | Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-rplunknown2008-04-031-1/+73
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr BitKeeper/etc/ignore: auto-union BitKeeper/deleted/.del-rpl_row_charset.test: Auto merged CMakeLists.txt: Auto merged configure.in: Auto merged client/mysqltest.c: Auto merged mysql-test/extra/binlog_tests/blackhole.test: Auto merged mysql-test/include/commit.inc: Auto merged mysql-test/include/mix1.inc: Auto merged mysql-test/lib/mtr_report.pm: Auto merged mysql-test/r/commit_1innodb.result: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/ctype_big5.result: Auto merged mysql-test/r/drop.result: Auto merged mysql-test/r/group_by.result: Auto merged mysql-test/r/information_schema.result: Auto merged mysql-test/r/loaddata.result: Auto merged mysql-test/r/mysqlbinlog.result: Auto merged mysql-test/r/partition_error.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/r/warnings.result: Auto merged mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: Auto merged mysql-test/suite/binlog/r/binlog_stm_blackhole.result: Auto merged mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Auto merged mysql-test/suite/binlog/r/binlog_unsafe.result: Auto merged mysql-test/suite/binlog/t/binlog_unsafe.test: Auto merged mysql-test/suite/federated/federated.result: Auto merged mysql-test/suite/federated/federated.test: Auto merged mysql-test/suite/parts/r/partition_alter1_myisam.result: Auto merged mysql-test/suite/parts/r/partition_alter2_myisam.result: Auto merged mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result: Auto merged mysql-test/suite/rpl/r/rpl_row_log.result: Auto merged mysql-test/suite/rpl/r/rpl_row_log_innodb.result: Auto merged mysql-test/suite/rpl/t/disabled.def: Auto merged mysql-test/suite/rpl/t/rpl_flushlog_loop.test: Auto merged mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result: Auto merged mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/csv.test: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/distinct.test: Auto merged mysql-test/t/drop.test: Auto merged mysql-test/t/group_by.test: Auto merged mysql-test/t/innodb.test: Auto merged mysql-test/t/loaddata.test: Auto merged mysql-test/t/partition_error.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/view.test: Auto merged mysql-test/t/warnings.test: Auto merged sql/ha_ndbcluster.cc: Auto merged BitKeeper/deleted/.del-combinations: Delete: mysql-test/suite/binlog/combinations mysql-test/r/partition_not_windows.result: Use remote mysql-test/r/partition_symlink.result: Use remote mysql-test/r/symlink.result: SCCS merged mysql-test/suite/parts/inc/partition_basic.inc: SCCS merged mysql-test/suite/parts/inc/partition_check_drop.inc: Use remote mysql-test/suite/parts/inc/partition_layout_check1.inc: Use remote mysql-test/suite/parts/inc/partition_layout_check2.inc: Use remote mysql-test/suite/parts/r/partition_basic_innodb.result: Use remote mysql-test/suite/parts/r/partition_basic_myisam.result: Use remote mysql-test/suite/parts/r/partition_engine_myisam.result: Use remote mysql-test/suite/parts/t/partition_sessions.test: SCCS merged mysql-test/t/partition.test: SCCS merged mysql-test/t/partition_not_windows.test: Use remote mysql-test/t/partition_symlink.test: Use remote mysql-test/t/symlink.test: Use remote mysql-test/suite/binlog/r/binlog_multi_engine.result: Manual merge, name of binlog file changed mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test: Manual merge mysys/my_init.c: Manual merge
| * | Fix for Bug#34274: Invalid handling of 'DEFAULT 0'unknown2008-03-221-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for YEAR data type. The problem was that for some unknown reason 0 was not allowed as a default value for YEAR data type. That was coded before BK. However the Manual does not say a word about such a limitation. Also, it looks inconsistent with other data types. The fix is to allow 0 as a default value. mysql-test/r/create.result: Update result file. mysql-test/t/create.test: Add a test case for Bug#34274: Invalid handling of 'DEFAULT 0' for YEAR data type. sql/unireg.cc: Allow 0 as a default value for YEAR data type.
| * | Merge kaamos.(none):/data/src/mysql-5.1unknown2008-03-121-0/+24
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into kaamos.(none):/data/src/opt/mysql-5.1-opt client/mysql.cc: Auto merged client/mysqldump.c: Auto merged configure.in: Auto merged include/my_global.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/include/mix1.inc: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/disabled.def: Auto merged sql/filesort.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_sum.cc: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sp.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_yacc.yy: Auto merged storage/ndb/src/kernel/blocks/backup/Backup.hpp: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/r/func_time.result: Manual merge. mysql-test/r/view.result: Manual merge. mysql-test/t/view.test: Manual merge. scripts/mysql_config.sh: Manual merge. sql-common/client.c: Manual merge. sql/sql_parse.cc: Manual merge.
| | * \ Merge kaamos.(none):/data/src/mysql-5.1unknown2008-02-171-0/+24
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into kaamos.(none):/data/src/opt/mysql-5.1-opt libmysqld/lib_sql.cc: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/variables.result: Auto merged BitKeeper/deleted/.del-rpl_ndb_charset.result: Auto merged BitKeeper/deleted/.del-rpl_row_charset.result: Auto merged BitKeeper/deleted/.del-rpl_row_charset.test: Auto merged BitKeeper/deleted/.del-rpl_row_charset_innodb.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/variables.test: Auto merged sql/field.cc: Auto merged sql/filesort.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/mysqld.cc: Auto merged sql/sql_acl.cc: Auto merged sql/share/errmsg.txt: Auto merged sql/sql_select.cc: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/lib/mtr_report.pl: Manual merge. mysql-test/r/sp.result: Manual merge.
| | | * \ Merge mbp.local:/Users/kaa/src/opt/bug25162/my50-bug25162unknown2008-02-011-0/+24
| | | |\ \ | | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into mbp.local:/Users/kaa/src/opt/bug25162/my51-bug25162 mysql-test/t/create.test: Auto merged sql/sql_yacc.yy: Null merge. mysql-test/r/create.result: Manual merge.
| | | | * Fix for bug #25162: Backing up DB from 5.1 adds 'USING BTREE' to KEYs unknown2008-02-011-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on table creates The problem was in incompatible syntax for key definition in CREATE TABLE. 5.0 supports only the following syntax for key definition (see "CREATE TABLE syntax" in the manual): {INDEX|KEY} [index_name] [index_type] (index_col_name,...) While 5.1 parser supports the above syntax, the "preferred" syntax was changed to: {INDEX|KEY} [index_name] (index_col_name,...) [index_type] The above syntax is used in 5.1 for the SHOW CREATE TABLE output, which led to dumps generated by 5.1 being incompatible with 5.0. Fixed by changing the parser in 5.0 to support both 5.0 and 5.1 syntax for key definition. mysql-test/r/create.result: Added a test case for bug #25162. mysql-test/t/create.test: Added a test case for bug #25162. sql/sql_yacc.yy: Changed the parser to support both 5.0 and 5.1 syntax for index type specification in CREATE TABLE.
| | | | * Merge gleb.loc:/home/uchum/work/bk/5.0unknown2007-07-261-0/+10
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into gleb.loc:/home/uchum/work/bk/5.0-opt mysql-test/t/create.test: Auto merged sql/field.cc: Auto merged sql/sql_base.cc: Auto merged sql/table.cc: Auto merged mysql-test/r/create.result: Merge with 5.0 (main).
* | | | | \ Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-rplunknown2008-03-251-0/+1
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr client/mysqltest.c: Auto merged configure.in: Auto merged mysql-test/extra/rpl_tests/rpl_loaddata.test: Auto merged mysql-test/extra/rpl_tests/rpl_log.test: Auto merged mysql-test/include/mix1.inc: Auto merged mysql-test/lib/mtr_report.pm: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/r/mysqlbinlog.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: Auto merged mysql-test/suite/binlog/r/binlog_stm_blackhole.result: Auto merged mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Auto merged mysql-test/suite/rpl/r/rpl_flushlog_loop.result: Auto merged mysql-test/suite/rpl/t/disabled.def: Auto merged mysql-test/suite/rpl/t/rpl_flushlog_loop.test: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/mysqldump.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/trigger.test: Auto merged mysql-test/t/view.test: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/ha_ndbcluster_binlog.cc: Auto merged mysql-test/mysql-test-run.pl: Use local mysql-test/r/type_blob.result: Manual merge mysql-test/suite/binlog/r/binlog_multi_engine.result: Manual merge mysql-test/suite/binlog/r/binlog_unsafe.result: Manual merge mysql-test/suite/binlog/t/binlog_unsafe.test: Manual merge mysql-test/suite/rpl/r/rpl_loaddata.result: Manual merge mysql-test/t/mysqlbinlog2.test: Manual merge
| * | | | | Add missing DROP TABLEunknown2008-03-141-0/+1
| |/ / / /
* | | | | A patch for Bug#18834: ALTER TABLE ADD INDEX on table withunknown2008-02-141-0/+64
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | two timestamp fields. The actual problem here was that CREATE TABLE allowed zero date as a default value for a TIMESTAMP column in NO_ZERO_DATE mode. The thing is that for TIMESTAMP date type specific rule is applied: column_name TIMESTAMP == column_name TIMESTAMP DEFAULT 0 whever for any other date data type column_name TYPE == column_name TYPE DEFAULT NULL The fix is to raise an error when we're in NO_ZERO_DATE mode and there is TIMESTAMP column w/o default value. mysql-test/r/create.result: Update result file. mysql-test/t/create.test: Test case for Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields. sql/sql_table.cc: Report an error if NO_ZERO_MODE is set and we have zero date as a default.
* | | | Fix create.test: use latin1 instead ucs2.unknown2008-02-081-1/+1
| | | |
* | | | Add a test case for Bug#21380: DEFAULT definition not alwaysunknown2008-02-061-0/+44
|/ / / | | | | | | | | | | | | | | | | | | | | | transfered by CREATE TABLE/SELECT to the new table. mysql-test/r/create.result: Update result file.
* | | Merge mysql.com:/home/gluh/MySQL/Merge/5.1unknown2007-12-131-0/+13
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/home/gluh/MySQL/Merge/5.1-opt BitKeeper/etc/ignore: auto-union client/mysql.cc: Auto merged client/mysqltest.c: Auto merged include/mysql_com.h: Auto merged libmysql/CMakeLists.txt: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/r/archive.result: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/delayed.result: Auto merged mysql-test/r/func_misc.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/merge.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/type_date.result: Auto merged mysql-test/suite/rpl/r/rpl_innodb_bug28430.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/func_misc.test: Auto merged mysql-test/t/information_schema.test: Auto merged mysql-test/t/merge.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/type_date.test: Auto merged mysql-test/t/type_datetime.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/queues.c: Auto merged sql/events.cc: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_partition.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/protocol.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_partition.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_open.c: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/lib/mtr_report.pl: manual merge mysql-test/r/myisam.result: manual merge mysql-test/r/partition.result: manual merge mysql-test/r/user_var.result: manual merge mysql-test/t/myisam.test: manual merge mysql-test/t/partition.test: manual merge mysql-test/t/user_var.test: manual merge sql/item.h: manual merge sql/item_func.cc: manual merge storage/myisammrg/ha_myisammrg.cc: manual merge
| * | | Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMAunknown2007-11-281-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | added new func mysql_create_like_schema_frm() which creates frm file based on I_S table mysql-test/r/create.result: test result mysql-test/t/create.test: test case sql/sql_table.cc: added new func mysql_create_like_schema_frm() which creates frm file based on I_S table
* | | | Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLEunknown2007-11-151-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | corrupts a MERGE table Bug 26867 - LOCK TABLES + REPAIR + merge table result in memory/cpu hogging Bug 26377 - Deadlock with MERGE and FLUSH TABLE Bug 25038 - Waiting TRUNCATE Bug 25700 - merge base tables get corrupted by optimize/analyze/repair table Bug 30275 - Merge tables: flush tables or unlock tables causes server to crash Bug 19627 - temporary merge table locking Bug 27660 - Falcon: merge table possible Bug 30273 - merge tables: Can't lock file (errno: 155) The problems were: Bug 26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table 1. A thread trying to lock a MERGE table performs busy waiting while REPAIR TABLE or a similar table administration task is ongoing on one or more of its MyISAM tables. 2. A thread trying to lock a MERGE table performs busy waiting until all threads that did REPAIR TABLE or similar table administration tasks on one or more of its MyISAM tables in LOCK TABLES segments do UNLOCK TABLES. The difference against problem #1 is that the busy waiting takes place *after* the administration task. It is terminated by UNLOCK TABLES only. 3. Two FLUSH TABLES within a LOCK TABLES segment can invalidate the lock. This does *not* require a MERGE table. The first FLUSH TABLES can be replaced by any statement that requires other threads to reopen the table. In 5.0 and 5.1 a single FLUSH TABLES can provoke the problem. Bug 26867 - LOCK TABLES + REPAIR + merge table result in memory/cpu hogging Trying DML on a MERGE table, which has a child locked and repaired by another thread, made an infinite loop in the server. Bug 26377 - Deadlock with MERGE and FLUSH TABLE Locking a MERGE table and its children in parent-child order and flushing the child deadlocked the server. Bug 25038 - Waiting TRUNCATE Truncating a MERGE child, while the MERGE table was in use, let the truncate fail instead of waiting for the table to become free. Bug 25700 - merge base tables get corrupted by optimize/analyze/repair table Repairing a child of an open MERGE table corrupted the child. It was necessary to FLUSH the child first. Bug 30275 - Merge tables: flush tables or unlock tables causes server to crash Flushing and optimizing locked MERGE children crashed the server. Bug 19627 - temporary merge table locking Use of a temporary MERGE table with non-temporary children could corrupt the children. Temporary tables are never locked. So we do now prohibit non-temporary chidlren of a temporary MERGE table. Bug 27660 - Falcon: merge table possible It was possible to create a MERGE table with non-MyISAM children. Bug 30273 - merge tables: Can't lock file (errno: 155) This was a Windows-only bug. Table administration statements sometimes failed with "Can't lock file (errno: 155)". These bugs are fixed by a new implementation of MERGE table open. When opening a MERGE table in open_tables() we do now add the child tables to the list of tables to be opened by open_tables() (the "query_list"). The children are not opened in the handler at this stage. After opening the parent, open_tables() opens each child from the now extended query_list. When the last child is opened, we remove the children from the query_list again and attach the children to the parent. This behaves similar to the old open. However it does not open the MyISAM tables directly, but grabs them from the already open children. When closing a MERGE table in close_thread_table() we detach the children only. Closing of the children is done implicitly because they are in thd->open_tables. For more detail see the comment at the top of ha_myisammrg.cc. Changed from open_ltable() to open_and_lock_tables() in all places that can be relevant for MERGE tables. The latter can handle tables added to the list on the fly. When open_ltable() was used in a loop over a list of tables, the list must be temporarily terminated after every table for open_and_lock_tables(). table_list->required_type is set to FRMTYPE_TABLE to avoid open of special tables. Handling of derived tables is suppressed. These details are handled by the new function open_n_lock_single_table(), which has nearly the same signature as open_ltable() and can replace it in most cases. In reopen_tables() some of the tables open by a thread can be closed and reopened. When a MERGE child is affected, the parent must be closed and reopened too. Closing of the parent is forced before the first child is closed. Reopen happens in the order of thd->open_tables. MERGE parents do not attach their children automatically at open. This is done after all tables are reopened. So all children are open when attaching them. Special lock handling like mysql_lock_abort() or mysql_lock_remove() needs to be suppressed for MERGE children or forwarded to the parent. This depends on the situation. In loops over all open tables one suppresses child lock handling. When a single table is touched, forwarding is done. Behavioral changes: =================== This patch changes the behavior of temporary MERGE tables. Temporary MERGE must have temporary children. The old behavior was wrong. A temporary table is not locked. Hence even non-temporary children were not locked. See Bug 19627 - temporary merge table locking. You cannot change the union list of a non-temporary MERGE table when LOCK TABLES is in effect. The following does *not* work: CREATE TABLE m1 ... ENGINE=MRG_MYISAM ...; LOCK TABLES t1 WRITE, t2 WRITE, m1 WRITE; ALTER TABLE m1 ... UNION=(t1,t2) ...; However, you can do this with a temporary MERGE table. You cannot create a MERGE table with CREATE ... SELECT, neither as a temporary MERGE table, nor as a non-temporary MERGE table. CREATE TABLE m1 ... ENGINE=MRG_MYISAM ... SELECT ...; Gives error message: table is not BASE TABLE. include/my_base.h: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added HA_EXTRA_ATTACH_CHILDREN and HA_EXTRA_DETACH_CHILDREN. include/myisammrg.h: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added element 'children_attached' to MYRG_INFO. Added declarations for myrg_parent_open(), myrg_attach_children() and myrg_detach_children() for the new MERGE table open approach. mysql-test/extra/binlog_tests/blackhole.test: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Preliminarily added new error message with a comment. mysql-test/r/create.result: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Fixed test result. mysql-test/r/delayed.result: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Moved test result from here to merge.result. mysql-test/r/merge.result: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Fixed/added test result. mysql-test/r/myisam.result: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Moved test result for bug 8306 from here to merge.result. mysql-test/suite/binlog/r/binlog_stm_blackhole.result: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Fixed test result. mysql-test/t/create.test: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Fixed error number. mysql-test/t/delayed.test: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Moved test from here to merge.test. mysql-test/t/merge.test: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Fixed test for new temporary MERGE table behavior. Exchanged error numbers by symbolic codes. Added tests. Included are tests for bugs 8306 (moved from myisam.test), 26379, 19627, 25038, 25700, 26377, 26867, 27660, 30275, and 30273. Fixed changes resulting from disabled CREATE...SELECT. Integrated tests moved from delayed.test and myisam.test to here. mysql-test/t/myisam.test: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Moved test for bug 8306 from here to merge.test. mysys/thr_lock.c: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added code to let the owner of a high priority lock (TL_WRITE_ONLY) to bypass its own lock. sql/ha_ndbcluster_binlog.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added 'thd' argument to init_tmp_table_share(). sql/handler.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added 'thd' argument to init_tmp_table_share(). sql/mysql_priv.h: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Removed declaration of check_merge_table_access(). It is now static in sql_parse.cc. Added declaration for fix_merge_after_open(). Renamed open_and_lock_tables() to open_and_lock_tables_derived() with additional parameter 'derived'. Added inline functions simple_open_n_lock_tables() and open_and_lock_tables(), which call open_and_lock_tables_derived() and add the argument for 'derived'. Added new function open_n_lock_single_table(), which can be used as an replacement for open_ltable() in most situations. Internally it calls simple_open_n_lock_tables() so hat it is appropriate for MERGE tables. Added 'thd' argument to init_tmp_table_share(). sql/slave.cc: ug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added comment. sql/sql_base.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Defined new functions add_merge_table_list(), attach_merge_children(), detach_merge_children(), and fix_merge_after_open() for the new MERGE table open approach. Added calls of the new functions to close_handle_and_leave_table_as_lock(), close_thread_tables(), close_thread_table(), unlink_open_table(), reopen_name_locked_table(), reopen_table(), drop_locked_tables(), close_temporary_table(), and open_tables() respectively. Prevented special lock handling of merge children (like mysql_lock_remove, mysql_lock_merge or mysql_lock_abort) at many places. Some of these calls are forwarded to the parent table instead. Added code to set thd->some_tables_deleted for every thread that has a table open that we are flushing. Added code for MERGE tables to unlink_open_table(). Added MERGE children to the list of unusable tables in open_table(). Added MERGE table handling to reopen_table(). Added lock handling and closing of a parent before the children in close_data_files_and_morph_locks(). Added code for re-attaching children in reopen_tables(). Added MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN to the locking flags and error reporting after mysql_lock_tables() in reopen_tables(). Added lock handling and closing of a parent before the children in close_old_data_files(). Added lock handling and detaching in drop_locked_tables(). Added code for removing the children list from the statement list to prepare for a repetition in open_tables(). Added new function open_n_lock_single_table(), which can be used as an replacement for open_ltable() in most situations. Internally it calls simple_open_n_lock_tables() so hat it is appropriate for MERGE tables. Disabled use of open_ltable() for MERGE tables. Removed function simple_open_n_lock_tables(). It is now inline declared in mysql_priv.h. Renamed open_and_lock_tables() to open_and_lock_tables_derived() with additional parameter 'derived'. open_and_lock_tables() is now inline declared in mysql_priv.h. Added a check for end-of-list in two loops in lock_tables(). Added 'thd' argument to init_tmp_table_share(). sql/sql_insert.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Changed from open_ltable() to open_n_lock_single_table() in handle_delayed_insert(). Reestablished LEX settings after lex initialization. Added 'thd' argument to init_tmp_table_share(). sql/sql_parse.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Made check_merge_table_access() a static function. Disabled use of CREATE...SELECT for MERGE tables. sql/sql_partition.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Fixed comment typo. sql/sql_select.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added 'thd' argument to init_tmp_table_share(). sql/sql_table.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Optimized use of mysql_ha_flush() in mysql_rm_table_part2(). Disabled the use of MERGE tables with prepare_for_restore() and prepare_for_repair(). Changed from open_ltable() to open_n_lock_single_table() in mysql_alter_table() and mysql_checksum_table(). Disabled change of child list under LOCK TABLES. Initialized table_list->table in mysql_recreate_table(). sql/sql_trigger.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added code for allowing CREATE TRIGGER under LOCK TABLE, to be able to test it with MERGE tables. sql/table.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added 'thd' argument to init_tmp_table_share(). Setting table_map_id from query_id in init_tmp_table_share(). Added member function TABLE::is_children_attached(). sql/table.h: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added access method get_table_def_version() to TABLE_SHARE. Added elements for MERGE tables to TABLE and TABLE_LIST. storage/myisam/ha_myisam.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added an unrelated comment to the function comment of table2myisam(). storage/myisam/ha_myisam.h: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added new member function MI_INFO::file_ptr(). storage/myisammrg/ha_myisammrg.cc: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added callback functions to support parent open and children attach of MERGE tables. Changed ha_myisammrg::open() to initialize storage engine structures and create a list of child tables only. Child tables are not opened. Added ha_myisammrg::attach_children(), which does now the main part of MERGE open. Added ha_myisammrg::detach_children(). Added calls to ::attach_children() and ::detach_children() to ::extra() on HA_EXTRA_ATTACH_CHILDREN and HA_EXTRA_DETACH_CHILDREN respectively. Added a check for matching TEMPORARY type for children against parent. Added a check for table def version. Added support for thd->open_options to attach_children(). Changed child path name generation for temporary tables so that it does nothing special for temporary tables. storage/myisammrg/ha_myisammrg.h: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added elements to class ha_myisammrg to support the new open approach. Changed empty destructor definition to a declaration. Implemented in ha_myisammrg.cc. Added declaration for methods attach_children() and detach_children(). Added definition for method table_ptr() for use with callback functions. storage/myisammrg/myrg_close.c: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Added a check to avoid closing of MyISAM tables when the child tables are not attached. Added freeing of rec_per_key_part when the child tables are not attached. storage/myisammrg/myrg_extra.c: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Some ::extra() functions and ::reset() can be called when children are detached. storage/myisammrg/myrg_open.c: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table Kept old myrg_open() for MERGE use independent from MySQL. Removed an always true condition in myrg_open(). Set children_attached for independent MERGE use in myrg_open(). Added myrg_parent_open(), myrg_attach_children(), and myrg_detach_children() for the new MERGE table open approach. mysql-test/r/merge-big.result: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table New test result mysql-test/t/merge-big.test: Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table New test case
* | | Bug#21136 CREATE TABLE SELECT within CREATE TABLE SELECT causes server crashunknown2007-09-281-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When CREATE TEMPORARY TABLE .. SELECT is invoked from a stored function which in turn is called from CREATE TABLE SELECT causes a memory leak because the inner create temporary table overrides the outter extra_lock reference when locking the table. The solution is to simply not overrride the extra_lock by only using the extra_lock for a non-temporary table lock. mysql-test/r/create.result: Add test case result for Bug#21136 mysql-test/t/create.test: Add test case for Bug#21136 sql/sql_insert.cc: For temporary tables, store the lock data within the select_create class since tmp tables contents are not replicated. For "real" tables, store the lock data in the thread extra_lock pointer.
* | | WL#4030 (Deprecate RENAME DATABASE: replace with ALTER DATABASE <name>unknown2007-09-101-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UPGRADE) Bug 17565 (RENAME DATABASE destroys events) Bug#28360 (RENAME DATABASE destroys routines) Removed the RENAME DATABASE db1 TO db2 statement. Implemented the ALTER DATABASE db UPGRADE DATA DIRECTORY NAME statement, which has the same function. client/mysqlcheck.c: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/create.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/query_cache.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/renamedb.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/sp-code.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/sp-error.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/upgrade.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/create.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/query_cache.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/renamedb.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/sp-error.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/upgrade.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/mysql_priv.h: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_lex.h: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_parse.cc: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_prepare.cc: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_yacc.yy: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_db.cc: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
* | | Merge gleb.loc:/home/uchum/work/bk/5.1unknown2007-07-261-0/+10
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into gleb.loc:/home/uchum/work/bk/5.1-opt mysql-test/r/sp.result: Auto merged mysql-test/t/create.test: Auto merged sql/field.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/table.cc: Auto merged mysql-test/r/create.result: Merge with 5.1 (main).
| * \ \ Merge gleb.loc:/home/uchum/work/bk/5.0-optunknown2007-07-261-0/+10
| |\ \ \ | | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into gleb.loc:/home/uchum/work/bk/5.1-opt mysql-test/r/having.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/having.test: Auto merged sql/field.cc: Auto merged sql/sql_select.cc: Auto merged mysql-test/include/mix1.inc: Merge with 5.0-opt. mysql-test/r/create.result: Merge with 5.0-opt. mysql-test/r/innodb_mysql.result: Merge with 5.0-opt. mysql-test/r/type_enum.result: Merge with 5.0-opt. mysql-test/t/type_enum.test: Merge with 5.0-opt. sql/filesort.cc: Merge with 5.0-opt. sql/sql_base.cc: Merge with 5.0-opt. sql/table.cc: Merge with 5.0-opt. storage/innobase/handler/ha_innodb.cc: Merge with 5.0-opt.
| | * | Bug#15130: CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT.unknown2007-07-241-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the SQL_BIG_RESULT flag is specified SELECT should store items from the select list in the filesort data and use them when sending to a client. The get_addon_fields function is responsible for creating necessary structures for that. But this function was allowed to do so only for SELECT and INSERT .. SELECT queries. This makes the SQL_BIG_RESULT useless for the CREATE .. SELECT queries. Now the get_addon_fields allows storing select list items in the filesort data for the CREATE .. SELECT queries. mysql-test/t/create.test: Added a test case for the bug#15130: CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT. mysql-test/r/create.result: Added a test case for the bug#15130: CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT. sql/filesort.cc: Bug#15130: CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT. Now the get_addon_fields allows storing select list items in the filesort data for the CREATE .. SELECT queries.
* | | | Merge bodhi.(none):/opt/local/work/mysql-5.0-runtimeunknown2007-07-191-0/+19
|\ \ \ \ | |/ / / |/| | / | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into bodhi.(none):/opt/local/work/mysql-5.1-runtime mysql-test/r/sp-prelocking.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/innodb.test: Auto merged mysql-test/t/sp-prelocking.test: Auto merged mysql-test/t/trigger.test: Auto merged sql/sql_class.h: Auto merged mysql-test/r/create.result: Use local. mysql-test/r/innodb.result: Manual merge.
| * | A fix and a test case for Bug#26104 Bug on foreign key class constructor.unknown2007-07-181-0/+19
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the typo in the constructor. Cover a semantic check that previously never worked with a test. mysql-test/r/create.result: Update results (Bug#26104) mysql-test/r/innodb.result: Update results. mysql-test/t/create.test: Add a test case for Bug#26104 Bug on foreign key class constructor mysql-test/t/innodb.test: Return a new error number (MySQL error instead of internal InnoDB error). sql/sql_class.h: A fix for Bug#26104 Bug on foreign key class constructor -- fix the typo in the constructor
* | Merge olga.mysql.com:/home/igor/mysql-5.0-optunknown2007-06-301-0/+333
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into olga.mysql.com:/home/igor/dev-opt/mysql-5.1-opt mysql-test/r/binary.result: Auto merged mysql-test/r/ctype_collate.result: Auto merged mysql-test/r/ctype_utf8.result: Auto merged mysql-test/t/binary.test: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/ctype_utf8.test: Auto merged sql/field_conv.cc: Auto merged sql/item.cc: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/sql_class.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_select.cc: Auto merged sql-common/client.c: Auto merged sql/sql_select.h: Auto merged sql/table.cc: Auto merged storage/myisam/mi_open.c: Auto merged strings/ctype-simple.c: Auto merged mysql-test/r/create.result: Manual merge. mysql-test/r/subselect.result: Manual merge. mysql-test/r/type_enum.result: Manual merge. mysql-test/t/type_enum.test: Manual merge. mysql-test/include/mix1.inc: Manual merge. mysql-test/r/innodb_mysql.result: Manual merge. mysql-test/t/subselect.test: Manual merge. sql/sql_parse.cc: Manual merge. storage/myisam/mi_key.c: Manual merge.
| * Bug #26642: create index corrupts table definition in .frmunknown2007-06-271-0/+333
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thanks to Martin Friebe for finding and submitting a fix for this bug! A table with maximum number of key segments and maximum length key name would have a corrupted .frm file, due to an incorrect calculation of the complete key length. Now the key length is computed correctly (I hope) :-) MyISAM would reject a table with the maximum number of keys and the maximum number of key segments in all keys. It would allow one less than this total maximum. Now MyISAM accepts a table defined with the maximum. (This is a very minor issue.) myisam/mi_open.c: Bug #26642: change >= to > in a comparison (i.e., error only if key_parts_in_table really is greater than MAX_KEY * MAX_KEY_SEG) mysql-test/r/create.result: Bug #26642: test case mysql-test/t/create.test: Bug #26642: test case sql/table.cc: Bug #26642: In create_frm(), fix formula for key_length; it was too small by (keys * 2) bytes
| * Fix for:unknown2007-05-111-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT with locked tables" Bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers" Bug #24738 "CREATE TABLE ... SELECT is not isolated properly" Bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when temporary table exists" Deadlock occured when one tried to execute CREATE TABLE IF NOT EXISTS ... SELECT statement under LOCK TABLES which held read lock on target table. Attempt to execute the same statement for already existing target table with triggers caused server crashes. Also concurrent execution of CREATE TABLE ... SELECT statement and other statements involving target table suffered from various races (some of which might've led to deadlocks). Finally, attempt to execute CREATE TABLE ... SELECT in case when a temporary table with same name was already present led to the insertion of data into this temporary table and creation of empty non-temporary table. All above problems stemmed from the old implementation of CREATE TABLE ... SELECT in which we created, opened and locked target table without any special protection in a separate step and not with the rest of tables used by this statement. This underminded deadlock-avoidance approach used in server and created window for races. It also excluded target table from prelocking causing problems with trigger execution. The patch solves these problems by implementing new approach to handling of CREATE TABLE ... SELECT for base tables. We try to open and lock table to be created at the same time as the rest of tables used by this statement. If such table does not exist at this moment we create and place in the table cache special placeholder for it which prevents its creation or any other usage by other threads. We still use old approach for creation of temporary tables. Also note that we decided to postpone introduction of some tests for concurrent behaviour of CREATE TABLE ... SELECT till 5.1. The main reason for this is absence in 5.0 ability to set @@debug variable at runtime, which can be circumvented only by using several test files with individual .opt files. Since the latter is likely to slowdown test-suite unnecessary we chose not to push this tests into 5.0, but run them manually for this version and later push their optimized version into 5.1 mysql-test/r/create.result: Extended test coverage for CREATE TABLE ... SELECT. In particular added tests for bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when temporary table exists" and bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT with locked tables". mysql-test/r/trigger.result: Added test case for bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers" mysql-test/t/create.test: Extended test coverage for CREATE TABLE ... SELECT. In particular added tests for bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when temporary table exists" and bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT with locked tables". mysql-test/t/trigger.test: Added test case for bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers" sql/lock.cc: Now for creation of name-lock placeholder in lock_table_name() we use auxiliary function table_cache_insert_placeholder(). sql/mysql_priv.h: Made build_table_path() function available outside of sql_table.cc file. reopen_name_locked_table() now has 3rd argument which controls linking in of table being opened into THD::open_tables (this is useful in cases when placeholder used for name-locking is already linked into this list). Added declaration of auxiliary function table_cache_insert_placeholder() which is used for creation of table placeholders for name-locking. Added declaration of table_cache_has_open_placeholder() function which can be used for checking if table cache contains an open placeholder for the table and if this placeholder was created by another thread. (This function is needed only in 5.0 where we use it in various versions of CREATE TABLE in order to protect it from concurrent CREATE TABLE ... SELECT operations for the table. Starting from 5.1 we use different approach so it is going to be removed there). Made close_old_data_files() static within sql_base.cc file. Added auxiliary drop_open_table() routine. Moved declaration of refresh_version to table.h header to make it accessible from inline methods of TABLE class. MYSQL_OPEN_IGNORE_LOCKED_TABLES flag is no longer used. Instead MYSQL_OPEN_TEMPORARY_ONLY option was added. sql/sql_base.cc: Added support for the new approach to the handling of CREATE TABLE ... SELECT for base tables. Now we try to open and lock table to be created at the same time as the rest of tables used by this statement. If such table does not exist at this moment we create and place in the table cache special placeholder for it which prevents its creation or any other usage by other threads. Note significant distinctions of this placeholder from the placeholder used for normal name-lock: 1) It is treated like open table by other name-locks so it does not allow name-lock taking operations like DROP TABLE or RENAME TABLE to proceed. 2) it is linked into THD::open_tables list and automatically removed during close_thread_tables() call. open_tables(): Implemented logic described above. To do this added auxiliary check_if_table_exists() function. Removed support for MYSQL_OPEN_IGNORE_LOCKED_TABLES option which is no longer used. Added MYSQL_OPEN_TEMPORARY_ONLY which is used to restrict search for temporary tables only. close_cached_tables()/close_thread_table()/reopen_tables()/ close_old_data_files()/table_is_used()/remove_table_from_cache(): Added support for open placeholders (note that we also use them when we need to re-open tables during flush). Added auxiliary drop_open_table() routine. reopen_name_locked_table(): Now has 3rd argument which controls linking in of table being opened into THD::open_tables (this is useful in cases when placeholder used for name-locking is already linked into this list). Added auxiliary table_cache_insert_placeholder() routine which simplifies creation of placeholders used for name-locking. Added table_cache_has_open_placeholder() function which can be used for checking if table cache contains an open placeholder for the table and if this placeholder was created by another thread. (This function is needed only in 5.0 where we use it in various versions of CREATE TABLE in order to protect it from concurrent CREATE TABLE ... SELECT operations for the table. Starting from 5.1 we use different approach so it is going to be removed there). sql/sql_handler.cc: Adjusted mysql_ha_mark_tables_for_reopen() routine to properly handle placeholders which now can be linked into open tables list. sql/sql_insert.cc: Introduced new approach to handling of base tables in CREATE TABLE ... SELECT statement. Now we try to open and lock table to be created at the same time as the rest of tables used by this statement. If such table does not exist at this moment we create and place in the table cache special placeholder for it which prevents its creation or any other usage by other threads. By doing this we avoid races which existed with previous approach in which we created, opened and locked target in separate step without any special protection. This also allows properly calculate prelocking set in cases when target table already exists and has some on insert triggers. Note that we don't employ the same approach for temporary tables (this is okay as such tables are unaffected by other threads). Changed create_table_from_items() and select_create methods to implement this approach. sql/sql_parse.cc: The new approach to handling of CREATE TABLE ... SELECT for base tables assumes that all tables (including table to be created) are opened and (or) locked at the same time. So in cases when we create base table we have to pass to open_and_lock_tables() table list which includes target table. sql/sql_prepare.cc: The new approach to handling of CREATE TABLE ... SELECT for base tables assumes that all tables (including table to be created) are opened and (or) locked at the same time. So in cases when we create base table we have to pass to open_and_lock_tables() table list which includes target table. sql/sql_table.cc: Now mysql_create_table_internal(), mysql_create_like_table() and mysql_alter_table() not only check that destination table doesn't exist on disk but also check that there is no create placeholder in table cache for it (i.e. there is no CREATE TABLE ... SELECT operation in progress for it). Note that starting from 5.1 we use different approach in order to to protect CREATE TABLE ... SELECT from concurrent CREATE TABLE (ALTER TABLE ... RENAME) operations, the latter simply take name-locks on table before its creation (on target table name before renaming). Also made build_table_path() available from other files and asjusted calls to reopen_name_locked_table(), which now takes extra argument, which controls linking of open table into THD::open_tables list. sql/sql_trigger.cc: reopen_name_locked_tables() now has one more argument which controls linking of opened table into the THD::open_tables list. sql/sql_yacc.yy: The new approach to handling of CREATE TABLE ... SELECT statement for base tables assumes that all tables including table to be created are open and (or) locked at the same time. Therefore we need to set correct lock for target table. sql/table.h: Moved declaration of refresh_version variable from mysql_priv.h to make it accessible from inline methods of TABLE class. Renamed TABLE::locked_by_flush member to open_placeholder since now it is also used for taking exclusive name-lock and not only by flush. Introduced TABLE::is_name_opened() helper method which can be used to distinguish TABLE instances corresponding to open tables or placeholders for them from closed instances (e.g. due to their old version). Also introduced TABLE::needs_reopen_or_name_lock() helper which allows to check if TABLE instance corresponds to outdated version of table or to name-lock placeholder. Introduced TABLE_LIST::create member which marks elements of table list corresponds to the table to be created. Adjusted TABLE_LIST::placeholder() method to take into account name-lock placeholders for tables to be created (this, for example, allows to properly handle such placeholders in lock_tables()).
* | Bug #28842 Different 'duplicate key' error code between 5.0 and 5.1unknown2007-06-061-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch for WL 1563 added a new duplicate key error message so that the key name could be provided instead of the key number. But the error code for the new message was used even though that did not need to change. This could cause unnecessary problems for applications that used the old ER_DUP_ENTRY error code to detect duplicate key errors. mysql-test/t/auto_increment.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/create.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/create_select_tmp.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ctype_ucs2_def.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ctype_utf8.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/delayed.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/heap.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/heap_btree.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/heap_hash.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/innodb.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/insert_select.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/insert_update.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/join_outer.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/key.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/merge.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/myisam.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_basic.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_charset.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_index_unique.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_insert.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_replace.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_update.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/replace.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/rpl_err_ignoredtable.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/rpl_ndb_do_table.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/rpl_row_create_table.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/rpl_sp.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/show_check.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/sp-error.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/sp.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/sp_trans.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/sp_trans_log.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/temp_table.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_binary.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_bit.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_bit_innodb.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_blob.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_varchar.test: Update ER_DUP_ENTRY-related error message values mysql-test/r/create.result: Update ER_DUP_ENTRY-related error message values mysql-test/r/rpl_sp.result: Update ER_DUP_ENTRY-related error message values mysql-test/r/sp.result: Update ER_DUP_ENTRY-related error message values mysql-test/include/mix1.inc: Update ER_DUP_ENTRY-related error message values mysql-test/include/mix2.inc: Update ER_DUP_ENTRY-related error message values mysql-test/include/ps_modify.inc: Update ER_DUP_ENTRY-related error message values mysql-test/include/query_cache.inc: Update ER_DUP_ENTRY-related error message values mysql-test/include/varchar.inc: Update ER_DUP_ENTRY-related error message values mysql-test/extra/binlog_tests/insert_select-binlog.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_auto_increment.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_foreign_key.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_insert_delayed.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_insert_id.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_insert_id_pk.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_loaddata.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_row_basic.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_trig004.test: Update ER_DUP_ENTRY-related error message values sql/handler.cc: Restore use of ER_DUP_ENTRY error code even when ER_DUP_ENTRY_WITH_KEY_NAME error message is being used. (Bug #28842)
* | 5.1 version of fix for:unknown2007-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #23667 "CREATE TABLE LIKE is not isolated from alteration by other connections" Bug #18950 "CREATE TABLE LIKE does not obtain LOCK_open" As well as: Bug #25578 "CREATE TABLE LIKE does not require any privileges on source table". The first and the second bugs resulted in various errors and wrong binary log order when one tried to execute concurrently CREATE TABLE LIKE statement and DDL statements on source table or DML/DDL statements on its target table. The problem was caused by incomplete protection/table-locking against concurrent statements implemented in mysql_create_like_table() routine. We solve it by simply implementing such protection in proper way. Most of actual work for 5.1 was already done by fix for bug 20662 and preliminary patch changing locking in ALTER TABLE. The third bug allowed user who didn't have any privileges on table create its copy and therefore circumvent privilege check for SHOW CREATE TABLE. This patch solves this problem by adding privilege check, which was missing. Finally it also removes some duplicated code from mysql_create_like_table() and thus fixes bug #26869 "TABLE_LIST::table_name_length inconsistent with TABLE_LIST::table_name". mysql-test/r/create-big.result: Added test coverage for concurrency-related issues with CREATE TABLE LIKE. mysql-test/r/create.result: Adjusted error-code in the test case after refactoring code that implements CREATE TABLE ... LIKE. mysql-test/r/grant2.result: Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges on source table". mysql-test/t/create-big.test: Added test coverage for concurrency-related issues with CREATE TABLE LIKE. mysql-test/t/create.test: Adjusted error-code in the test case after refactoring code that implements CREATE TABLE ... LIKE. mysql-test/t/disabled.def: Recent code changes ensured that CREATE TABLE LIKE statement is properly isolated against other statements, so synchronization.test should no longer fail (see fix for bug 20662 and preliminary patch for bug 23667 changing ALTER TABLE locking). mysql-test/t/grant2.test: Added test for bug#25578 "CREATE TABLE LIKE does not require any privileges on source table". sql/handler.h: Introduced new flag for HA_CREATE_INFO::options in order to be able to distinguish CREATE TABLE ... LIKE from other types of CREATE TABLE. sql/mysql_priv.h: mysql_create_like_table() now takes source table name not as a Table_ident object but as regular table list element. sql/sql_lex.h: Removed LEX::like_name member. Now we use special flag in LEX::create_info::options for distinguishing CREATE TABLE ... LIKE from other types of CREATE TABLE and store name of source table as regular element in statement's table list. sql/sql_parse.cc: CREATE TABLE ... LIKE implementation now uses statement's table list for storing information about the source table. We also use flag in LEX::create_info.options for distinguishing it from other types of CREATE TABLE. Finally CREATE TABLE ... LIKE now requires the same privileges on the source tables as SHOW CREATE TABLE. Moved this privilege check to check_show_create_table_access() function. sql/sql_partition.cc: Now we use special flag in LEX::create_info::options for distinguishing CREATE TABLE ... LIKE from other types of CREATE TABLE and store name of source table as regular element in statement's table list. sql/sql_table.cc: mysql_create_like_table(): - Commented and cleaned-up a bit code which is responsible for achieving isolation from concurrent statements. Most of actual work was done by fix for bug 20662 and preliminary patch changing locking locking in ALTER TABLE, so here we do minor things like relaxing locking on source table (we don't need lock on it, to have it open is enough) and adjusting code to make it more friendly against code implementing I_S. - Get rid of duplicated code related to source database/table name handling. All these operations are already done in st_select_lex::add_table_to_list(), so we achieve the same effect by including source table into the statement's table list. sql/sql_yacc.yy: Now we use special flag in LEX::create_info::options for distinguishing CREATE TABLE ... LIKE from other types of CREATE TABLE and store name of source table as regular element in statement's table list.
* | Fix for:unknown2007-05-111-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT with locked tables" Bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers" Bug #24738 "CREATE TABLE ... SELECT is not isolated properly" Bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when temporary table exists" Deadlock occured when one tried to execute CREATE TABLE IF NOT EXISTS ... SELECT statement under LOCK TABLES which held read lock on target table. Attempt to execute the same statement for already existing target table with triggers caused server crashes. Also concurrent execution of CREATE TABLE ... SELECT statement and other statements involving target table suffered from various races (some of which might've led to deadlocks). Finally, attempt to execute CREATE TABLE ... SELECT in case when a temporary table with same name was already present led to the insertion of data into this temporary table and creation of empty non-temporary table. All above problems stemmed from the old implementation of CREATE TABLE ... SELECT in which we created, opened and locked target table without any special protection in a separate step and not with the rest of tables used by this statement. This underminded deadlock-avoidance approach used in server and created window for races. It also excluded target table from prelocking causing problems with trigger execution. The patch solves these problems by implementing new approach to handling of CREATE TABLE ... SELECT for base tables. We try to open and lock table to be created at the same time as the rest of tables used by this statement. If such table does not exist at this moment we create and place in the table cache special placeholder for it which prevents its creation or any other usage by other threads. We still use old approach for creation of temporary tables. Note that we have separate fix for 5.0 since there we use slightly different less intrusive approach. mysql-test/r/create.result: Extended test coverage for CREATE TABLE ... SELECT. In particular added tests for bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when temporary table exists" and bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT with locked tables". mysql-test/r/trigger.result: Added test case for bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers" mysql-test/t/create.test: Extended test coverage for CREATE TABLE ... SELECT. In particular added tests for bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when temporary table exists" and bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT with locked tables". mysql-test/t/trigger.test: Added test case for bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers" sql/lock.cc: Now for creation of name-lock placeholder lock_table_name() uses auxiliary function table_cache_insert_placeholder(). sql/mysql_priv.h: Removed declaration of non-existing build_table_path() routine. The former mysql_create_table_internal() was renamed to mysql_create_table_no_lock() and now exposed to other modules to give them opportunity of creation of tables in cases when name-lock is already obtained. reopen_name_locked_table() now has 3rd argument which controls linking in of table being opened into THD::open_tables (this is useful in cases when placeholder used for name-locking is already linked into this list). Added declaration of auxiliary function table_cache_insert_placeholder() which is used for creation of table placeholders for name-locking. Added declaration of lock_table_name_if_not_cached() which can be used to take an exclusive name-lock on table if there are no records for it in table cache. Changed signature of unlink_open_table() function to simplify its use and make it useful for table placeholders and tables that are only open. Added auxiliary drop_open_table() routine. Moved declaration of refresh_version to table.h header to make it accessible from inline methods of TABLE class. MYSQL_OPEN_IGNORE_LOCKED_TABLES flag is no longer used. Instead MYSQL_OPEN_TEMPORARY_ONLY option was added. sql/sql_base.cc: Added support for the new approach to the handling of CREATE TABLE ... SELECT for base tables. Now we try to open and lock table to be created at the same time as the rest of tables used by this statement. If such table does not exist at this moment we create and place in the table cache special placeholder for it which prevents its creation or any other usage by other threads. Note significant distinctions of this placeholder from the placeholder used for normal name-lock: 1) It is treated like open table by other name-locks so it does not allow name-lock taking operations like DROP TABLE or RENAME TABLE to proceed. 2) it is linked into THD::open_tables list and automatically removed during close_thread_tables() call open_tables(): Implemented logic described above. To do this added auxiliary check_if_table_exists() function. Removed support for MYSQL_OPEN_IGNORE_LOCKED_TABLES option which is no longer used. Added MYSQL_OPEN_TEMPORARY_ONLY which is used to restrict search for temporary tables only. close_cached_tables()/close_thread_table()/reopen_tables()/ close_old_data_files()/table_is_used()/remove_table_from_cache(): Added support for open placeholders (note that we also use them when we need to re-open tables during flush). unlink_open_table(): Changed function signature to simplify its use and to make useful for open placeholders and tables which are only open and not locked. Added auxiliary drop_open_table() routine. reopen_name_locked_table(): Now has 3rd argument which controls linking in of table being opened into THD::open_tables (this is useful in cases when placeholder used for name-locking is already linked into this list). Added auxiliary table_cache_insert_placeholder() routine which simplifies creation of placeholders used for name-locking. Added lock_table_name_if_not_cached() which can be used to take an exclusive name-lock on table if there are no records for it in table cache. sql/sql_handler.cc: Adjusted mysql_ha_mark_tables_for_reopen() routine to properly handle placeholders which now can be linked into open tables list. sql/sql_insert.cc: Introduced new approach to handling of base tables in CREATE TABLE ... SELECT statement. Now we try to open and lock table to be created at the same time as the rest of tables used by this statement. If such table does not exist at this moment we create and place in the table cache special placeholder for it which prevents its creation or any other usage by other threads. By doing this we avoid races which existed with previous approach in which we created, opened and locked target in separate step without any special protection. This also allows properly calculate prelocking set in cases when target table already exists and has some on insert triggers. Note that we don't employ the same approach for temporary tables (this is okay as such tables are unaffected by other threads). Changed create_table_from_items() and methods of select_create class to implement this approach. sql/sql_parse.cc: The new approach to handling of CREATE TABLE ... SELECT for base tables assumes that all tables (including table to be created) are opened and (or) locked at the same time. So in cases when we create base table we have to pass to open_and_lock_tables() table list which includes target table. sql/sql_prepare.cc: The new approach to handling of CREATE TABLE ... SELECT for base tables assumes that all tables (including table to be created) are opened and (or) locked at the same time. So in cases when we create base table we have to pass to open_and_lock_tables() table list which includes target table. sql/sql_table.cc: Changed mysql_create_table(), mysql_create_like_table() and mysql_alter_table() (in rename case) to obtain exclusive name-lock on the non-temporary table which is going to be created (to which we going to rename). This ensures that not only destination table doesn't exist on disk but also that there are no placeholder in table cache for it (i.e. there is no CREATE TABLE ... SELECT operation in progress for it). Note that to avoid deadlocks while taking these name-locks this code assumes that existence of any record for table in table cache (even name-lock) means that table exists. Altough such check can lead to false positives these should occur only in case of highly concurrent DDL operations on the table and should not break binary logging. Renamed mysql_create_table_internal() to mysql_create_table_no_lock() and made it accessible from other files to give them ability to create table in situation when name-lock is already obtained or not relevant. Adjusted calls to reopen_name_locked_table(), which now takes extra argument, which controls linking of open table into THD::open_tables list. Removed redundant setting of table's 'version' field before calls to close_cached_table(). This function will set it to 0 itself anyway. sql/sql_trigger.cc: reopen_name_locked_tables() now has one more argument which controls linking of opened table into the THD::open_tables list. sql/sql_yacc.yy: The new approach to handling of CREATE TABLE ... SELECT statement for base tables assumes that all tables including table to be created are open and (or) locked at the same time. Therefore we need to set correct lock for target table. sql/table.h: Moved declaration of refresh_version variable from mysql_priv.h to make it accessible from inline methods of TABLE class. Renamed TABLE::locked_by_flush member to open_placeholder since now it is also used for taking exclusive name-lock and not only by flush. Introduced TABLE::is_name_opened() helper method which can be used to distinguish TABLE instances corresponding to open tables or placeholders for them from closed instances (e.g. due to their old version). Also introduced TABLE::needs_reopen_or_name_lock() helper which allows to check if TABLE instance corresponds to outdated version of table or to name-lock placeholder. Introduced TABLE_LIST::create member which marks elements of table list corresponds to the table to be created. Adjusted TABLE_LIST::placeholder() method to take into account name-lock placeholders for tables to be created (this, for example, allows to properly handle such placeholders in lock_tables()). Finally, moved currently unused TABLE::open_next/open_prev members under ifdef NOT_YET. mysql-test/r/create_select-big.result: New BitKeeper file ``mysql-test/r/create_select-big.result'' mysql-test/t/create_select-big.test: New BitKeeper file ``mysql-test/t/create_select-big.test''
* | Merge bk@192.168.21.1:mysql-5.1-optunknown2007-04-071-0/+90
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/d2/hf/mrg/mysql-5.1-opt client/mysqldump.c: Auto merged mysql-test/r/rpl_packet.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/rpl_packet.test: Auto merged sql/field.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/sp_head.h: Auto merged sql/sql_partition.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/share/errmsg.txt: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged storage/innobase/handler/ha_innodb.cc: Auto merged mysql-test/r/create.result: SCCS merged mysql-test/t/create.test: merging mysql-test/t/disabled.def: merging sql/events.cc: merging sql/sql_parse.cc: SCCS merged
| * | Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with ↵unknown2007-04-041-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multi-byte additional fix(to satisfy Win where CreateFile func does not support the path longer than 260) mysql-test/r/create.result: Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte additional fix mysql-test/t/create.test: Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte additional fix
| * | Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with ↵unknown2007-04-031-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multi-byte client/mysqldump.c: fixed typo include/mysql_com.h: added new constants SYSTEM_CHARSET_MBMAXLEN, NAME_CHAR_LEN, USERNAME_CHAR_LENGTH increased NAME_LEN, USERNAME_LENGTH mysql-test/r/create.result: result fix mysql-test/r/grant.result: result fix mysql-test/r/mysql.result: result fix mysql-test/r/sp.result: result fix mysql-test/t/create.test: test case mysql-test/t/grant.test: test case sql/events.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/item_strfunc.h: fixed calculation of max_length sql/mysql_priv.h: check_string_length function is replaced with check_string_byte_length added new function check_string_char_length sql/sp.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/sp_head.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/sp_head.h: changed parameter of 'check_routine_name' function sql/sql_class.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/share/errmsg.txt: increased argument lengths according to new constants sql/sql_parse.cc: removed unnecessary checks added function 'check_string_char_length' sql/sql_plugin.cc: check that name is not longer than NAME_CHAR_LEN symbols sql/sql_show.cc: NAME_LEN is replaced with NAME_CHAR_LEN sql/sql_table.cc: check that key name is not longer than NAME_LEN symbols sql/sql_udf.cc: check that udf name is not longer than NAME_CHAR_LEN symbols sql/sql_yacc.yy: check that user name is not longer than USERNAME_CHAR_LENGTH symbols sql/table.cc: check that db or table or column name is not longer than NAME_LEN symbols storage/innobase/handler/ha_innodb.cc: removed unnecessary multiplication tests/mysql_client_test.c: NAME_LEN is replaced with NAME_CHAR_LEN