summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
Commit message (Collapse)AuthorAgeFilesLines
* - Renaming variables so that they don't shadow others (After this patch one ↵Monty2015-07-061-52/+70
| | | | | | | | | | | | | | | | | | | | | | | can compile with -Wshadow and get much fewer warnings) - Changed ER(ER_...) to ER_THD(thd, ER_...) when thd was known or if there was many calls to current_thd in the same function. - Changed ER(ER_..) to ER_THD_OR_DEFAULT(current_thd, ER...) in some places where current_thd is not necessary defined. - Removing calls to current_thd when we have access to thd Part of this is optimization (not calling current_thd when not needed), but part is bug fixing for error condition when current_thd is not defined (For example on startup and end of mysqld) Notable renames done as otherwise a lot of functions would have to be changed: - In JOIN structure renamed: examined_rows -> join_examined_rows record_count -> join_record_count - In Field, renamed new_field() to make_new_field() Other things: - Added DBUG_ASSERT(thd == tmp_thd) in Item_singlerow_subselect() just to be safe. - Removed old 'tab' prefix in JOIN_TAB::save_explain_data() and use members directly - Added 'thd' as argument to a few functions to avoid calling current_thd.
* Merge tag 'mariadb-10.0.20' into 10.1Sergei Golubchik2015-06-271-29/+24
|\
| * MDEV-8287 DROP TABLE suppresses all engine errorsSergei Golubchik2015-06-161-19/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in ha_delete_table() * only convert ENOENT and HA_ERR_NO_SUCH_TABLE to warnings * only return real error codes (that is, not ENOENT and not HA_ERR_NO_SUCH_TABLE) * intercept HA_ERR_ROW_IS_REFERENCED to generate backward compatible ER_ROW_IS_REFERENCED in mysql_rm_table_no_locks() * no special code to handle HA_ERR_ROW_IS_REFERENCED * no special code to handle ENOENT and HA_ERR_NO_SUCH_TABLE * return multi-table error ER_BAD_TABLE_ERROR <table list> only when there were many errors, not when there were many tables to drop (but only one table generated an error)
| * after-merge fixesSergei Golubchik2015-06-161-0/+1
| | | | | | | | | | in innobase: compilation error on windows other changes: perfschema merge followup
| * MDEV-5309 - RENAME TABLE does not check for existence of the table's engineSergey Vojtovich2015-06-161-2/+2
| | | | | | | | | | | | | | | | | | When RENAME TABLE is executed, it apparently does not check whether the engine is available (unlike ALTER TABLE .. RENAME, which does). It means that if the engine in question was not loaded on some reason, the table might become unusable, since the engine won't know about the change. With this patch RENAME TABLE fails if storage engine is not available.
| * MDEV-8212 alter table - failing to ADD PRIMARY KEY IF NOT EXISTS when ↵Alexey Botchkov2015-06-141-6/+11
| | | | | | | | | | | | existing index of same as column name. The default name for the primary key is rather 'PRIMARY' instead of the indexed column name.
| * Merge branch '5.5' into 10.0Sergei Golubchik2015-06-111-1/+1
| |\
| | * Merge tag 'mysql-5.5.44' into bb-5.5-sergSergei Golubchik2015-06-051-1/+1
| | |\
| | | * Bug #20439913 CREATE TABLE DB.TABLE LIKE TMPTABLE ISVenkatesh Duggirala2015-03-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BINLOGGED INCORRECTLY - BREAKS A SLAVE Submitted a incomplete patch with my previous push, re submitting the extra changes the required to make the patch complete.
| | | * Bug #20439913 CREATE TABLE DB.TABLE LIKE TMPTABLE IS BINLOGGED INCORRECTLY - ↵Venkatesh Duggirala2015-03-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BREAKS A SLAVE Analysis: In row based replication, Master does not send temp table information to Slave. If there are any DDLs that involves in regular table that needs to be sent to Slave and a temp tables (which will not be available at Slave), the Master rewrites the query replacing temp table with it's defintion. Eg: create table regular_table like temptable. In rewrite logic, server is ignoring the database of regular table which can cause problems mentioned in this bug. Fix: dont ignore database information (if available) while rewriting the query
* | | | MDEV-8219: enforce_storage_engine cannot be set globallyJan Lindström2015-06-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Change session only variable enforce_storage_engine to be session variable and make sure that also global value is used if session variable is not set.
* | | | Merge tag 'mariadb-10.0.19' into 10.1Sergei Golubchik2015-06-011-19/+19
|\ \ \ \ | |/ / /
| * | | Merge branch '5.5' into 10.0Sergei Golubchik2015-05-041-3/+2
| |\ \ \ | | |/ /
| | * | Merge branch 'openquery/MDEV-6916-maria-5.5-check_view-r4408' into 5.5Sergei Golubchik2015-04-281-1/+0
| | |\ \
| | | * | remove include sql_view.h from sql_table.cc - unneededDaniel Black2015-04-131-1/+0
| | | | |
| | | * | MDEV-6916 REPAIR VIEW / mysql migrationOleksandr Byelkin2015-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | from: r4407
| | * | | Merge remote-tracking branch 'mysql/5.5' into 5.5Sergei Golubchik2015-04-271-2/+6
| | |\ \ \ | | | |/ / | | |/| / | | | |/
| | | * Bug #12671631 CREATE TABLE .. LIKE .. FEDERATED TABLEArun Kuruvila2015-01-281-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CRASHES WITH AUTO_INCREMENT COLUMN Description:- Creating a federated table with AUTO_INCREMENT column using LIKE clause results in a server crash. Analysis:- Creating a federated table with AUTO_INCREMENT column using LIKE clause results in a federated server crash due to the uninitialized connection structure(mysql). Also due to unassigned connection string for the remote server, at the time of preparation of "create_info" structure, the creation of any federated table using LIKE clause fails with an error, "ERROR 1 (HY000): server name: '' doesn't exist!". This bug is not only with AUTO_INCREMENT but in all creations of federated tables with LIKE clause. Fix :- In ha_federated::info(), "mysql->insert_id" assigned to "stats.auto_increment_value" only when there is an active connection. This fixes the crash issue. For creating the federated table with LIKE clause, connection string is assigned at the time of preparation of "create_info" structure.
| | | * Bug#18790730 - CROSS-DATABASE FOREIGN KEY WITHOUT PERMISSIONSPraveenkumar Hulakund2014-09-101-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CHECK. Analysis: ---------- Issue here is, while creating or altering the InnoDB table, if the foreign key defined on the table references a parent table on which the user has no access privileges then the table is created without reporting any error. Currently the privilege level REFERENCES_ACL is unused and is not used for access evaluation while creating the table with a foreign key constraint or adding the foreign key constraint to a table. But when no privileges are granted to user then also access evaluation on parent table is ignored. Fix: --------- For DMLs, irrelevant of the fact, support does not want any changes to avoid permission checks on every operation. So, as a fix, added a function "check_fk_parent_table_access" to check whether any of the SELECT_ACL, INSERT_ACL, UDPATE_ACL, DELETE_ACL or REFERENCE_ACL privileges are granted for user at table level. If none of them is granted then error is reported. This function is called during the table creation and alter operation.
| | | * BUG#17665767 - FAILING ASSERTION: PRIMARY_KEY_NO == -1 || PRIMARY_KEY_NO == 0 Raghav Kapoor2014-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BACKGROUND: This bug is a followup on Bug#16368875. The assertion failure happens because in SQL layer the key does not get promoted to PRIMARY KEY but InnoDB takes it as PRIMARY KEY. ANALYSIS: Here we are trying to create an index on POINT (GEOMETRY) data type which is a type of BLOB (since GEOMETRY is a subclass of BLOB). In general, we can't create an index over GEOMETRY family type field unless we specify the length of the keypart (similar to BLOB fields). Only exception is the POINT field type. The POINT column max size is 25. The problem is that the field is not treated as PRIMARY KEY when we create a index on POINT column using its max column size as key part prefix. The fix would allow index on POINT column to be treated as PRIMARY KEY. FIX: Patch for Bug#16368875 is extended to take into account GEOMETRY datatype, POINT in particular to consider it as PRIMARY KEY in SQL layer.
| | | * Bug#18776592 INNODB: FAILING ASSERTION: PRIMARY_KEY_NO == -1 ||Gopal Shankar2014-06-251-30/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PRIMARY_KEY_NO == 0 This bug is a backport of the following revision of 5.6 source tree: # committer: Gopal Shankar <gopal.shankar@oracle.com> # branch nick: priKey56 # timestamp: Wed 2013-05-29 11:11:46 +0530 # message: # Bug#16368875 INNODB: FAILING ASSERTION:
| | | * Fix for bug#14188793 - "DEADLOCK CAUSED BY ALTER TABLE DOEN'T CLEARDmitry Lenev2013-08-201-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | STATUS OF ROLLBACKED TRANSACTION" and bug #17054007 - "TRANSACTION IS NOT FULLY ROLLED BACK IN CASE OF INNODB DEADLOCK". The problem in the first bug report was that although deadlock involving metadata locks was reported using the same error code and message as InnoDB deadlock it didn't rollback transaction like the latter. This caused confusion to users as in some cases after ER_LOCK_DEADLOCK transaction could have been restarted immediately and in some cases rollback was required. The problem in the second bug report was that although InnoDB deadlock caused transaction rollback in all storage engines it didn't cause release of metadata locks. So concurrent DDL on the tables used in transaction was blocked until implicit or explicit COMMIT or ROLLBACK was issued in the connection which got InnoDB deadlock. The former issue has stemmed from the fact that when support for detection and reporting metadata locks deadlocks was added we erroneously assumed that InnoDB doesn't rollback transaction on deadlock but only last statement (while this is what happens on InnoDB lock timeout actually) and so didn't implement rollback of transactions on MDL deadlocks. The latter issue was caused by the fact that rollback of transaction due to deadlock is carried out by setting THD::transaction_rollback_request flag at the point where deadlock is detected and performing rollback inside of trans_rollback_stmt() call when this flag is set. And trans_rollback_stmt() is not aware of MDL locks, so no MDL locks are released. This patch solves these two problems in the following way: - In case when MDL deadlock is detect transaction rollback is requested by setting THD::transaction_rollback_request flag. - Code performing rollback of transaction if THD::transaction_rollback_request is moved out from trans_rollback_stmt(). Now we handle rollback request on the same level as we call trans_rollback_stmt() and release statement/ transaction MDL locks.
| | | * BUG#16290902 DROP TEMP TABLE IF EXISTS CAN CAUSE POINTVenkatesh Duggirala2013-07-271-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IN TIME RECOVERY FAILURE ON SLAVES Problem: DROP TEMP TABLE IF EXISTS commands can cause point in time recovery (re-applying binlog) failures. Analyses: In RBR, 'DROP TEMPORARY TABLE' commands are always binlogged by adding 'IF EXISTS' clauses. Also, the slave SQL thread will not check replicate.* filter rules for "DROP TEMPORARY TABLE IF EXISTS" queries. If log-slave-updates is enabled on slave, these queries will be binlogged in the format of "USE `db`; DROP TEMPORARY TABLE IF EXISTS `t1`;" irrespective of filtering rules and irrespective of the `db` existence. When users try to recover slave from it's own binlog, use `db` command might fail if `db` is not present on slave. Fix: At the time of writing the 'DROP TEMPORARY TABLE IF EXISTS' query into the binlog, 'use `db`' will not be present and the table name in the query will be a fully qualified table name. Eg: 'USE `db`; DROP TEMPORARY TABLE IF EXISTS `t1`;' will be logged as 'DROP TEMPORARY TABLE IF EXISTS `db`.`t1`;'.
| | | * Bug#14834378 ADDRESSSANITIZER BUG IN FILENAME_TO_TABLENAMETor Didriksen2013-06-141-1/+2
| | | | | | | | | | | | | | | | Backport to 5.5
| | | * Bug #14227431: CHARACTER SET MISMATCH WHEN ALTERING FOREIGN KEYSSivert Sorumgard2013-06-121-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CAN LEAD TO MISSING TABLES Overview -------- If the FOREIGN_KEY_CHECKS system variable is set to 0, it is possible to break a foreign key constraint by changing the type or character set of the foreign key column, or by dropping the foreign key index (without carrying out corresponding changes on another table in the relationship). If we subsequently set FOREIGN_KEY_CHECKS to 1 and execute ALTER TABLE involving the COPY algorithm on such a table, the following happens: 1) If ALTER TABLE does not contain a RENAME clause, the attempt to install the new version of the table instead of the old one will fail due to the fact that the inconsistency will be detected. An attempt to revert the partially executed alter table operation by restoring the old table definition will fail as well due to FOREIGN_KEY_CHECKS == 1. As a result, the table being altered will be lost. 2) If ALTER TABLE contains the RENAME clause, the inconsistency will not be detected (most probably due to other bugs). But if an attempt to install the new version of the table fails (for example, due to a failure when updating triggers associated with the table), reverting the partially executed alter table by restoring the old table definition will fail too. So the table being altered might be lost as well. Suggested fix ------------- The suggested fix is to temporarily unset the option bit representing FOREIGN_KEY_CHECKS when the old table definition is restored while reverting the partially executed operation.
| | | * Bug #16051728 SERVER CRASHES IN ADD_IDENTIFIER ON CONCURRENT ALTER TABLE ANDAnnamalai Gurusami2013-03-211-36/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SHOW ENGINE INNOD Problem: The purpose of explain_filename() is to provide useful additional information regarding the partitions given the filename. This function was returning an error when it was not able to parse the given filename. For example, within InnoDB, temporary files are created with #sql- prefix. But this function was not able to parse it correctly. Solution: It is not an error, if explain_filename() could not parse the given filename. If there is no partition information to explain, then silently return from the function. rb#1940 approved by mattiasj
| | | * Bug#16274455: CAN NOT ACESS PARTITIONED TABLES WHENMattias Jonsson2013-02-141-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DOWNGRADED FROM 5.6.11 TO 5.6.10 Problem was new syntax not accepted by previous version. Fixed by adding version comment of /*!50531 around the new syntax. Like this in the .frm file: 'PARTITION BY KEY /*!50611 ALGORITHM = 2 */ () PARTITIONS 3' and also changing the output from SHOW CREATE TABLE to: CREATE TABLE t1 (a INT) /*!50100 PARTITION BY KEY */ /*!50611 ALGORITHM = 1 */ /*!50100 () PARTITIONS 3 */ It will always add the ALGORITHM into the .frm for KEY [sub]partitioned tables, but for SHOW CREATE TABLE it will only add it in case it is the non default ALGORITHM = 1. Also notice that for 5.5, it will say /*!50531 instead of /*!50611, which will make upgrade from 5.5 > 5.5.31 to 5.6 < 5.6.11 fail! If one downgrades an fixed version to the same major version (5.5 or 5.6) the bug 14521864 will be visible again, but unless the .frm is updated, it will work again when upgrading again. Also fixed so that the .frm does not get updated version if a single partition check passes.
| | | * mergeMattias Jonsson2012-12-271-5/+2
| | | |\
| | | | * Bug#14589559 Post push fix for valgrind warnings.Mattias Jonsson2012-12-271-6/+3
| | | | |
| | | * | merge mysql-5.1 -> mysql-5.5Mattias Jonsson2012-12-011-2/+4
| | | |\ \ | | | | |/
| | | | * merge of bug#14589559 into mysql-5.1Mattias Jonsson2012-12-011-100/+124
| | | | |\
| | | | | * bug#14589559: ASSERTION `FILE_ENTRY_BUF[2] == 0' FAILEDMattias Jonsson2012-11-301-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IN DEACTIVATE_DDL_LOG_ENTRY Update of comments according to reviewers request.
| | | | * | Bug#11751825 - OPTIMIZE PARTITION RECREATES FULL TABLE INSTEAD JUST PARTITIONAditya A2012-11-061-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PROBLEM ------- optimize on partiton will recreate the whole table instead of just partition. ANALYSIS -------- At present innodb doesn't support optimize option ,so we do a rebuild of the whole table and then call analyze() on the table.Presently for any optimize() option (on table or partition) we display the following info to the user "Table does not support optimize, doing recreate + analyze instead". FIX --- It was decided for GA versions(5.1 and 5.5) whenever the user tries to optimize a partition(s) we will will display the following info the user "Table does not support optimize on partitions. All partitions will be rebuilt and analyzed." Earlier partitions were not analyzed.Now all partitions will be analyzed. If the user wants to optimize the whole table ,we will display the previous info to the user. i.e "Table does not support optimize, doing recreate + analyze instead" For 5.6+ versions we will raise a new bug to support optimize() options in innodb.
| | | * | | Manual merge of bug#14589559 from mysql-5.1 to 5.5Mattias Jonsson2012-10-181-98/+120
| | | |\ \ \ | | | | | |/ | | | | |/|
| | | | * | Bug#14589559: ASSERTION `FILE_ENTRY_BUF[2] == 0'Mattias Jonsson2012-10-181-98/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FAILED IN DEACTIVATE_DDL_LOG_ENTRY deallocate_ddl_log_entry() can be called without having locked LOCK_gdl. It uses a global buffer for reading and writing entries in the ddl_log, and since it is not protected by any mutex, two concurrent threads can overwrite the content in the global buffer, so it can be different from what was read. Thread a reads from entry 1 into global buffer, thread b reads from entry 2 into global buffer, thread a writes from global buffer into entry 1 -> entry 1 is not the content of entry 2. This is especially bad for replace entries, which uses two phases, and does not deactivate the whole entry after the first phase, but increases the phase instead. Fixed by using thread local storage (stack) instead of global storage (global buffer). Also added buffer and size arguments to read/write_ddl_log_file_entry. Also only read/write first bytes in entries in deactivate_ddl_log_entry. Also fixed the scenario where it will try to recover from a server compiled with a different value of IO_SIZE (very uncommon!) updated patch with set_ddl_log_entry_from_buf and removed read_ddl_log_entry. Manually tested, no test case included.
| | | * | | upmerge to bug#14548159Rohit Kalhans2012-09-221-10/+11
| | | |\ \ \ | | | | | |/ | | | | |/|
| | | | * | BUG#14548159: NUMEROUS CASES OF INCORRECT IDENTIFIERRohit Kalhans2012-09-221-11/+11
| | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QUOTING IN REPLICATION Problem: Misquoting or unquoted identifiers may lead to incorrect statements to be logged to the binary log. Fix: we use specialized functions to append quoted identifiers in the statements generated by the server.
| | | * | Bug#12623923 Server can crash after failure to createJon Olav Hauglid2012-07-101-8/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | primary key with innodb tables The bug was triggered if a single ALTER TABLE statement both added and dropped indexes and ALTER TABLE failed during drop (e.g. because the index was needed in a foreign key constraint). In such cases, the server index information would get out of sync with InnoDB - the added index would be present inside InnoDB, but not in the server. This could then lead to InnoDB error messages and/or server crashes. The root cause is that new indexes are added before old indexes are dropped. This means that if ALTER TABLE fails while dropping indexes, index changes will be reverted in the server but not inside InnoDB. This patch fixes the problem by dropping any added indexes if drop fails (for ALTER TABLE statements that both adds and drops indexes). However, this won't work if we added a primary key as this key might not be possible to drop inside InnoDB. Therefore, we resort to the copy algorithm if a primary key is added by an ALTER TABLE statement that also drops an index. In 5.6 this bug is more properly fixed by the handler interface changes done in the scope of WL#5534 "Online ALTER".
| | | * | Bug#13982017: ALTER TABLE RENAME ENDS UP WITH ERROR 1050 (42S01)Jon Olav Hauglid2012-06-011-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed by backport of: ------------------------------------------------------------ revno: 3402.50.156 committer: Jon Olav Hauglid <jon.hauglid@oracle.com> branch nick: mysql-trunk-test timestamp: Wed 2012-02-08 14:10:23 +0100 message: Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA This assert could be triggered if an InnoDB table was being moved to a different database using ALTER TABLE ... RENAME, while this database concurrently was being dropped by DROP DATABASE. The reason for the problem was that no metadata lock was taken on the target database by ALTER TABLE ... RENAME. DROP DATABASE was therefore not blocked and could remove the database while ALTER TABLE ... RENAME was executing. This could cause the assert in InnoDB to be triggered. This patch fixes the problem by taking a IX metadata lock on the target database before ALTER TABLE ... RENAME starts moving a table to a different database. Note that this problem did not occur with RENAME TABLE which already takes the correct metadata locks. Also note that this patch slightly changes the behavior of ALTER TABLE ... RENAME. Before, the statement would abort and return an error if a lock on the target table name could not be taken immediately. With this patch, ALTER TABLE ... RENAME will instead block and wait until the lock can be taken (or until we get a lock timeout). This also means that it is possible to get ER_LOCK_DEADLOCK errors in this situation since we allow ALTER TABLE ... RENAME to wait and not just abort immediately.
| | | * | Bug #12902967 CREATING SELF REFERENCING FK ON SAME INDEX Annamalai Gurusami2012-04-171-10/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UNHANDLED, CONFUSING ERROR The main confusion with the error message is that "it implies that your data dictionary may now be out of sync". This patch will remove the unwanted and the misleading error message by not doing an unnecessary operation in the error handling code. rb://980 approved by: Dmitry Lenev
| | | * | Bug#11815557 60269: MYSQL SHOULD REJECT ATTEMPTS TO CREATE SYSTEMgopal.shankar@oracle.com2012-04-111-8/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TABLES IN INCORRECT ENGINE PROBLEM: CREATE/ALTER TABLE currently can move system tables like mysql.db, user, host etc, to engines other than MyISAM. This is not completely supported as of now, by mysqld. When some of system tables like plugin, servers, event, func, *_priv, time_zone* are moved to innodb, mysqld restart crashes. Currently system tables can be moved to BLACKHOLE also!!!. ANALYSIS: The problem is that there is no check before creating or moving a system table to some particular engine. System tables are suppose to be residing in MyISAM. We can think of restricting system tables to exist only in MyISAM. But, there could be future needs of these system tables to be part of other engines by design. For eg, NDB cluster expects some tables to be on innodb or ndb engine. This calls for a solution, by which system tables can be supported by any desired engine, with minimal effort. FIX: The solution provides a handlerton interface using which, mysqld server can query particular storage engine handlerton for system tables that it supports. This way each storage engine layer can define their own system database and system tables. The check_engine() function uses the new handlerton function ha_check_if_supported_system_table() to check if db.tablename provided in the DDL is supported by the SE. Note: This fix has modified a test in help.test, which was moving mysql.help_* to innodb. The primary intention of the test was not to move them between engines.
| | | * | Updated/added copyright headersMySQL Build Team2012-02-161-1/+1
| | | |\ \ | | | | |/
| | | | * mergeMattias Jonsson2011-12-141-0/+5
| | | | |\
| | | | | * Bug#12361113: CRASH WHEN "LOAD INDEX INTO CACHE" WITH TOOMattias Jonsson2011-12-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SMALL KEY CACHE The server crashed on division by zero because the key cache was not initialized and the block length was 0 which was used in a division. The fix was to not allow CACHE INDEX if the key cache was not initiallized. Thus never try LOAD INDEX INTO CACHE for an uninitialized key cache. Also added some windows files/directories to .bzrignore.
| | | | * | Bug#12406055 post-push fix: unused variable 'num_chars' in optimized build.Tor Didriksen2011-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Also fixed possibly uninitialized use of need_copy_table_res.
| | | | * | Updated/added copyright headersKent Boortz2011-07-031-7/+35
| | | | |\ \
| | | | * \ \ Updated/added copyright headersKent Boortz2011-06-301-2/+4
| | | | |\ \ \ | | | | | | |/ | | | | | |/|
| | | | | * | Updated/added copyright headersKent Boortz2011-06-301-2/+3
| | | | | | |
| | | * | | | BUG#11758263 50440: MARK UNORDERED UPDATE WITH AUTOINC UNSAFERohit Kalhans2012-02-091-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Statements that write to tables with auto_increment columns based on the selection from another table, may lead to master and slave going out of sync, as the order in which the rows are retrieved from the table may differ on master and slave. Solution: We mark writing to a table with auto_increment table based on the rows selected from another table as unsafe. This will cause the execution of such statements to throw a warning and forces the statement to be logged in ROW if the logging format is mixed. Changes: 1. All the statements that writes to a table with auto_increment column(s) based on the rows fetched from another table, will now be unsafe. 2. CREATE TABLE with SELECT will now be unsafe.
| | | * | | | Bug#11748731:SOME 'BIG' TESTS FAILING ON 6.0 Sneha Modi2011-11-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A patch for alter_table-big.test has been committed earlier. This is a patch for create-big.test: The test used to time-out after 900 seconds. It relied on debug sleeps that are no longer present in the code. Since the sleeps are long gone, fixing the problem didn't involve just updating the result file or using macro "show_binlog_events2.inc" instead of "show binlog events" statement. The test needed to be rewritten using debug sync points, and result then needed to be updated. So, the sleeps have been replaced by debug_sync points and the test execution time has been reduced significantly.