summaryrefslogtreecommitdiff
path: root/sql/sql_partition_admin.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.4 into 10.5Jan Lindström2022-09-051-0/+1
|\
| * Reduce compilation dependencies on wsrep_mysqld.hDaniele Sciascia2022-08-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making changes to wsrep_mysqld.h causes large parts of server code to be recompiled. The reason is that wsrep_mysqld.h is included by sql_class.h, even tough very little of wsrep_mysqld.h is needed in sql_class.h. This commit introduces a new header file, wsrep_on.h, which is meant to be included from sql_class.h, and contains only macros and variable declarations used to determine whether wsrep is enabled. Also, header wsrep.h should only contain definitions that are also used outside of sql/. Therefore, move WSREP_TO_ISOLATION* and WSREP_SYNC_WAIT macros to wsrep_mysqld.h. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
* | Merge 10.4 into 10.5Marko Mäkelä2022-06-021-0/+8
|\ \ | |/
| * Merge 10.3 into 10.4Marko Mäkelä2022-06-021-0/+8
| |\
| | * MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead ↵Masashi Tomooka2022-05-301-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of ER_WRONG_OBJECT ER_CHECK_NO_SUCH_TABLE was raised because a view does not have the corresponding TABLE instance connected to TABLE_LIST and the server interprets the absence as the absence of the table itself. To fix the problem, we add a check to ensure that the target table to be swapped with a partition is not a view. Reviewed by: Nayuta Yanagisawa
* | | Merge 10.4 into 10.5Marko Mäkelä2022-05-231-2/+7
|\ \ \ | |/ /
| * | Merge 10.4 into 10.5Marko Mäkelä2022-05-231-2/+7
| |\ \ | | |/
| | * MDEV-14642 Assertion 'table->s->db_create_options == ↵KiyoshiTakeda2022-05-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | part_table->s->db_create_options' failed in compare_table_with_partition When trying to execute ALTER TABLE EXCHANGE PARTITION with different definitions, assertion table->s->db_create_options == part_table->s->db_create_options failed in compare_table_with_partition(). However, this execution should not be allowed since executing 'exchange partition' requires the identical structure of the two tables. To fix the problem, I deleted the assertion code and added code that returns an error that indicates tables have different definitions. Reviewed By: Nayuta Yanagisawa
* | | MDEV-23357 Server crashes in ↵Sergei Golubchik2020-07-311-3/+3
| | | | | | | | | | | | Sql_cmd_alter_table_exchange_partition::exchange_partition
* | | Make all #sql temporary table names uniformMonty2020-04-191-2/+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-6/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Split tdc_remove_table()Sergey Vojtovich2020-04-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TDC_RT_REMOVE_ALL -> tdc_remove_table(). Some occurrences replaced with TDC_element::flush() (whenver TABLE_SHARE is available). TDC_RT_REMOVE_NOT_OWN[_KEEP_SHARE] -> TDC_element::flush(). These modes assume that current thread owns TABLE_SHARE reference, which means we can avoid hash lookup and flush unused TABLE instances directly. TDC_RT_REMOVE_UNUSED -> TDC_element::flush_unused(). Only [ab]used by mysql_admin_table() currently. Should be removed eventually. Part of MDEV-17882 - Cleanup refresh version
* | | MDEV-21702 Add a data type for privilegesAlexander Barkov2020-02-111-1/+1
| | |
* | | Removed kill_delayed_threads_for_table()Sergey Vojtovich2019-11-251-1/+1
|/ / | | | | | | | | | | | | | | | | | | After 7fb9d64 it is used only by ALTER/DROP SERVER, which most probably wasn't intentional as Federated never supported delayed inserts anyway. If delayed inserts will ever become an issue with ALTER/DROP SERVER, we should kill them by acquiring X-lock instead. Part of MDEV-17882 - Cleanup refresh version
* | Merge remote-tracking branch 'origin/10.3' into 10.4Alexander Barkov2019-10-011-1/+1
|\ \ | |/
| * Merge remote-tracking branch 'origin/10.2' into 10.3Alexander Barkov2019-10-011-1/+1
| |\
| | * Fix -Wunused for CMAKE_BUILD_TYPE=RelWithDebInfoMarko Mäkelä2019-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | For release builds, do not declare unused variables. unpack_row(): Omit a debug-only variable from WSREP diagnostic message. create_wsrep_THD(): Fix -Wmaybe-uninitialized for the PSI_thread_key.
* | | 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-3/+2
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | post-merge: gcc 8 warningsSergei Golubchik2019-03-171-2/+2
| | | | |
| * | | | Merge branch '10.2' into 10.3Sergei Golubchik2019-03-171-1/+0
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.1 into 10.2Marko Mäkelä2019-03-041-1/+0
| | |\ \ \ | | | |/ /
| | | * | MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned offAlexander Barkov2019-03-041-1/+0
| | | | |
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-11-061-2/+2
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into 10.3Marko Mäkelä2018-11-061-2/+2
| |\ \ \ \ | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | |\ \ \ | | | |/ /
* | | | | MDEV-11953: support of brackets in UNION/EXCEPT/INTERSECT operationsOleksandr Byelkin2018-07-041-2/+2
|/ / / /
* | | | Remove mem_alloc_error()Michael Widenius2018-05-071-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As thd->alloc() and new automatically calls my_error(ER_OUTOFMEORY) there is no reason to call mem_alloc_error() Other things: - Fixed bug in mysql_unpack_partition() where lex.part_info was changed even if it would be a null pointer
* | | | Add likely/unlikely to speed up executionMonty2018-05-071-51/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added to: - if (error) - Lex - sql_yacc.yy and sql_yacc_ora.yy - In header files to alloc() calls - Added thd argument to thd_net_is_killed()
* | | | Merge 10.2 into 10.3Marko Mäkelä2018-04-241-1/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.1 into 10.2Marko Mäkelä2018-04-241-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.0 into 10.1Marko Mäkelä2018-04-241-1/+1
| | |\ \
| | | * | MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under ↵Sergei Golubchik2018-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LOCK TABLE after ER_SAME_NAME_PARTITION ALTER TABLE ... ADD PARTITION modifies the open TABLE structure, and sets table->need_reopen=1 to reset these modifications in case of an error. But under LOCK TABLES the table isn't get reopened, despite need_reopen. Fixed by reopening need_reopen tables under LOCK TABLE.
* | | | | Move alter partition flags to alter_info->partition_flagsMonty2018-03-291-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done to get more free flag bits for alter_info->flags Renamed all ALTER PARTITION defines to start with ALTER_PARTITION_ Renamed ALTER_PARTITION to ALTER_PARTITION_INFO Renamed ALTER_TABLE_REORG to ALTER_PARTITION_TABLE_REORG Other things: - Shifted some ALTER_xxx defines to get empty bits at end
* | | | | Changed static const in Alter_info and Alter_online_info to definesMonty2018-03-291-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Main reason was to make it easier to print the above structures in a debugger. Additional benefits is that I was able to use same defines for both structures, which simplifes some code. Most of the code is just removing Alter_info:: and Alter_inplace_info:: from alter table flags. Following renames was done: HA_ALTER_FLAGS -> alter_table_operations CHANGE_CREATE_OPTION -> ALTER_CHANGE_CREATE_OPTION Alter_info::ADD_INDEX -> ALTER_ADD_INDEX DROP_INDEX -> ALTER_DROP_INDEX ADD_UNIQUE_INDEX -> ALTER_ADD_UNIQUE_INDEX DROP_UNIQUE_INDEx -> ALTER_DROP_UNIQUE_INDEX ADD_PK_INDEX -> ALTER_ADD_PK_INDEX DROP_PK_INDEX -> ALTER_DROP_PK_INDEX Alter_info:ALTER_ADD_COLUMN -> ALTER_PARSE_ADD_COLUMN Alter_info:ALTER_DROP_COLUMN -> ALTER_PARSE_DROP_COLUMN Alter_inplace_info::ADD_INDEX -> ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX Alter_inplace_info::DROP_INDEX -> ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX Other things: - Added typedef alter_table_operatons for alter table flags - DROP CHECK CONSTRAINT can now be done online - Added checks for Aria tables in alter_table_online.test - alter_table_flags now takes an ulonglong as argument. - Don't support online operations if checksum option is used. - sql_lex.cc doesn't add ALTER_ADD_INDEX if index is not created
* | | | | Changed database, tablename and alias to be LEX_CSTRINGMonty2018-01-301-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done in, among other things: - thd->db and thd->db_length - TABLE_LIST tablename, db, alias and schema_name - Audit plugin database name - lex->db - All db and table names in Alter_table_ctx - st_select_lex db Other things: - Changed a lot of functions to take const LEX_CSTRING* as argument for db, table_name and alias. See init_one_table() as an example. - Changed some function arguments from LEX_CSTRING to const LEX_CSTRING - Changed some lists from LEX_STRING to LEX_CSTRING - threads_mysql.result changed because process list_db wasn't always correctly updated - New append_identifier() function that takes LEX_CSTRING* as arguments - Added new element tmp_buff to Alter_table_ctx to separate temp name handling from temporary space - Ensure we store the length after my_casedn_str() of table/db names - Removed not used version of rename_table_in_stat_tables() - Changed Natural_join_column::table_name and db_name() to never return NULL (used for print) - thd->get_db() now returns db as a printable string (thd->db.str or "")
* | | | | MDEV-11084 Select statement with partition selection against MyISAM table ↵Alexey Botchkov2018-01-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | opens all partitions. Now we don't open partitions if it was explicitly cpecified. ha_partition::m_opened_partition bitmap added to track partitions that were actually opened.
* | | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2018-01-051-8/+4
|\ \ \ \ \
| * \ \ \ \ Merge remote-tracking branch 'origin/10.2' into bb-10.2-extMonty2018-01-051-8/+4
| |\ \ \ \ \ | | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mysql-test/r/cte_nonrecursive.result mysql-test/suite/galera/r/galera_bf_abort.result mysql-test/suite/galera/r/galera_bf_abort_get_lock.result mysql-test/suite/galera/r/galera_bf_abort_sleep.result mysql-test/suite/galera/r/galera_enum.result mysql-test/suite/galera/r/galera_fk_conflict.result mysql-test/suite/galera/r/galera_insert_multi.result mysql-test/suite/galera/r/galera_many_indexes.result mysql-test/suite/galera/r/galera_mdl_race.result mysql-test/suite/galera/r/galera_nopk_bit.result mysql-test/suite/galera/r/galera_nopk_blob.result mysql-test/suite/galera/r/galera_nopk_large_varchar.result mysql-test/suite/galera/r/galera_nopk_unicode.result mysql-test/suite/galera/r/galera_pk_bigint_signed.result mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result mysql-test/suite/galera/r/galera_serializable.result mysql-test/suite/galera/r/galera_toi_drop_database.result mysql-test/suite/galera/r/galera_toi_lock_exclusive.result mysql-test/suite/galera/r/galera_toi_truncate.result mysql-test/suite/galera/r/galera_unicode_pk.result mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result mysql-test/suite/galera/r/galera_wsrep_log_conficts.result sql/field.cc sql/rpl_gtid.cc sql/share/errmsg-utf8.txt sql/sql_acl.cc sql/sql_parse.cc sql/sql_partition_admin.cc sql/sql_prepare.cc sql/sql_repl.cc sql/sql_table.cc sql/sql_yacc.yy
| | * | | | Fixed wrong arguments to printf and related functionsMonty2018-01-041-18/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Other things, mainly to get create_mysqld_error_find_printf_error tool to work: - Added protection to not include mysqld_error.h twice - Include "unireg.h" instead of "mysqld_error.h" in server - Added protection if ER_XX messages are already defined - Removed wrong calls to my_error(ER_OUTOFMEMORY) as my_malloc() and my_alloc will do this automatically - Added missing %s to ER_DUP_QUERY_NAME - Removed old and wrong calls to my_strerror() when using MY_ERROR_ON_RENAME (wrong merge) - Fixed deadlock error message from Galera. Before the extra information given to ER_LOCK_DEADLOCK was missing because ER_LOCK_DEADLOCK doesn't provide any extra information. I kept #ifdef mysqld_error_find_printf_error_used in sql_acl.h to make it easy to do this kind of check again in the future
* | | | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-11-101-1/+1
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Add more execution stages (commit, rollback, etc)Monty2017-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done to get more information about where time is spent. Now we can get proper timing for time spent in commit, rollback, binlog write etc. Following stages was added: - Commit - Commit_implicit - Rollback - Rollback implicit - Binlog write - Init for update - This is used instead of "Init" for insert, update and delete. - Staring cleanup Following stages where changed: - "Unlocking tables" stage reset stage to previous stage at end - "binlog write" stage resets stage to previous stage at end - "end" -> "end of update loop" - "cleaning up" -> "Reset for next command" - Added stage_searching_rows_for_update when searching for rows to be deleted. Other things: - Renamed all stages to start with big letter (before there was no consitency) - Increased performance_schema_max_stage_classes from 150 to 160. - Most of the test changes in performance schema comes from renaming of stages. - Removed duplicate output of variables and inital state in a lot of performance schema tests. This was done to make it easier to change a default value for a performance variable without affecting all tests. - Added start_server_variables.test to check configuration - Removed some duplicate "closing tables" stages - Updated position for "stage_init_update" and "stage_updating" for delete, insert and update to be just before update loop (for more exact timing). - Don't set "Checking permissions" twice in a row. - Remove stage_end stage from creating views (not done for create table either). - Updated default performance history size from 10 to 20 because of new stages - Ensure that ps_enabled is correct (to be used in a later patch)
* | | | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-09-211-2/+5
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.2 into bb-10.2-extMarko Mäkelä2017-09-201-2/+5
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge branch '10.1' into 10.2Vicențiu Ciorbaru2017-09-191-2/+5
| | |\ \ \ \ | | | |/ / /
| | | * | | MDEV-13157 Specifying DATA DIRECTORY in tables leads to failing EXCHANGE ↵Sergei Golubchik2017-09-181-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | PARTITION