summaryrefslogtreecommitdiff
path: root/sql/sql_alter.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.4 into 10.5Marko Mäkelä2020-05-051-11/+23
|\
| * Merge 10.3 into 10.4Marko Mäkelä2020-05-051-11/+23
| |\
| | * MDEV-16288 ALTER TABLE…ALGORITHM=DEFAULT does not override alter_algorithmThirunarayanan Balathandayuthapani2020-05-041-11/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - ALTER_ALGORITHM should be substituted when there is no mention of algorithm in alter statement. - Introduced algorithm(thd) in Alter_info. It returns the user requested algorithm. If user doesn't specify algorithm explicitly then it returns alter_algorithm variable. - changed algorithm() to get_algorithm(thd) to return algorithm name for displaying the error. - set_requested_algorithm(algo_value) to avoid direct assignment on requested_algorithm variable. - Avoid direct access of requested_algorithm to encapsulate requested_algorithm variable
* | | Make all #sql temporary table names uniformMonty2020-04-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for this is to make all temporary file names similar and also to be able to figure out from where a #sql-xxx name orginates. New format is for most cases: '#sql-name-current_pid-thread_id[-increment]' Where name is one of subselect, alter, exchange, temptable or backup The exceptions are: ALTER PARTITION shadow files: '#sql-shadow-thread_id-'original_table_name' Names used with temp pool: '#sql-name-current_pid-pool_number'
* | | Added support for more functions when using partitioned S3 tablesMonty2020-04-191-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-22088 S3 partitioning support All ALTER PARTITION commands should now work on S3 tables except REBUILD PARTITION TRUNCATE PARTITION REORGANIZE PARTITION In addition, PARTIONED S3 TABLES can also be replicated. This is achived by storing the partition tables .frm and .par file on S3 for partitioned shared (S3) tables. The discovery methods are enchanced by allowing engines that supports discovery to also support of the partitioned tables .frm and .par file Things in more detail - The .frm and .par files of partitioned tables are stored in S3 and kept in sync. - Added hton callback create_partitioning_metadata to inform handler that metadata for a partitoned file has changed - Added back handler::discover_check_version() to be able to check if a table's or a part table's definition has changed. - Added handler::check_if_updates_are_ignored(). Needed for partitioning. - Renamed rebind() -> rebind_psi(), as it was before. - Changed CHF_xxx hadnler flags to an enum - Changed some checks from using table->file->ht to use table->file->partition_ht() to get discovery to work with partitioning. - If TABLE_SHARE::init_from_binary_frm_image() fails, ensure that we don't leave any .frm or .par files around. - Fixed that writefrm() doesn't leave unusable .frm files around - Appended extension to path for writefrm() to be able to reuse to function for creating .par files. - Added DBUG_PUSH("") to a a few functions that caused a lot of not critical tracing.
* | | Added support for replication for S3Monty2020-03-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-19964 S3 replication support Added new configure options: s3_slave_ignore_updates "If the slave has shares same S3 storage as the master" s3_replicate_alter_as_create_select "When converting S3 table to local table, log all rows in binary log" This allows on to configure slaves to have the S3 storage shared or independent from the master. Other thing: Added new session variable '@@sql_if_exists' to force IF_EXIST to DDL's.
* | | Added IF EXISTS to RENAME TABLE and ALTER TABLEMonty2020-03-241-1/+1
| | |
* | | MDEV-7318 RENAME INDEXAleksey Midenkov2020-03-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support of RENAME INDEX operation to the ALTER TABLE statement. Code which determines if ALTER TABLE can be done in-place for "simple" storage engines like MyISAM, Heap and etc. was updated to handle ALTER TABLE ... RENAME INDEX as an in-place operation. Support for in-place ALTER TABLE ... RENAME INDEX for InnoDB was covered by MDEV-13301. Syntax changes ============== A new type of <alter_specification> is added: <rename index clause> ::= RENAME ( INDEX | KEY ) <oldname> TO <newname> Where <oldname> and <newname> are identifiers for old name and new name of the index. Semantic changes ================ The result of "ALTER TABLE t1 RENAME INDEX a TO b" is a table which contents and structure are identical to the old version of 't1' with the only exception index 'a' being called 'b'. Neither <oldname> nor <newname> can be "primary". The index being renamed should exist and its new name should not be occupied by another index on the same table. Related to: WL#6555, MDEV-13301
* | | MDEV-20051: Add new mode to wsrep_OSU_method in which Galera checks storage ↵Jan Lindström2020-02-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | engine of the effected table Introduced a new wsrep_strict_ddl configuration variable in which Galera checks storage engine of the effected table. If table is not InnoDB (only storage engine currently fully supporting Galera replication) DDL-statement will return error code: ER_GALERA_REPLICATION_NOT_SUPPORTED eng "DDL-statement is forbidden as table storage engine does not support Galera replication" However, when wsrep_replicate_myisam=ON we allow DDL-statements to MyISAM tables. If effected table is allowed storage engine Galera will run normal TOI. This new setting should be for now set globally on all nodes in a cluster. When this setting is set following DDL-clauses accessing tables not supporting Galera replication are refused: * CREATE TABLE (e.g. CREATE TABLE t1(a int) engine=Aria * ALTER TABLE * TRUNCATE TABLE * CREATE VIEW * CREATE TRIGGER * CREATE INDEX * DROP INDEX * RENAME TABLE * DROP TABLE Statements on PROCEDURE, EVENT, FUNCTION are allowed as effected tables are known only at execution. Furthermore, USER, ROLE, SERVER, DATABASE statements are also allowed as they do not really have effected table.
* | | MDEV-21702 Add a data type for privilegesAlexander Barkov2020-02-111-2/+2
| | |
* | | MDEV-20480 Obsolete internal parser for FK in InnoDBAleksey Midenkov2019-11-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently InnoDB uses internal parser for adding foreign keys. Remove internal parser and use data parsed by SQL parser (sql_yacc) for adding foreign keys. - create_table_info_t::create_foreign_keys() replacement for dict_create_foreign_constraints_low(); - Pass constraint name via Foreign_key object. Temporary until MDEV-20865: - Pass alter_info as part of create_info.
* | | Merge 10.4 into 10.5Marko Mäkelä2019-06-181-0/+12
|\ \ \ | |/ /
| * | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-06-141-0/+12
| |\ \ | | |/
| | * Merge branch '10.2' into 10.3Oleksandr Byelkin2019-06-141-0/+12
| | |\
| | | * Merge 10.1 into 10.2Marko Mäkelä2019-06-121-0/+12
| | | |\
| | | | * MDEV-19653 Add class Sql_cmd_create_tableAlexander Barkov2019-05-311-0/+12
| | | | |
* | | | | MDEV-19612 Split ALTER related data type specific code in sql_table.cc to ↵Alexander Barkov2019-05-281-2/+16
|/ / / / | | | | | | | | | | | | Type_handler
* | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\ \ | | | |/
| | | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | |\
| | | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | * Update wrong zip-code
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-03-201-8/+3
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MDEV-17262 commit 26432e49d37a37d09b862bb49a021e44bdf4789c was skipped. In Galera 4, the implementation would seem to require changes to the streaming replication. In the tests archive.rnd_pos main.profiling, disable_ps_protocol for SHOW STATUS and SHOW PROFILE commands until MDEV-18974 has been fixed.
| * | | | Merge branch '10.2' into 10.3Sergei Golubchik2019-03-171-8/+3
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '10.1' into 10.2Sergei Golubchik2019-03-151-5/+5
| | |\ \ \ | | | |/ /
| | | * | fix gcc 8 compiler warningsSergei Golubchik2019-03-141-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two newly enabled warnings: 1. cast for a function pointers. Affected sql_analyse.h, mi_write.c and ma_write.cc, mf_iocache-t.cc, mysqlbinlog.cc, encryption.cc, etc 2. memcpy/memset of nontrivial structures. Fixed as: * the warning disabled for InnoDB * TABLE, TABLE_SHARE, and TABLE_LIST got a new method reset() which does the bzero(), which is safe for these classes, but any other bzero() will still cause a warning * Table_scope_and_contents_source_st uses `TABLE_LIST *` (trivial) instead of `SQL_I_List<TABLE_LIST>` (not trivial) so it's safe to bzero now. * added casts in debug_sync.cc and sql_select.cc (for JOIN) * move assignment method for MDL_request instead of memcpy() * PARTIAL_INDEX_INTERSECT_INFO::init() instead of bzero() * remove constructor from READ_RECORD() to make it trivial * replace some memcpy() with c++ copy assignments
| | * | | Merge 10.1 into 10.2Marko Mäkelä2019-03-041-4/+0
| | |\ \ \ | | | |/ /
| | | * | MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned offAlexander Barkov2019-03-041-4/+0
| | | | |
* | | | | Galera4Brave Galera Crew2019-01-231-0/+2
| | | | |
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-11-061-6/+3
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into 10.3Marko Mäkelä2018-11-061-7/+3
| |\ \ \ \ | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | main.derived_cond_pushdown: Move all 10.3 tests to the end, trim trailing white space, and add an "End of 10.3 tests" marker. Add --sorted_result to tests where the ordering is not deterministic. main.win_percentile: Add --sorted_result to tests where the ordering is no longer deterministic.
| | * | | Merge 10.1 into 10.2Marko Mäkelä2018-11-061-7/+4
| | |\ \ \ | | | |/ /
| | | * | wsrep: create a macro for the error: labelSergei Golubchik2018-10-241-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | that is used by WSREP_TO_ISOLATION_BEGIN and other galera macros, to avoid the need for wrapping this label in #ifdef WITH_WSREP/#endif
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-10-051-10/+14
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch '10.2' into 10.3Sergei Golubchik2018-09-281-10/+14
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '10.1' into 10.2Oleksandr Byelkin2018-09-141-7/+13
| | |\ \ \ | | | |/ /
| | | * | Merge branch '10.0-galera' into 10.1Sergei Golubchik2018-09-071-7/+13
| | | |\ \
| | | | * | Add missing WSREP(thd) condition and remove unnecessary DBUG_RETURN.Jan Lindström2018-08-021-3/+2
| | | | | |
| | | | * | Merge remote-tracking branch 'origin/5.5-galera' into 10.0-galeraJan Lindström2018-08-021-5/+12
| | | | |\ \
| | | | | * | Follow up to previous commit for codership/mysql-wsrep#332mariadb-galera-5.5.61Daniele Sciascia2018-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix misplaced `DBUG_RETURN` in `Alter_table_statement::execute`.
| | | | | * | Fix FK constraint violation in applier, after ALTER TABLE ADD FKDaniele Sciascia2018-08-021-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding a FK constraint to an existing table (ALTER TABLE ADD FOREIGN KEY) causes the applier to fail, if a concurrent DML statement that violate the new constraint (i.e. a DELETE or UPDATE of record in the parent table). For exmaple, the following scenario causes a crash in the applier: 1. ALTER successfully adds FK constraint in node_1 2. On node_2 is UPDATE is in pre_commit() and has certified successfully 3. ALTER is delivered in node_2 and BF aborts DML 4. Applying UPDATE event causes FK violation in node_1 To avoid this situation it is necessary for UPDATE to fail during certification. And for the UPDATE to fail certfication it is necessary that ALTER appends certification keys for both the child and the parent table. Before this patch, ALTER TABLE ADD FK only appended keys for child table which is ALTERed.
| | | | | * | MDEV#6148 main.flush_read_lock fails due to conflictingNirbhay Choubey2014-04-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | read lock TOI was being attempted even when WSREP_ON was not enabled (off). So, with FTWRL in place TOI later gets aborted & thus the failure. Fixed by adding a check to skip TOI if wsrep is not enabled.
| | | | | * | Merged revisions 3931--3942 from from lp:~codership/codership-mysql/5.5-23.Jan Lindström2013-11-251-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------ revno: 3942 committer: Seppo Jaakola <seppo.jaakola@codership.com> branch nick: wsrep-5.5-23 timestamp: Thu 2013-11-07 17:37:10 +0200 message: References: lp:1248921 - checking if index is foreign earlier to adhere to lat ch order protocol ------------------------------------------------------------ revno: 3941 fixes bug: https://launchpad.net/bugs/1248908 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Thu 2013-11-07 14:31:04 +0200 message: References lp:1248908 - Fixed access to trx sys header Pass trx sys header as argument for trx_sys_update_wsrep_checkpoint() and trx_sys_update_mysql_binlog_offset() to avoid successive calls to trx_sysf_get(). ------------------------------------------------------------ revno: 3940 fixes bug: https://launchpad.net/bugs/1244100 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Tue 2013-11-05 15:31:12 +0200 message: References lp:1244100 - assign value for check_purge before return ------------------------------------------------------------ revno: 3939 fixes bug: https://launchpad.net/bugs/1247978 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Tue 2013-11-05 01:01:36 +0200 message: References lp:1247978 - force release transactional MDL locks if wsrep is on a nd no active transaction at the end of mysql_execute_command() ------------------------------------------------------------ revno: 3938 committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-11-03 20:48:06 +0400 message: References lp:1232789 - fix FLUSH STATUS zeroes up wsrep_cluster_size and wsre p_local_index ------------------------------------------------------------ revno: 3937 5kB/s - committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-11-03 17:06:31 +0400 message: References lp:587170 - reset auto_increment_* vars to defaults for TOI operati ons ------------------------------------------------------------ revno: 3936 committer: Vladislav Klyachin <vladislav.klyachin@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-11-03 00:10:45 +0400 message: References lp:1072839 - fix for memory leaks with wsrep variables ------------------------------------------------------------ revno: 3935 committer: Seppo Jaakola <seppo.jaakola@codership.com> branch nick: wsrep-5.5-23 timestamp: Wed 2013-10-30 14:34:32 +0200 message: References: lp:1246257 - skipping replication for CREATE TEMPORARY TABLE LIKE. .. constructs ------------------------------------------------------------ revno: 3934 6kB/s \ fixes bug: https://launchpad.net/bugs/1241760 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Mon 2013-10-28 11:01:53 +0200 message: References lp:1241760 - save thd->db to wsrep_thd_shadow before replay ------------------------------------------------------------ revno: 3933 fixes bug: https://launchpad.net/bugs/1206129 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-10-27 18:15:12 +0200 message: References lp:1206129 - check binlog_hton->commit() return value, call wsrep_p ost_commit() instead of wsrep_cleanup_transaction() ------------------------------------------------------------ revno: 3932 fixes bug: https://launchpad.net/bugs/1244661 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-10-27 13:14:02 +0200 message: References lp:1244661 - added wsrep_register_hton() to trans_rollback_implicit () ------------------------------------------------------------ revno: 3931 fixes bug: https://launchpad.net/bugs/1244667 committer: Teemu Ollakka <teemu.ollakka@codership.com> branch nick: 5.5-23 timestamp: Sun 2013-10-27 11:08:49 +0200 message: References lp:1244667 - restore thd->server_status after replay
| | | | | * | Merged changes from lp:codership-mysql up to rev 3743Seppo Jaakola2012-04-261-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -r3725..3737 -r3738..3740 -r3741..3743
| | | | | * | Initial push of codership-wsrep API implementation for MariaDB. Seppo Jaakola2012-04-131-1/+16
| | | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge of: lp:maria/5.5, #3334: http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/3334 lp:codership-mysql/5.5, #3725: http://bazaar.launchpad.net/~codership/codership-mysql/wsrep-5.5/revision/3725
| | * | | | Merge branch '10.1' into 10.2Sergei Golubchik2018-06-211-3/+0
| | |\ \ \ \ | | | |/ / /
| | | * | | fix compilation w/o partitioningSergei Golubchik2018-06-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | followup for d8da920264a
* | | | | | MDEV-11953: support of brackets in UNION/EXCEPT/INTERSECT operationsOleksandr Byelkin2018-07-041-2/+2
|/ / / / /
* | | | | MDEV-16102 Wrong ER_DUP_ENTRY upon ADD UNIQUE KEY on versioned tableAleksey Midenkov2018-06-301-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ignore CHECK constraint for historical rows; * FOREIGN KEY test case. TODO: MDEV-16301 IB: use real table name for error messages on ALTER Closes tempesta-tech/mariadb#491 Closes #748
* | | | | Merge 10.2 into 10.3Marko Mäkelä2018-05-291-2/+5
|\ \ \ \ \ | |/ / / /