summaryrefslogtreecommitdiff
path: root/sql/sql_partition_admin.cc
Commit message (Collapse)AuthorAgeFilesLines
* Revert MDEV-25292 Atomic CREATE OR REPLACE TABLESergei Golubchik2022-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically: Revert "MDEV-29664 Assertion `!n_mysql_tables_in_use' failed in innobase_close_connection" This reverts commit ba875e939619baefb08936863a889830f595e426. Revert "MDEV-29620 Assertion `next_insert_id == 0' failed in handler::ha_external_lock" This reverts commit aa08a7442a5141750de96353132c7799e10c9302. Revert "MDEV-29628 Memory leak after CREATE OR REPLACE with foreign key" This reverts commit c579d66ba689c8a20a951de5e6be2e1bc255ba7f. Revert "MDEV-29609 create_not_windows test fails with different result" This reverts commit cb583b2f1bf1c910e82c7caee4a53e0f3ff954ba. Revert "MDEV-29544 SIGSEGV in HA_CREATE_INFO::finalize_locked_tables" This reverts commit dcd66c3814991e686615eac2e65d01a7fa80cb66. Revert "MDEV-28933 CREATE OR REPLACE fails to recreate same constraint name" This reverts commit cf6c5176328c8fbfadac80f337ef285732cc8d06. Revert "MDEV-28933 Moved RENAME_CONSTRAINT_IDS to include/sql_funcs.h" This reverts commit f1e1c1335b506905244502ee8584736a17a6ecd0. Revert "MDEV-28956 Locking is broken if CREATE OR REPLACE fails under LOCK TABLES" This reverts commit a228ec80e30cae59c2057b786fd3559171ce794f. Revert "MDEV-25292 gcol.gcol_bugfixes --ps fix" This reverts commit 24fff8267d0722b20ca780cf144ce27560df1394. Revert "MDEV-25292 Disable atomic replace for slave-generated or-replace" This reverts commit 2af15914cb3ae204d3b413995a96c7722ad60d93. Revert "MDEV-25292 backup_log improved" This reverts commit 34398a20b5829f0508c78bc8f765f7bef6e0ad48. Revert "MDEV-25292 Atomic CREATE OR REPLACE TABLE" This reverts commit 93c8252f02faa8ad8dc5f005e52f1990c29d4a0d. Revert "MDEV-25292 Table_name class for (db, table_name, alias)" This reverts commit d145dda9c7b6db394edf7150cc255343a4a7b116. Revert "MDEV-25292 ha_table_exists() cleanup and improvement" This reverts commit 409b8a86de45efc96377c618a99cff1301523150. Revert "MDEV-25292 Cleanups" This reverts commit 595dad83ad3c23879c59deec1173ea16b47871ed. Revert "MDEV-25292 Refactoring: moved select_field_count into Alter_info." This reverts commit f02af1d2295f108d96671b5a4f731ec998002dd5.
* Merge 10.10 into 10.11Jan Lindström2022-09-061-0/+1
|\
| * Merge 10.8 into 10.9Jan Lindström2022-09-061-0/+1
| |\
| | * Merge 10.6 into 10.7Jan Lindström2022-09-051-0/+1
| | |\
| | | * Merge 10.5 into 10.6Jan Lindström2022-09-051-0/+1
| | | |\
| | | | * 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>
* | | | | | MDEV-25292 CleanupsAleksey Midenkov2022-08-311-1/+1
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ddl_log_write_execute_entry() cleanup Rename functions renamed: do_rename() -> rename_table_and_triggers() do_rename_temporary() -> rename_temporary_table() check_rename() -> rename_check_preconditions()
* | | | | Merge 10.8 into 10.9Marko Mäkelä2022-06-071-0/+8
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.6 into 10.7Marko Mäkelä2022-06-061-0/+8
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.5 into 10.6Marko Mäkelä2022-06-021-0/+8
| | |\ \ \ | | | |/ /
| | | * | 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.8 into 10.9Marko Mäkelä2022-05-251-2/+7
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.6 into 10.7Marko Mäkelä2022-05-241-2/+7
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.5 into 10.6Marko Mäkelä2022-05-231-2/+7
| | |\ \ \ \ | | | |/ / /
| | | * | | 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
* | | | | | Main patch MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET ↵Alexander Barkov2022-05-241-1/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | latin1` on the table or the database level Also fixes MDEV-27782 Wrong columns when using table level `CHARACTER SET utf8mb4 COLLATE DEFAULT` MDEV-28644 Unexpected error on ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb3, DEFAULT CHARACTER SET utf8mb4
* | | | | MDEV-22165 CONVERT TABLE: move in partition from existing tableAleksey Midenkov2021-10-261-5/+52
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Syntax for CONVERT TABLE ALTER TABLE tbl_name CONVERT TABLE tbl_name TO PARTITION partition_name partition_spec Examples: ALTER TABLE t1 CONVERT TABLE tp2 TO PARTITION p2 VALUES LESS THAN MAX_VALUE(); New ALTER_PARTITION_CONVERT_IN command for fast_alter_partition_table() is done in alter_partition_convert_in() function which basically does ha_rename_table(). Table structure and data check is basically the same as in EXCHANGE PARTITION command. And these are done by compare_table_with_partition() and check_table_data(). Atomic DDL is done by the scheme from MDEV-22166 (see the corresponding commit message). The only differnce is that it also has to drop source table frm and that is done by WFRM_DROP_CONVERTED_FROM. Initial patch was done by Dmitry Shulga <dmitry.shulga@mariadb.com>
* | | | MDEV-18465 Logging of DDL statements during backupMonty2021-05-191-1/+48
| | | | | | | | | | | | | | | | | | | | Many of the changes was needed to be able to collect and print engine name and table version id's in the ddl log.
* | | | MDEV-23842 Atomic RENAME TABLEMonty2021-05-191-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Major rewrite of ddl_log.cc and ddl_log.h - ddl_log.cc described in the beginning how the recovery works. - ddl_log.log has unique signature and is dynamic. It's easy to add more information to the header and other ddl blocks while still being able to execute old ddl entries. - IO_SIZE for ddl blocks is now dynamic. Can be changed without affecting recovery of old logs. - Code is more modular and is now usable outside of partition handling. - Renamed log file to dll_recovery.log and added option --log-ddl-recovery to allow one to specify the path & filename. - Added ddl_log_entry_phase[], number of phases for each DDL action, which allowed me to greatly simply set_global_from_ddl_log_entry() - Changed how strings are stored in log entries, which allows us to store much more information in a log entry. - ddl log is now always created at start and deleted on normal shutdown. This simplices things notable. - Added probes debug_crash_here() and debug_simulate_error() to simply crash testing and allow crash after a given number of times a probe is executed. See comments in debug_sync.cc and rename_table.test for how this can be used. - Reverting failed table and view renames is done trough the ddl log. This ensures that the ddl log is tested also outside of recovery. - Added helper function 'handler::needs_lower_case_filenames()' - Extend binary log with Q_XID events. ddl log handling is using this to check if a ddl log entry was logged to the binary log (if yes, it will be deleted from the log during ddl_log_close_binlogged_events() - If a DDL entry fails 3 time, disable it. This is to ensure that if we have a crash in ddl recovery code the server will not get stuck in a forever crash-restart-crash loop. mysqltest.cc changes: - --die will now replace $variables with their values - $error will contain the error of the last failed statement storage engine changes: - maria_rename() was changed to be more robust against crashes during rename.
* | | | Rename all external ddl_log function to start with ddl_log_ prefixMonty2021-05-191-9/+9
| | | | | | | | | | | | | | | | Rename deactivate_ddl_log_entry to ddl_log_increment_phase
* | | | Move all ddl log code to ddl_log.cc and ddl_log.hMonty2021-05-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Part of prepration for: MDEV-17567 Atomic DDL No notable code changes except moving code around
* | | | Reduce usage of strlen()Monty2021-05-191-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes: - To detect automatic strlen() I removed the methods in String that uses 'const char *' without a length: - String::append(const char*) - Binary_string(const char *str) - String(const char *str, CHARSET_INFO *cs) - append_for_single_quote(const char *) All usage of append(const char*) is changed to either use String::append(char), String::append(const char*, size_t length) or String::append(LEX_CSTRING) - Added STRING_WITH_LEN() around constant string arguments to String::append() - Added overflow argument to escape_string_for_mysql() and escape_quotes_for_mysql() instead of returning (size_t) -1 on overflow. This was needed as most usage of the above functions never tested the result for -1 and would have given wrong results or crashes in case of overflows. - Added Item_func_or_sum::func_name_cstring(), which returns LEX_CSTRING. Changed all Item_func::func_name()'s to func_name_cstring()'s. The old Item_func_or_sum::func_name() is now an inline function that returns func_name_cstring().str. - Changed Item::mode_name() and Item::func_name_ext() to return LEX_CSTRING. - Changed for some functions the name argument from const char * to to const LEX_CSTRING &: - Item::Item_func_fix_attributes() - Item::check_type_...() - Type_std_attributes::agg_item_collations() - Type_std_attributes::agg_item_set_converter() - Type_std_attributes::agg_arg_charsets...() - Type_handler_hybrid_field_type::aggregate_for_result() - Type_handler_geometry::check_type_geom_or_binary() - Type_handler::Item_func_or_sum_illegal_param() - Predicant_to_list_comparator::add_value_skip_null() - Predicant_to_list_comparator::add_value() - cmp_item_row::prepare_comparators() - cmp_item_row::aggregate_row_elements_for_comparison() - Cursor_ref::print_func() - Removes String_space() as it was only used in one cases and that could be simplified to not use String_space(), thanks to the fixed my_vsnprintf(). - Added some const LEX_CSTRING's for common strings: - NULL_clex_str, DATA_clex_str, INDEX_clex_str. - Changed primary_key_name to a LEX_CSTRING - Renamed String::set_quick() to String::set_buffer_if_not_allocated() to clarify what the function really does. - Rename of protocol function: bool store(const char *from, CHARSET_INFO *cs) to bool store_string_or_null(const char *from, CHARSET_INFO *cs). This was done to both clarify the difference between this 'store' function and also to make it easier to find unoptimal usage of store() calls. - Added Protocol::store(const LEX_CSTRING*, CHARSET_INFO*) - Changed some 'const char*' arrays to instead be of type LEX_CSTRING. - class Item_func_units now used LEX_CSTRING for name. Other things: - Fixed a bug in mysql.cc:construct_prompt() where a wrong escape character in the prompt would cause some part of the prompt to be duplicated. - Fixed a lot of instances where the length of the argument to append is known or easily obtain but was not used. - Removed some not needed 'virtual' definition for functions that was inherited from the parent. I added override to these. - Fixed Ordered_key::print() to preallocate needed buffer. Old code could case memory overruns. - Simplified some loops when adding char * to a String with delimiters.
* | | 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
|/ / / /