summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.0-base -> 10.0Alexander Barkov2013-10-151-1/+0
|\
| * Merge 5.5->10.0-baseIgor Babaev2013-10-131-1/+0
| |\
| | * Merge 5.3-5.5Igor Babaev2013-10-131-1/+0
| | |\
| | | * Fixed bug mdev-5105.Igor Babaev2013-10-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug caused a memory overwrite in the function update_ref_and_keys() It happened due to a wrong value of SELECT_LEX::cond_count. This value historically was calculated by the fix_fields method. Now the logic of calling this method became too complicated and, as a result, this value is calculated not always correctly. The patch changes the way how and when the values of SELECT_LEX::cond_count and of SELECT_LEX::between_count are calculated. The new code does it just at the beginning of update_ref_and_keys().
* | | | MDEV-4702 - Reduce usage of LOCK_openSergey Vojtovich2013-08-141-983/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following variables do not require LOCK_open protection anymore: - table_def_cache (renamed to tdc_hash) is protected by rw-lock LOCK_tdc_hash; - table_def_shutdown_in_progress doesn't need LOCK_open protection; - last_table_id use atomics; - TABLE_SHARE::ref_count (renamed to TABLE_SHARE::tdc.ref_count) is protected by TABLE_SHARE::tdc.LOCK_table_share; - TABLE_SHARE::next, ::prev (renamed to tdc.next and tdc.prev), oldest_unused_share, end_of_unused_share are protected by LOCK_unused_shares; - TABLE_SHARE::m_flush_tickets (renamed to tdc.m_flush_tickets) is protected by TABLE_SHARE::tdc.LOCK_table_share; - refresh_version (renamed to tdc_version) use atomics.
* | | | MDEV-4786 merge 10.0-monty -> 10.0Sergei Golubchik2013-08-121-17/+9
| | | | | | | | | | | | | | | | remove TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE
* | | | MDEV-4786 merge 10.0-monty -> 10.0Sergei Golubchik2013-08-121-2/+1
| | | | | | | | | | | | | | | | use get_table_def_key() instead of create_table_def_key() where appropriate
* | | | MDEV-4786 - merge 10.0-monty - 10.0Sergey Vojtovich2013-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed main.innodb_mysql_sync failure. TDC_RT_REMOVE_NOT_OWN_KEEP_SHARE is not same as TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE. Comment in sql_table.cc says: Storage engine has requested exclusive lock only for prepare phase and we are not under LOCK TABLES. Don't mark TABLE_SHARE as old in this case, as this won't allow opening of table by other threads during main phase of in-place ALTER TABLE. At this moment we hold exclusive metadata lock, all we should do is purge unused TABLE objects. sql/sql_base.cc: Restore 5.6 behavior of TDC_RT_REMOVE_NOT_OWN_KEEP_SHARE. sql/sql_base.h: Restore 5.6 behavior of TDC_RT_REMOVE_NOT_OWN_KEEP_SHARE.
* | | | 10.0-monty mergeSergei Golubchik2013-07-211-278/+543
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | includes: * remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING" * introduce LOCK_share, now LOCK_ha_data is strictly for engines * rea_create_table() always creates .par file (even in "frm-only" mode) * fix a 5.6 bug, temp file leak on dummy ALTER TABLE
| * | | | Merge the following patch from MySQL 5.6.10, in order to make ↵unknown2013-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | perfschema.binlog_* tests work. revno: 4559 committer: Marc Alff <marc.alff@oracle.com> branch nick: mysql-5.6-bug14741537-v4 timestamp: Thu 2012-11-08 22:40:31 +0100 message: Bug#14741537 - MYSQL 5.6, GTID AND PERFORMANCE_SCHEMA Before this fix, statements using performance_schema tables: - were marked as unsafe for replication, - did cause warnings during execution, - were written to the binlog, either in STATEMENT or ROW format. When using replication with the new GTID feature, unsafe warnings are elevated to errors, which prevents to use both the performance_schema and GTID together. The root cause of the problem is not related to raising warnings/errors in some special cases, but deeper: statements involving the performance schema should not even be written to the binary log in the first place, because the content of the performance schema tables is 'local' to a server instance, and may differ greatly between nodes in a replication topology. In particular, the DBA should be able to configure (INSERT, UPDATE, DELETE) or flush (TRUNCATE) performance schema tables on one node, without affecting other nodes. This fix introduces the concept of a 'non-replicated' or 'local' table, and adjusts the replication logic to ignore tables that are not replicated when deciding if or how to log a statement to the binlog. Note that while this issue was detected using the performance_schema, other tables are also affected by the same problem. This fix define as 'local' the following tables, which are then never replicated: - performance_schema.* - mysql.general_log - mysql.slow_log - mysql.slave_relay_log_info - mysql.slave_master_info - mysql.slave_worker_info Existing behavior for information_schema.* is unchanged by this fix, to limit the scope of changes. Coding wise, this fix implements the following changes: 1) Performance schema tables are not using any replication flags, since performance schema tables are not replicated. 2) In open_table_from_share(), tables with no replication capabilities (performance_schema.*), tables with TABLE_CATEGORY_LOG (logs) and tables with TABLE_CATEGORY_RPL_INFO (replication) are marked as non replicated, with TABLE::no_replicate 3) A new THD member, THD::m_binlog_filter_state, indicate if the current statement is written to the binlog (normal cases for most statements), or is to be discarded (because the statements affects non replicated tables). 4) In THD::decide_logging_format(), the replication logic is changed to take into account non replicated tables. Statements that affect only non replicated tables are executed normally (no warning or errors), but not written to the binlog. Statements that affect (i.e., write to) a replicated table while also using (i.e., reading from or writing to) a non replicated table are executed normally in MIXED and ROW binlog format, and cause a new error in STATEMENT binlog format. THD::decide_logging_format() uses THD::m_binlog_filter_state to indicate if a statement is to be ignored, when writing to the binlog. 5) In THD::binlog_query(), statements marked as ignored are not written to the binary log. 6) For row based replication, the existing test for 'table->no_replicate', has been moved from binlog_log_row() to check_table_binlog_row_based().
| * | | | added lost part about preopened temporary tablesunknown2013-07-111-2/+13
| | | | |
| * | | | Fix assert failures in main.merge test (line 234) and main.merge_mmap (line 44)Sergey Petrunya2013-07-081-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - After the merge from mysql-5.6, open_tables() did not call open_and_process_table() for temporary table. The logic was that temporary tables were already opened when mysql_execute_command() has called open_temporary_tables(). This worked for the most part, except for temporary tables of type MERGE. for which open_and_process_table() must call table->file->extra(HA_EXTRA_ADD_CHILDREN_LIST). Failure to make this call resulted in crash further in execution. tables->table->file->extra(HA_EXTRA_ADD_CHILDREN_LIST)
| * | | | Merge performance schema test cases from MySQL 5.6.10unknown2013-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Merged the majority of the PFS test cases. There are still 19 failing test cases that need more attention.
| * | | | fixed opening temporary tables.unknown2013-07-051-3/+48
| | | | |
| * | | | Fixed issues with partitions and create temporary table SELECT ...Michael Widenius2013-07-031-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merged all ddl_logging code. Merged sql_partition.cc innodb_mysql_lock2.test and partition_cache.test now works. Changed interface to strconvert() to make it easier to use with not \0 terminated strings. sql/sql_partition.cc: Full merge with 5.6 sql/sql_table.cc: Merged all ddl_logging code sql/strfunc.cc: Added from_length argument to strconvert() to make it possible to use without end terminated strings. sql/strfunc.h: Added from_length argument to strconvert() to make it possible to use without end terminated strings.
| * | | | mdl_sync now works.Michael Widenius2013-07-021-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql-test/r/mdl_sync.result: Full merge with 5.6 mysql-test/t/mdl_sync.test: Full merge with 5.6 sql/debug_sync.cc: Full merge with 5.6 sql/debug_sync.h: Full merge with 5.6 sql/mdl.cc: Full merge with 5.6 sql/sql_base.cc: Removed code not in 5.6 anymore
| * | | | merge of 2876.430.11 & 2876.430.1unknown2013-06-271-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | CF_PREOPEN_TMP_TABLES & CF_HA_CLOSE & Patch for Bug#11746602 (27480: Extend CREATE TEMPORARY TABLES privilege to allow temp table operations).
| * | | | Don't update table and index statics for temporary tablesMichael Widenius2013-06-221-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed type and testing of last_update type for innodb_table_stats mysql-test/r/connect.result: Removed tables which are not created anymore sql/item_sum.h: Fixed typo sql/sql_base.cc: Don't update table and index statics for temporary tables sql/sys_vars.cc: Merge storage/innobase/dict/dict0stats.cc: Fixed type last_update to TIMESTAMP.
| * | | | Case when we close temporary table which was not opened in its engine (ALTER ↵unknown2013-06-211-2/+7
| | | | | | | | | | | | | | | | | | | | TABLE) fixed.
| * | | | Fixed some memory leaksMichael Widenius2013-06-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Disabled some asserts that we can't yet have enabled
| * | | | Fixed some merge issues:Michael Widenius2013-06-181-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - temporary tables now works - mysql-system_tables updated to not use temporary tables - PASSWORD() function fixed - Support for STATS_AUTO_RECALC, STATS_PERSISTENT and STATS_SAMPLE_PAGES table options
| * | | | More merge fixes:Michael Widenius2013-06-161-38/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - mdl.cc and mdl.h merged completely - mysql_system_tables*.sql merged completely - Fixed wrong merge of lock_tables - Added some missing functions: - bool THD::notify_shared_lock() - Dynamic_array::pop, Dynamic_array::del - Added MDL_context_owner to THD - Added metadata_locks_hash_instances
| * | | | Applied all changes from Igor and SanjaMichael Widenius2013-06-151-276/+556
| | | | |
* | | | | 10.0-base mergeSergei Golubchik2013-07-181-9/+8
|\ \ \ \ \ | | |/ / / | |/| | |
| * | | | 5.5 mergeSergei Golubchik2013-07-171-1/+1
| |\ \ \ \ | | | |/ / | | |/| |
| | * | | mysql-5.5.32 mergeSergei Golubchik2013-07-161-1/+1
| | |\ \ \
| | | * | | Fix for Bug 16395495 - OLD FSF ADDRESS IN GPL HEADERMurthy Narkedimilli2013-03-191-1/+1
| | | | | |
| * | | | | MDEV-4456 Reverse discovery of ARCHIVE table on SELECT after disappearance ↵Sergei Golubchik2013-06-161-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of ARZ file Implement discovery of table non-existence, and related changes: 1. Split GTS_FORCE_DISCOVERY (that was meaning two different things in two different functions) into GTS_FORCE_DISCOVERY and GTS_USE_DISCOVERY. 2. Move GTS_FORCE_DISCOVERY implementation into open_table_def(). 3. In recover_from_failed_open() clear old errors *before* discovery, not after successful discovery. The final error should come from the discovery. 4. On forced discovery delete table .frm first. Discovery will write a new one, if desired. 5. If the frm file exists, but not the table in the engine, force rediscovery if the engine supports it.
* | | | | | 10.0-base mergeSergei Golubchik2013-06-061-2/+2
|\ \ \ \ \ \ | |/ / / / / | | | | | | | | | | | | (without InnoDB - all InnoDB changes were ignored)
| * | | | | 5.5 mergeSergei Golubchik2013-06-061-2/+2
| |\ \ \ \ \ | | |/ / / /
| | * | | | strmake_buf(X,Y) helper, equivalent to strmake(X,Y,sizeof(X)-1)Sergei Golubchik2013-04-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | with a bit of lame protection against abuse.
* | | | | | Merge 10.0-base -> 10.0 (GTID).unknown2013-04-171-3/+12
|\ \ \ \ \ \ | |/ / / / /
| * | | | | MDEV-26: Global transaction ID. First alpha release.unknown2013-04-151-3/+12
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge of 10.0-mdev26 feature tree into 10.0-base. Global transaction ID is prepended to each event group in the binlog. Slave connect can request to start from GTID position instead of specifying file name/offset of master binlog. This facilitates easy switch to a new master. Slave GTID state is stored in a table mysql.rpl_slave_state, which can be InnoDB to get crash-safe slave state. GTID includes a replication domain ID, allowing to keep track of distinct positions for each of multiple masters.
| | * | | | | MDEV-26: Global transaction ID.unknown2013-03-261-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix remaining two sporadic test failures in the full test suite: - Remove crash in DBUG_ASSERT() in _db_flush() (bug also exists in main tree). - Fix locking order violation for LOCK_status by temporarily unlocking it while locking LOCK_active_mi (like a similar fix for LOCK_global_variables).
| | * | | | | MDEV-26: Global transaction IDunknown2013-02-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix lock order violation. Make sure we temporarily release LOCK_global_system_variables before taking LOCK_active_mi. Otherwise we get a lock dependency cycle when we use open_tables() under LOCK_active_mi.
| | * | | | | MDEV-500: Session variable for server_idunknown2012-10-231-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-26: Global transaction id, partial commit Change server_id to be a session variable. User with SUPER can set it to binlog with different server_id. Implement backward-compatible ::server_id mirror for plugins.
* | | | | | | remove numerous #ifdef HAVE_PSI_TABLE_INTERFACESergei Golubchik2013-04-151-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | simplify ha_table_share_psi()
* | | | | | | 10.0-base mergeSergei Golubchik2013-04-151-417/+263
|\ \ \ \ \ \ \ | |/ / / / / / | | | | | / / | |_|_|_|/ / |/| | | | |
| * | | | | 5.5 mergeSergei Golubchik2013-04-141-1/+0
| |\ \ \ \ \ | | | |/ / / | | |/| | |
| | * | | | 5.3 mergeSergei Golubchik2013-04-121-1/+0
| | |\ \ \ \ | | | | |_|/ | | | |/| |
| | | * | | MDEV-4316 MariaDB server crash with signal 11Sergei Golubchik2013-04-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fulltext search was initialized for all MATCH ... AGAINST items at the end of the JOIN::optimize(). But since 5.3 derived tables are initialized lazily on first use, very late in the sub_select(). Skip Item_func_match::init_search initialization if the corresponding table isn't open yet; repeat fulltext initialization for all not-yet-initialized MATCH ... AGAINST items after creating derived tables.
| | | * | | 5.2 -> 5.3Sergei Golubchik2013-02-281-22/+28
| | | |\ \ \
| | | | * \ \ 5.1 -> 5.2 mergeSergei Golubchik2013-02-281-22/+28
| | | | |\ \ \
| | | | | * \ \ mysql-5.1 mergeSergei Golubchik2013-02-281-22/+28
| | | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysys/errors.c: revert upstream's fix. use a much simpler one mysys/my_write.c: revert upstream's fix. use a simpler one sql/item_xmlfunc.cc: useless, but ok sql/mysqld.cc: simplify upstream's fix storage/heap/hp_delete.c: remove upstream's fix. we'll use a much less expensive approach.
| * | | | | | | | optimize discovery for cases when the storage engine is known in advanceSergei Golubchik2013-04-091-1/+5
| | | | | | | | |
| * | | | | | | | test_sql_discovery storage engineSergei Golubchik2013-04-091-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | use it to test main test cases with need_full_discover_for_existence > 0
| * | | | | | | | CREATE TABLE and frm-less discovering engines.Sergei Golubchik2013-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now CREATE TABLE does not write the frm file on disk, if the engine can discover it
| * | | | | | | | if discovery in recover_from_failed_open fails, don't bother to reopenSergei Golubchik2013-04-091-3/+6
| | | | | | | | |
| * | | | | | | | remove dd_frm_type(), dd_frm_storage_engine(), dd_check_storage_engine_flag()Sergei Golubchik2013-04-091-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from everywhere - now RENAME, SHOW FULL TABLES, and TRUNCATE work with discovery. improve error messages in truncate
| * | | | | | | | single table discovery: handlerton::discover_table() method.Sergei Golubchik2013-04-091-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes for need_full_discover_for_existence mode