summaryrefslogtreecommitdiff
path: root/storage/innobase/row/row0mysql.c
Commit message (Collapse)AuthorAgeFilesLines
* Temporary commit of merge of MariaDB 10.0-base and MySQL 5.6Michael Widenius2012-08-011-4340/+0
|
* merge mysql-5.5->mysql-5.5-securityGeorgi Kodinov2012-04-101-2/+3
|\
| * Bug#13704145: ELIMINATE LRU SCAN WHEN DROPPING A TABLEInaam Rana2012-03-261-2/+3
| | | | | | | | | | | | | | | | | | rb://942 approved by: Marko Makela We don't need to scan LRU for dropping AHI entries when DROPing a table. AHI entries are already removed when we free up extents for the btree.
* | merge mysql-5.5->mysql-5.5-securityGeorgi Kodinov2012-03-211-2/+2
|\ \ | |/
| * Fix Bug #13860722 - INCOMPLETE PERFORMANCE SCHEMA INSTRUMENTATION IN INNODBJimmy Yang2012-03-201-2/+2
| |
* | merge mysql-5.5->mysql-5.5-securityGeorgi Kodinov2012-03-081-0/+24
|\ \ | |/
| * Merge mysql-5.1 to mysql-5.5.Marko Mäkelä2012-02-281-12/+12
| |\
| * \ Merge mysql-5.1 to mysql-5.5.Marko Mäkelä2012-02-281-3/+27
| |\ \ | | |/
* | | Bug#13635833: MULTIPLE CRASHES IN FOREIGN KEY CODE WITH CONCURRENT DDL/DMLAnnamalai Gurusami2012-02-271-3/+28
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two threads. In one thread, dml operation is going on involving cascaded update operation. In another thread, alter table add foreign key constraint is happening. Under these circumstances, it is possible for the dml thread to access a dict_foreign_t object that has been freed by the ddl thread. The debug sync test case provides the sequence of operations. Without fix, the test case will crash the server (because of newly added assert). With fix, the alter table stmt will return an error message. rb:947 approved by Jimmy Yang
* | Bug#12400341 INNODB CAN LEAVE ORPHAN IBD FILES AROUNDYasufumi Kinoshita2012-01-101-0/+14
|\ \ | |/ | | | | | | | | | | If we meet DB_TOO_MANY_CONCURRENT_TRXS during the execution tab_create_graph from row_create_table_for_mysql(), .ibd file for the table should be created already but was not deleted for the error handling. rb:875 approved by Jimmy Yang
| * Bug#12400341 INNODB CAN LEAVE ORPHAN IBD FILES AROUNDYasufumi Kinoshita2012-01-101-0/+12
| | | | | | | | | | | | | | If we meet DB_TOO_MANY_CONCURRENT_TRXS during the execution tab_create_graph from row_create_table_for_mysql(), .ibd file for the table should be created already but was not deleted for the error handling. rb:875 approved by Jimmy Yang
* | Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLESVasil Dimov2011-12-291-9/+9
| | | | | | | | | | Port vasil.dimov@oracle.com-20111205082831-7v1qu50hvd9hjr3g from mysql-trunk
* | Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLESVasil Dimov2011-12-291-12/+49
| | | | | | | | | | Port vasil.dimov@oracle.com-20111205082756-wtlg8isyn4yohyny from mysql-trunk
* | Fix Bug #13405367 - 60212 SERVER CRASH WITH CORRUPT FETCH BUFFERJimmy Yang2011-11-201-4/+4
| | | | | | | | | | rb://608 approved by Sunny Bains
* | Merge mysql-5.1 to mysql-5.5.Marko Mäkelä2011-10-271-1/+2
|\ \ | |/
* | Merge mysql-5.1 -> mysql-5.5Vasil Dimov2011-09-071-10/+19
|\ \ | |/
* | Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZEMarko Mäkelä2011-09-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fix was accidentally pushed to mysql-5.1 after the 5.1.59 clone-off in bzr revision id marko.makela@oracle.com-20110829081642-z0w992a0mrc62s6w with the fix of Bug#12704861 Corruption after a crash during BLOB update but not merged to mysql-5.5 and upwards. In the Barracuda formats, the clustered index record no longer contains a prefix of off-page columns. Because of this, the undo log must contain these prefixes, so that purge and multi-versioning will continue to work. However, this also means that an undo log record can become too big to fit in an undo log page. (It is a limitation of the undo log that undo records cannot span across multiple pages.) In case the checks for undo log size fail when CREATE TABLE or CREATE INDEX is executed, we need a fallback that blocks a modification operation when the undo log record would exceed the maximum size. trx_undo_free_last_page_func(): Renamed from trx_undo_free_page_in_rollback(). Define the trx_t parameter only in debug builds. trx_undo_free_last_page(): Wrapper for trx_undo_free_last_page_func(). Pass the trx_t parameter only in debug builds. trx_undo_truncate_end_func(): Renamed from trx_undo_truncate_end(). Define the trx_t parameter only in debug builds. Rewrite a for(;;) loop as a while loop for clarity. trx_undo_truncate_end(): Wrapper for from trx_undo_truncate_end_func(). Pass the trx_t parameter only in debug builds. trx_undo_erase_page_end(): Return TRUE if the page was non-empty to begin with. Refuse to erase empty pages. trx_undo_report_row_operation(): If the page for which the undo log was too big was empty, free the undo page and return DB_TOO_BIG_RECORD. rb:749 approved by Inaam Rana
* | Fix bug #11830883, SUPPORT "CORRUPTED" BIT FOR INNODB TABLES AND INDEXES.Jimmy Yang2011-08-161-1/+2
| | | | | | | | | | | | | | Also addressed issues in bug #11745133, where we could mark a table corrupted instead of crashing the server when found a corrupted buffer/page if the table created with innodb_file_per_table on.
* | Bug#12699505 Memory leak in row_create_index_for_mysql()Marko Mäkelä2011-06-281-32/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DB_COL_APPEARS_TWICE_IN_INDEX: Remove. This condition is already checked and reported by MySQL before passing the index definition to the storage engine. row_create_index_for_mysql(): Remove the redundant check for DB_COL_APPEARS_TWICE_IN_INDEX. When enforcing the column prefix index limit, invoke dict_mem_index_free(index) to plug the memory leak. In the loop, use index->n_def instead of dict_index_get_n_fields(index), because the latter would be 0 for indexes that have not been copied to the data dictionary cache. innodb-use-sys-malloc.test: Add test cases for attempting to trigger the error checks in row_create_index_for_mysql(). Before MySQL 5.5 and WL#5743, the leak is only reproducible if ha_innobase::max_supported_key_part_length() returned a higher limit than the one used in row_create_index_for_mysql(). In MySQL 5.5 and later, the leak is reproducible with innodb_large_prefix=true. rb:688 approved by Jimmy Yang
* | Implement worklog #5743 InnoDB: Lift the limit of index key prefixes. Jimmy Yang2011-05-311-3/+8
| | | | | | | | | | | | | | | | With this change, the index prefix column length lifted from 767 bytes to 3072 bytes if "innodb_large_prefix" is set to "true". rb://603 approved by Marko
* | A non-functional change related to Bug#11830883Marko Mäkelä2011-05-091-1/+1
| | | | | | | | | | page_rec_write_field(): Renamed from page_rec_write_index_page_no() and inlined.
* | Bug 12323643 - CLEAN UP THE INNODB THREAD SHUTDOWN AND ASSERTIONS (WL#5136)Marko Mäkelä2011-04-051-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove most references to thread id in InnoDB. Three references remain: the current holder of a mutex, and the current x-lock holder of a rw-lock, and some references in UNIV_SYNC_DEBUG checks. This allows MySQL to change the thread associated to a client connection. Tighten the UNIV_SYNC_DEBUG checks, trying to ensure that no InnoDB mutex or x-lock is being held when returning control to MySQL. The only semaphore that may be held is the btr_search_latch in shared mode. sync_thread_levels_empty_except_dict(): A wrapper for sync_thread_levels_empty_gen(TRUE). sync_thread_levels_nonempty_trx(): Check that the current thread is not holding any InnoDB semaphores, except btr_search_latch if trx->has_search_latch. sync_thread_levels_empty(): Unused function; remove. trx_t: Remove mysql_thread_id and mysql_process_no. srv_slot_t: Remove id and handle. row_search_for_mysql(), srv_conc_enter_innodb(), srv_conc_force_enter_innodb(), srv_conc_force_exit_innodb(), srv_conc_exit_innodb(), srv_suspend_mysql_thread: Assert !sync_thread_levels_nonempty_trx(). rb:634 approved by Sunny Bains
* | Fix Bug #59048 truncate table or create index could leave index->pageJimmy Yang2011-02-091-3/+3
| | | | | | | | | | | | | | to be FIL_NULL rb://545 approved by Sunny Bains
* | Replay a lost change (fix for Bug#56947 InnoDB leaks memory... in 5.5)Vasil Dimov2011-02-011-6/+8
| | | | | | | | | | | | | | This change was originally done in marko.makela@oracle.com-20101011085943-50pskvsbbsujbukg but was later lost during the merge process.
* | Merge mysql-5.1-innodb -> mysql-5.5-innodbVasil Dimov2011-01-061-1/+1
|\ \ | |/
| * (Builtin InnoDB) Fix Bug#59303 Correct URL in crash messageVasil Dimov2011-01-061-1/+1
| | | | | | | | | | | | | | | | | | old URL: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html new URL: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html Notice that there is a redirect from the old URL to the new URL, so visiting the old URL does not give "page not found" error.
| * merge to 5.1-securityGeorgi Kodinov2010-10-291-1/+1
| |\
| * | Bug #56947 InnoDB leaks memory when failing to create a tableMarko Mäkelä2010-10-111-0/+1
| | | | | | | | | | | | | | | | | | No mysql-test case. Tested by creating a table, removing a *.frm file and attempting to create the table again. Code coverage tested by instrumentation. Tested with Valgrind.
* | | Bug#55222 - RB://517 - Approved by Sunnyunknown2010-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | InnoDB does not attempt to handle lower_case_table_names == 2 when looking up foreign table names and referenced table name. It turned that server variable into a boolean and ignored the possibility of it being '2'. The setting lower_case_table_names == 2 means that it should be stored and displayed in mixed case as given, but compared internally in lower case. Normally the server deals with this since it stores table names. But InnoDB stores referential constraints for the server, so it needs to keep track of both lower case and given names. This solution creates two table name pointers for each foreign and referenced table name. One to display the name, and one to look it up. Both pointers point to the same allocated string unless this setting is 2. So the overhead added is not too much. Two functions are created in dict0mem.c to populate the ..._lookup versions of these pointers. Both dict_mem_foreign_table_name_lookup_set() and dict_mem_referenced_table_name_lookup_set() are called 5 times each.
* | | Merge mysql-5.1-innodb -> mysql-5.5-innodbVasil Dimov2010-11-031-2/+4
|\ \ \ | | |/ | |/|
* | | Merge mysql-5.5-bugteam -> mysql-5.5-innodbVasil Dimov2010-10-271-2/+28
|\ \ \
| * \ \ mergeGeorgi Kodinov2010-10-271-2/+28
| |\ \ \
| | * \ \ Auto-merge from mysql-5.5-bugteam.Alexander Nozdrin2010-10-131-2/+1
| | |\ \ \
| | * \ \ \ Merge from mysql-5.1-security to mysql-5.5-securityJimmy Yang2010-10-061-0/+9
| | |\ \ \ \ | | | | |_|/ | | | |/| |
| | | * | | Fix Bug #57255 Cascade Delete results in "Got error -1 from storage engine".Jimmy Yang2010-10-061-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rb://477 approved by Marko
| | * | | | Manual port Bug #Bug #54582 "stack overflow when opening many tablesJimmy Yang2010-10-061-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | linked with foreign keys at once" from mysql-5.1-security to mysql-5.5-security again. rb://391 approved by Heikki
* | | | | | merge from mysql-5.1-innodb to mysql-5.5-innodb.Jimmy Yang2010-10-251-9/+14
|\ \ \ \ \ \ | |/ / / / / |/| | | | / | | |_|_|/ | |/| | |
* | | | | Merge Bug #56680 from mysql-5.1.Marko Mäkelä2010-10-191-1/+1
|\ \ \ \ \ | |/ / / / | | | | / | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Additional fixes in 5.5: ibuf_set_del_mark(): Add diagnostics when setting a buffered delete-mark fails. ibuf_delete(): Correct a misleading comment about non-found records. rec_print(): Add a const qualifier to the index parameter. Bug #56680 wrong InnoDB results from a case-insensitive covering index row_search_for_mysql(): When a secondary index record might not be visible in the current transaction's read view and we consult the clustered index and optionally some undo log records, return the relevant columns of the clustered index record to MySQL instead of the secondary index record. ibuf_insert_to_index_page_low(): New function, refactored from ibuf_insert_to_index_page(). ibuf_insert_to_index_page(): When we are inserting a record in place of a delete-marked record and some fields of the record differ, update that record just like row_ins_sec_index_entry_by_modify() would do. btr_cur_update_alloc_zip(): Make the function public. mysql_row_templ_t: Add clust_rec_field_no. row_sel_store_mysql_rec(), row_sel_push_cache_row_for_mysql(): Add the flag rec_clust, for returning data at clust_rec_field_no instead of rec_field_no. Resurrect the debug assertion that the record not be marked for deletion. (Bug #55626) [UNIV_DEBUG || UNIV_IBUF_DEBUG] ibuf_debug, buf_page_get_gen(), buf_flush_page_try(): Implement innodb_change_buffering_debug=1 for evicting pages from the buffer pool, so that change buffering will be attempted more frequently.
| * | | Bug #56680 wrong InnoDB results from a case-insensitive covering indexMarko Mäkelä2010-10-191-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | row_search_for_mysql(): When a secondary index record might not be visible in the current transaction's read view and we consult the clustered index and optionally some undo log records, return the relevant columns of the clustered index record to MySQL instead of the secondary index record. REC_INFO_DELETED_FLAG: Move the definition from rem0rec.ic to rem0rec.h. ibuf_insert_to_index_page_low(): New function, refactored from ibuf_insert_to_index_page(). ibuf_insert_to_index_page(): When we are inserting a record in place of a delete-marked record and some fields of the record differ, update that record just like row_ins_sec_index_entry_by_modify() would do. mysql_row_templ_t: Add clust_rec_field_no. row_sel_store_mysql_rec(), row_sel_push_cache_row_for_mysql(): Add the flag rec_clust, for returning data at clust_rec_field_no instead of rec_field_no. Resurrect the debug assertion that the record not be marked for deletion. (Bug #55626) buf_LRU_free_block(): Refactored from buf_LRU_search_and_free_block(). This is needed for the innodb_change_buffering_debug diagnostics. [UNIV_DEBUG || UNIV_IBUF_DEBUG] ibuf_debug, buf_page_get_gen(), buf_flush_page_try(): Implement innodb_change_buffering_debug=1 for evicting pages from the buffer pool, so that change buffering will be attempted more frequently.
| * | merged mysql-5.1 into mysql-5.1-bugteamGeorgi Kodinov2010-10-051-2/+32
| |\ \
| | * | This is to resolve a hang situation in 5.1 builtin raised byJimmy Yang2010-08-241-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | bug #49251 (deadlock/crash with concurrent truncate table and index statistics calculation) by backporting a solution from #54678 fixed for 5.1 plugin and 5.5.
| | * | Fix Bug #54582 stack overflow when opening many tables linked withJimmy Yang2010-08-041-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | foreign keys at once rb://391 approved by Heikki Z
| * | | Fix Bug#56340 innodb updates index stats too frequently after non-index updatesVasil Dimov2010-09-301-1/+6
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a simple optimization issue. All stats are related to only indexed columns, index size or number of rows in the whole table. UPDATEs that touch only non-indexed columns cannot affect stats and we can avoid calling the function row_update_statistics_if_needed() which may result in unnecessary I/O. Approved by: Marko (rb://466)
| * | Bug#53674: InnoDB: Error: unlock row could not find a 4 mode lock on the recordMarko Mäkelä2010-06-021-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In semi-consistent read, only unlock freshly locked non-matching records. Define DB_SUCCESS_LOCKED_REC for indicating a successful operation where a record lock was created. lock_rec_lock_fast(): Return LOCK_REC_SUCCESS, LOCK_REC_SUCCESS_CREATED, or LOCK_REC_FAIL instead of TRUE/FALSE. lock_sec_rec_read_check_and_lock(), lock_clust_rec_read_check_and_lock(), lock_rec_enqueue_waiting(), lock_rec_lock_slow(), lock_rec_lock(), row_ins_set_shared_rec_lock(), row_ins_set_exclusive_rec_lock(), sel_set_rec_lock(), row_sel_get_clust_rec_for_mysql(): Return DB_SUCCESS_LOCKED_REC if a new record lock was created. Adjust callers. row_unlock_for_mysql(): Correct the function documentation. row_prebuilt_t::new_rec_locks: Correct the documentation.
| * | Merge from mysql-trunk-innodb into mysql-5.1-innodb/storage/innobase:Vasil Dimov2010-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------ revno: 3094 revision-id: vasil.dimov@oracle.com-20100513074652-0cvlhgkesgbb2bfh parent: vasil.dimov@oracle.com-20100512173700-byf8xntxjur1hqov committer: Vasil Dimov <vasil.dimov@oracle.com> branch nick: mysql-trunk-innodb timestamp: Thu 2010-05-13 10:46:52 +0300 message: Followup to Bug#51920, fix binlog.binlog_killed This is a followup to the fix of Bug#51920 Innodb connections in row lock wait ignore KILL until lock wait timeout in that fix (rb://279) the behavior was changed to honor when a trx is interrupted during lock wait, but the returned error code was still "lock wait timeout" when it should be "interrupted". This change fixes the non-deterministically failing test binlog.binlog_killed, that failed like this: binlog.binlog_killed 'stmt' [ fail ] Test ended at 2010-05-12 11:39:08 CURRENT_TEST: binlog.binlog_killed mysqltest: At line 208: query 'reap' failed with wrong errno 1205: 'Lock wait timeout exceeded; try restarting transaction', instead of 0... Approved by: Sunny Bains (rb://344) ------------------------------------------------------------ This merge is non-trivial since it has to introduce the DB_INTERRUPTED error code. Also revert vasil.dimov@oracle.com-20100408165555-9rpjh24o0sa9ad5y which adjusted the binlog.binlog_killed test to the new (wrong) behavior
| * | Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)Marko Mäkelä2010-05-141-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644). struct trx_struct: Add mysql_query_len. ha_innodb.cc: Use trx_query_string() instead of trx_query() and initialize trx->mysql_query_len. INNOBASE_COPY_STMT(thd, trx): New macro, to initialize trx->mysql_query_str and trx->mysql_query_len. dict_strip_comments(): Add and observe the parameter sql_length. Treat /*/ as the start of a comment. dict_create_foreign_constraints(), row_table_add_foreign_constraints(): Add the parameter sql_length.
| * | Reduce the next-key locking of READ UNCOMMITTED to match that ofMarko Makela2010-04-291-1/+1
| | | | | | | | | | | | READ COMMITTED in the built-in InnoDB. (Bug #48607)
| * | Applying InnoDB snapshot, fixes BUG#49238.Sergey Vojtovich2010-01-221-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detailed revision comments: r6421 | jyang | 2010-01-12 07:59:16 +0200 (Tue, 12 Jan 2010) | 8 lines branches/5.1: Fix bug #49238: Creating/Dropping a temporary table while at 1023 transactions will cause assert. Handle possible DB_TOO_MANY_CONCURRENT_TRXS when deleting metadata in row_drop_table_for_mysql(). rb://220, approved by Marko
* | | Bug#49938: Failing assertion: inode or deadlock in fsp/fsp0fsp.cDavi Arnaut2010-10-061-2/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug#54678: InnoDB, TRUNCATE, ALTER, I_S SELECT, crash or deadlock - Incompatible change: truncate no longer resorts to a row by row delete if the storage engine does not support the truncate method. Consequently, the count of affected rows does not, in any case, reflect the actual number of rows. - Incompatible change: it is no longer possible to truncate a table that participates as a parent in a foreign key constraint, unless it is a self-referencing constraint (both parent and child are in the same table). To work around this incompatible change and still be able to truncate such tables, disable foreign checks with SET foreign_key_checks=0 before truncate. Alternatively, if foreign key checks are necessary, please use a DELETE statement without a WHERE condition. Problem description: The problem was that for storage engines that do not support truncate table via a external drop and recreate, such as InnoDB which implements truncate via a internal drop and recreate, the delete_all_rows method could be invoked with a shared metadata lock, causing problems if the engine needed exclusive access to some internal metadata. This problem originated with the fact that there is no truncate specific handler method, which ended up leading to a abuse of the delete_all_rows method that is primarily used for delete operations without a condition. Solution: The solution is to introduce a truncate handler method that is invoked when the engine does not support truncation via a table drop and recreate. This method is invoked under a exclusive metadata lock, so that there is only a single instance of the table when the method is invoked. Also, the method is not invoked and a error is thrown if the table is a parent in a non-self-referencing foreign key relationship. This was necessary to avoid inconsistency as some integrity checks are bypassed. This is inline with the fact that truncate is primarily a DDL operation that was designed to quickly remove all data from a table. mysql-test/suite/innodb/t/innodb-truncate.test: Add test cases for truncate and foreign key checks. Also test that InnoDB resets auto-increment on truncate. mysql-test/suite/innodb/t/innodb.test: FK is not necessary, test is related to auto-increment. Update error number, truncate is no longer invoked if table is parent in a FK relationship. mysql-test/suite/innodb/t/innodb_mysql.test: Update error number, truncate is no longer invoked if table is parent in a FK relationship. Use delete instead of truncate, test is used to check the interaction of FKs, triggers and delete. mysql-test/suite/parts/inc/partition_check.inc: Fix typo. mysql-test/suite/sys_vars/t/foreign_key_checks_func.test: Update error number, truncate is no longer invoked if table is parent in a FK relationship. mysql-test/t/mdl_sync.test: Modify test case to reflect and ensure that truncate takes a exclusive metadata lock. mysql-test/t/trigger-trans.test: Update error number, truncate is no longer invoked if table is parent in a FK relationship. sql/ha_partition.cc: Reorganize the various truncate methods. delete_all_rows is now passed directly to the underlying engines, so as truncate. The code responsible for truncating individual partitions is moved to ha_partition::truncate_partition, which is invoked when a ALTER TABLE t1 TRUNCATE PARTITION p statement is executed. Since the partition truncate no longer can be invoked via delete, the bitmap operations are not necessary anymore. The explicit reset of the auto-increment value is also removed as the underlying engines are now responsible for reseting the value. sql/handler.cc: Wire up the handler truncate method. sql/handler.h: Introduce and document the truncate handler method. It assumes certain use cases of delete_all_rows. Add method to retrieve the list of foreign keys referencing a table. Method is used to avoid truncating tables that are parent in a foreign key relationship. sql/share/errmsg-utf8.txt: Add error message for truncate and FK. sql/sql_lex.h: Introduce a flag so that the partition engine can detect when a partition is being truncated. Used to give a special error. sql/sql_parse.cc: Function mysql_truncate_table no longer exists. sql/sql_partition_admin.cc: Implement the TRUNCATE PARTITION statement. sql/sql_truncate.cc: Change the truncate table implementation to use the new truncate handler method and to not rely on row-by-row delete anymore. The truncate handler method is always invoked with a exclusive metadata lock. Also, it is no longer possible to truncate a table that is parent in some non-self-referencing foreign key. storage/archive/ha_archive.cc: Rename method as the description indicates that in the future this could be a truncate operation. storage/blackhole/ha_blackhole.cc: Implement truncate as no operation for the blackhole engine in order to remain compatible with older releases. storage/federated/ha_federated.cc: Introduce truncate method that invokes delete_all_rows. This is required to support partition truncate as this form of truncate does not implement the drop and recreate protocol. storage/heap/ha_heap.cc: Introduce truncate method that invokes delete_all_rows. This is required to support partition truncate as this form of truncate does not implement the drop and recreate protocol. storage/ibmdb2i/ha_ibmdb2i.cc: Introduce truncate method that invokes delete_all_rows. This is required to support partition truncate as this form of truncate does not implement the drop and recreate protocol. storage/innobase/handler/ha_innodb.cc: Rename delete_all_rows to truncate. InnoDB now does truncate under a exclusive metadata lock. Introduce and reorganize methods used to retrieve the list of foreign keys referenced by a or referencing a table. storage/myisammrg/ha_myisammrg.cc: Introduce truncate method that invokes delete_all_rows. This is required in order to remain compatible with earlier releases where truncate would resort to a row-by-row delete.
* | Merge mysql-5.5-innodb -> mysql-5.5-bugteamVasil Dimov2010-10-011-1/+6
|\ \