summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-28929: Plan selection takes forever with MDEV-28852 ...bb-10.10-spetrunia2bb-10.10-mdev28929-v4Sergei Petrunia2022-07-196-178/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | Part #2: Extend heuristic pruning to use multiple tables as the "Model tables". Before the patch, heuristic pruning uses only one "Model table": The table which had the best cost AND record became the "Model table". After that, if a table's cost and record were both worse than those of the Model Table, the table would be pruned away. This didn't work well when the first table (the optimizer sorts them by record_count) had low record_count but relatively high cost: nothing could be pruned afterwards. The patch adds the two additional "Model tables": one with the least cost and the other with the least record_count. (In both cases, a table can be pruned away if BOTH its cost and record_count are worse than those of a Model table) The new pruning is active when the number of tables to consider for the prefix is higher than @@optimizer_extra_pruning_depth. One can see the new pruning in the Optimizer Trace as - "pruned_by_heuristic":"min_record_count", or - "pruned_by_heuristic":"min_read_time". Old heuristic pruning shows as "pruned_by_heuristic":1.
* MDEV-28881 Fix memory leak caused by STL usageOleg Smirnov2022-07-131-17/+29
| | | | | | | Dep_analysis_context::create_unique_pseudo_key_if_needed() was using std::set which allocated memory outside MEM_ROOT and so required explicit deallocation. This has been solved by replacing std::set with MY_BITMAP which is allocated on MEM_ROOT
* MDEV-28881 Server crash in Dep_analysis_context::create_table_valueOleg Smirnov2022-07-133-2/+44
| | | | | | | SELECT_LEX::first_select()->join is NULL for degenerate derived tables which are known to have just one row and so were already materialized by the optimizer. This commit adds a check for this.
* MDEV-26278 Add functionality to eliminate derived tables from the queryOleg Smirnov2022-07-135-20/+650
| | | | | | | | | | | | | | | | | | | | | | | | Elimination of unnecessary tables from SQL queries is already present in MariaDB. But it only works for regular tables and not for derived ones. Imagine we have a view: CREATE VIEW v1 AS SELECT a, b, max(c) AS maxc FROM t1 GROUP BY a, b Due to "GROUP BY a, b" the values of combinations {a, b} are unique, and this fact can be treated as like derived table "v1" has a unique key on fields {a, b}. Suppose we have a SQL query: SELECT t2.* FROM t2 LEFT JOIN v1 ON t2.a=v1.a and t2.b=v1.b 1. Since {v1.a, v1.b} is unique and both these fields are bound to t2, "v1" is functionally dependent on t2. This means every record of "t2" will be either joined with a single record of "v1" or NULL-complemented. 2. No fields of "v1" are present on the SELECT list These two facts allow the server to completely exclude (eliminate) the derived table "v1" from the query.
* Reduced size of POSITIONMonty2022-06-293-13/+12
| | | | | | | | | | Replaced Cost_estimate prefix_cost with a double as prefix_cost was only used to store and retrive total prefix cost. This also speeds up things (a bit) as don't have to call Cost_estimate::total_cost() for every access to the prefix_cost. Sizeof POSITION decreased from 304 to 256.
* Added current_cost and best_cost to optimizer trace when pruning by costMonty2022-06-292-27/+79
| | | | This helps a lot when trying to find out why a table combination was pruned
* Added EQ_REF chaining to the greedy_optimizerMonty2022-06-2933-2249/+5854
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-28073 Slow query performance in MariaDB when using many table The idea is to prefer and chain EQ_REF tables (tables that uses an unique key to find a row) when searching for the best table combination. This significantly reduces row combinations that has to be examined. This is optimization is enabled when setting optimizer_prune_level=2 (which is now default). Implementation: - optimizer_prune_level has a new level, 2, which enables EQ_REF optimization in addition to the pruning done by level 1. Level 2 is now default. - Added JOIN::eq_ref_tables that contains bits of tables that could use potentially use EQ_REF access in the query. This is calculated in sort_and_filter_keyuse() Under optimizer_prune_level=2: - When the greedy_optimizer notices that the preceding table was an EQ_REF table, it tries to add an EQ_REF table next. If an EQ_REF table exists, only this one will be considered at this level. We also collect all EQ_REF tables chained by the next levels and these are ignored on the starting level as we have already examined these. If no EQ_REF table exists, we continue as normal. This optimization speeds up the greedy_optimizer combination test with ~25% Other things: - I ported the changes in MySQL 5.7 to greedy_optimizer.test to MariaDB to be able to ensure we can handle all cases that MySQL can do. - I have run all tests with --mysqld=--optimizer_prune_level=1 to verify that there where no test changes.
* Remove unnecessary testing of join dependency when sorting tablesMonty2022-06-291-15/+10
| | | | | | | The dependency checking is not needed when using best_extension_by_limited_search() as this function ensures that we don't use tables that are depending on any of the remaning tables.
* Added get_allowed_nj_tables() to speed up gready_search()Monty2022-06-293-18/+175
| | | | | | | | "Get the tables that one is allowed to have as the next table in the current plan" Main author: Sergei Petrunia <sergey@mariadb.com> Co author: Monty
* Improve pruning in greedy_search by sorting tables during searchMonty2022-06-2933-1294/+2519
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-28073 Slow query performance in MariaDB when using many tables The faster we can find a good query plan, the more options we have for finding and pruning (ignoring) bad plans. This patch adds sorting of plans to best_extension_by_limited_search(). The plans, from best_access_path() are sorted according to the numbers of found rows. This allows us to faster find 'good tables' and we are thus able to eliminate 'bad plans' faster. One side effect of this patch is that if two tables have equal cost, the table that which was used earlier in the query is preferred. This allows users to improve plans by reordering eq_ref tables in the order they would like them to be uses. Result changes caused by the patch: - Traces are different as now we print the cost for using tables before we start considering them in the plan. - Table order are changed for some plans. In most cases this is because the plans are equal and tables are in this case sorted according to their usage in the original query. - A few plans was changed as the optimizer was able to find a better plan (that was pruned by the original code). Other things: - Added a new statistic variable: "optimizer_join_prefixes_check_calls", which counts number of calls to best_extension_by_limited_search(). This can be used to check the prune efficiency in greedy_search(). - Added variable "JOIN_TAB::embedded_dependent" to be able to handle XX IN (SELECT..) in the greedy_optimizer. The idea is that we should prune a table if any of the tables in embedded_dependent is not yet read. - When using many tables in a query, there will be some additional memory usage as we need to pre-allocate table of table_count*table_count*sizeof(POSITION) objects (POSITION is 312 bytes for now) to hold the pre-calculated best_access_path() information. This memory usage is offset by the expected performance improvement when using many tables in a query. - Removed the code from an earlier patch to keep the table order in join->best_ref in the original order. This is not needed anymore as we are now sorting the tables for each best_extension_by_limited_search() call.
* Merge 10.9 into 10.10Marko Mäkelä2022-06-28131-1274/+6540
|\
| * Merge 10.8 into 10.9Marko Mäkelä2022-06-28134-1274/+6591
| |\
| | * Merge 10.7 into 10.8Marko Mäkelä2022-06-28134-1296/+6655
| | |\
| | | * Merge 10.6 into 10.7Marko Mäkelä2022-06-2856-1110/+1724
| | | |\
| | | | * MDEV-26979 heap-use-after-free or SIGSEGV when accessing ↵Marko Mäkelä2022-06-272-77/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | INNODB_SYS_TABLESTATS during DDL i_s_dict_fill_sys_tablestats(): Read all fields of dict_table_t while holding dict_sys.latch. dict_sys_t::allow_eviction(): Remove.
| | | | * Merge 10.5 into 10.6Marko Mäkelä2022-06-274-1/+31
| | | | |\
| | | | | * Merge 10.4 into 10.5Marko Mäkelä2022-06-274-1/+31
| | | | | |\
| | | | | | * Merge 10.3 into 10.4Marko Mäkelä2022-06-274-1/+31
| | | | | | |\
| | | | | | | * MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) ↵Marko Mäkelä2022-06-273-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | during ADD COLUMN prepare_inplace_alter_table_dict(): If the table will not be rebuilt, preserve all of the original ROW_FORMAT, including the compressed page size flags related to ROW_FORMAT=COMPRESSED.
| | | | | | | * MDEV-28389 fixup: Fix compiler warningsMarko Mäkelä2022-06-271-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hex_to_ascii(): Add #if around the definition to avoid clang -Wunused-function. Avoid GCC 5 -Wconversion with a cast.
| | | | * | | | MDEV-28950 Assertion `*err == DB_SUCCESS' failed in btr_page_split_and_insertMarko Mäkelä2022-06-272-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btr_root_raise_and_insert(), btr_lift_page_up(), rtr_page_split_and_insert(): Reset DB_FAIL from a failure to copy records on a ROW_FORMAT=COMPRESSED page to DB_SUCCESS before retrying. This fixes a regression that was introduced by commit 0b47c126e31cddda1e94588799599e138400bcf8 (MDEV-13542). btr_root_raise_and_insert(): Remove a redundant condition. btr_page_split_and_insert() will invoke btr_page_split_and_insert() if needed.
| | | | * | | | Suppress a message that may be emitted on slow systemsMarko Mäkelä2022-06-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On FreeBSD, tests run on persistent storage, and no asynchronous I/O has been implemented. Warnings about 205-second waits on dict_sys.latch may occur.
| | | | * | | | Merge 10.5 into 10.6Marko Mäkelä2022-06-2749-1009/+1619
| | | | |\ \ \ \ | | | | | |/ / /
| | | | | * | | Merge 10.4 into 10.5Marko Mäkelä2022-06-2749-1037/+1618
| | | | | |\ \ \ | | | | | | |/ /
| | | | | | * | MDEV-28854 after-merge fix: Remove a test for MDEV-26583Marko Mäkelä2022-06-273-81/+0
| | | | | | | |
| | | | | | * | Merge 10.3 into 10.4Marko Mäkelä2022-06-2748-515/+608
| | | | | | |\ \ | | | | | | | |/
| | | | | | | * MDEV-28389: Simplify the InnoDB corrupted page outputMarko Mäkelä2022-06-274-234/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buf_page_print(): Dump the buffer page 32 bytes (64 hexadecimal digits) per line. In this way, the limitation in mtr ("Data too long for column 'line'") will not be triggered. Also, do not bother decoding the page contents, because everything is present in the hexadecimal output. dict_index_find_on_id_low(): Merge to dict_index_get_if_in_cache_low(). The direct call in buf_page_print() was prone to crashing, in case the table definition was concurrently evicted or dropped from the data dictionary cache.
| | | | | | | * MDEV-28854 Disallow INSERT DELAYED on Spider tableHirokazu Hata2022-06-279-35/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Spider supports (or at least allows) INSERT DELAYED but the documentation does not specify spider as a storage engine that supports "INSERT DELAYED". Also, although not mentioned in the documentation, "INSERT DELAYED" is not intended to be executed inside a transaction, as can be seen from the list of supported storage engines. The current implementation allows executing a delayed insert on a remote transactional table and this breaks the consistency ensured by the transaction. We too remove "internal_delayed", one of the Spider table parameters. Documentation says, > Whether to transmit existence of delay to remote servers when > executing an INSERT DELAYED statement on local server. This table parameter is only used for "INSERT DELAYED". Reviewed by: Nayuta Yanagisawa
| | | | | | | * MDEV-22590 SIGSEGV in flush_all_key_blocks when changing key_buffer_size / ↵Oleksandr Byelkin2022-06-243-1/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ASAN: heap-use-after-free in flush_all_key_blocks Take into account that in preparation of a simple key cache for resizing no disk blocks might be assigned to it. Reviewer: IgorBabaev <igor@mariadb.com>
| | | | | | | * MDEV-26562: galera-sst-mariabackup is failing due to missing ↵Julius Goryavsky2022-06-212-39/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xtrabackup_checkpoints This commit contains workaround for a bug known as 'Red Hat issue 1870279' (connection reset by peer issue in socat versions 1.7.3.3 to 1.7.4.0) which further causes crashes during SST using mariabackup (when openssl is used). Also fixed broken logic of automatic generation of the Diffie-Hellman parameters for socat version less than 1.7.3 (which defaults to 512-bit values instead of 2048-bit ones).
| | | | | | | * MDEV-28884: include kernel information in crashing signal handlerDaniel Black2022-06-181-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent adventures in liburing and btrfs have shown up some kernel version dependent bugs. Having a bug report of accurace kernel version can start to correlate these errors sooner. On Linux, /proc/version contains the kernel version. FreeBSD has kern.version (per man 8 sysctl), so include that too. Example output: Max nice priority 0 0 Max realtime priority 0 0 Max realtime timeout unlimited unlimited us Core pattern: |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h Kernel version: Linux version 5.19.0-0.rc2.21.fc37.x86_64 (mockbuild@bkernel01.iad2.fedoraproject.org) (gcc (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1), GNU ld version 2.38-14.fc37) #1 SMP PREEMPT_DYNAMIC Mon Jun 13 15:27:24 UTC 2022 Segmentation fault (core dumped)
| | | | | | | * remove invalid testSergei Golubchik2022-06-182-82/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it starts an EXPLAIN of a multi-table join and tries to KILL it. no sync points. depending on how fast the hareware is and optimizer development it might kill EXPLAIN at some random point in time (generally unrelated to the Bug#28598 it was supposed to test) or EXPLAIN might finish before the KILL and the test will fail.
| | | | | | | * Fix intermittent failures of innodb.stats_persistentMarko Mäkelä2022-06-172-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do not really care about the exact result; we only care that the statistics will be accessed. The result could change depending on when some statistics were updated in the background or when some committed delete-marked rows were purged from other tables on which persistent statistics are enabled.
| | | | | | | * MDEV-21027 Assertion `part_share->auto_inc_initialized || ↵Shunsuke Tokunaga2022-06-168-5/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | !can_use_for_auto_inc_init()' failed in ha_partition::set_auto_increment_if_higher ha_partition::set_auto_increment_if_higher expects part_share->auto_inc_initialized is true or can_use_for_auto_inc_init() is false (but as the comment of this method says, it returns false only if we use Spider engine with DROP TABLE or ALTER TABLE query). However, part_share->auto_inc_initialized becomes true only after all partitions are opened (since 6dce6aecebe6ef78a14cb5c5c5daa8a355551e40). Therefore, I added a conditional expression in order to read all partitions when we execute REPLACE on a table that has an AUTO_INCREMENT column. Reviewed by: Nayuta Yanagisawa Reviewed by: Alexey Botchkov
| | | | | | | * mtr: fix a race conditionSergei Golubchik2022-06-151-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | if a test can run in cond1,cond2 and cond1,cond3 then they can happen to run in parallel and both wanting to create test,cond1.result~
| | | | | | | * cleanup: move the check out of the loopSergei Golubchik2022-06-151-10/+9
| | | | | | | |
| | | | | | | * MDEV-28656: Inability to roll upgrade without stopping the Galera clusterJulius Goryavsky2022-06-146-108/+196
| | | | | | | |
| | | | | | | * MDEV-28628: Change current Debian package revision schemeTuukka Pasanen2022-06-141-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current Debian package revision scheme when using debian/autobake-deb.sh script is: '1:VERSION+maria~LSBNAME' For example if VERSION can be like 10.6.8 and LSBNAME is buster then version and revision is: '1:10.6.8+maria~buster' Which can lead to problem as distro code names can be lexical unordered. For example Debian LSBNAME's can be: Codename Buster is Debian version 10 Codename Bookworm is Debian version 11 This happens because in ASCII table Buster first two digits are 'Bu' and they are in hex 0x42 and 0x75 and Bookworm first digits 'Bo' are they are in hex 0x42 and 0x6F When apt is upgrading it means that: 1:10.6.8+maria~buster is bigger than 1:10.6.8+maria~bookworm and that leads to problems in dist-upgrade process To solve problem revision format is changed to: '1:VERSION+maria~(deb|ubu)LSBVERSION' Example for Debian 11 is now: 1:10.6.8+maria~deb11 and for Ubuntu 22.04 is now: 1:10.6.8+maria~ubu2204 There are new Variables * VERSION which contains whole version string * LSBVERSION which contains LSB version of distro * LSBID which contains LSB ID (Debian or Ubuntu) added to debian/autobake-deb.sh. Also CODENAME is change to LSBNAME as it's more declaritive
| | | | | | | * MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing ↵Nayuta Yanagisawa2022-06-135-7/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | assertion: id != 0 on ALTER ... REBUILD PARTITION During rebuild of partition, the partitioning engine calls alter_close_table(), which does not unlock and close some table instances of the target table. Then, the engine fails to rename partitions because there are table instances that are still locked. Closing all the table instance of the target table fixes the bug.
| | | | | | | * MDEV-27766: connect engine; INSERT ignore option, was ignoredMathew Heard2022-06-104-4/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test prior to this change: CURRENT_TEST: connect.mysql mysqltest: At line 485: query 'INSERT IGNORE INTO t3 VALUES (5),(10),(30)' failed: ER_GET_ERRMSG (1296): Got error 122 '(1062) Duplicate entry '10' for key 'PRIMARY' [INSERT INTO `t1` (`a`) VALUES (10)]' from CONNECT So the ignore table option wasn't getting passed to the remove server. Closes #2008
| | | | | | | * MDEV-28666: Add correct 'Breaks' to make sure upgrade from 10.2 succeedsTuukka Pasanen2022-06-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | File '/usr/bin/mariadb_config' has been moved from Debian package libmariadbd-dev to libmariadb-dev since MariaDB version 10.2 this leads to situation where upgrade will no succeed but fail with this kind of error message * trying to overwrite '/usr/bin/mariadb_config', which is also in package libmariadbd-dev 1:10.2.44+maria~bionic Add libmariadbd-dev to libmariadb-dev Debian control files 'Breaks' solve situation and upgrading won't error anymore
| | | | | | * | MDEV-28583 postfix: fixing .result files after automatic mergeJulius Goryavsky2022-06-214-450/+1066
| | | | | | | |
| | | | | | * | MDEV-28819 Statically compiled encryption plugins do not work in mariadb-backupVladislav Vaintroub2022-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable static build for encryption plugin file_key_management
| | | | | | * | MDEV-17390: re-neable rpl_semi_sync_after_sync testDaniel Black2022-06-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reasons sited for disabling this test in MDEV-16172 where disputed.
| | | | | * | | Fix GCC -Og -Wmaybe-uninitializedMarko Mäkelä2022-06-271-8/+11
| | | | | | | |
| | | | * | | | MDEV-28935 crash in io_slots::releaseVladislav Vaintroub2022-06-231-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "TSAN: data race on vptr (ctor/dtor vs virtual call)" This reverts commit 78084fa747f373f2b404c3cb543d19f439100d9e. This commit was done to please TSAN, which falsely reported an error where there was none. Yet as consequence, it could cause a real error, a crash in os_aio_free on shutdown
| | | * | | | | MDEV-28963 Incompatible data type assignment through SP vars is not ↵Alexander Barkov2022-06-2726-29/+1801
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | consistent with columns
| | | * | | | | MDEV-28479 fixup: Update spider/bg and spider/handler suitesNayuta Yanagisawa2022-06-276-0/+102
| | | | | | | |
| | | * | | | | MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ↵Alexander Barkov2022-06-2749-120/+2805
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ALTER Now INSERT, UPDATE, ALTER statements involving incompatible data type pairs, e.g.: UPDATE TABLE t1 SET col_inet6=col_int; INSERT INTO t1 (col_inet6) SELECT col_in FROM t2; ALTER TABLE t1 MODIFY col_inet6 INT; consistently return an error at the statement preparation time: ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET' and abort the statement before starting interating rows. This error is the same with what is raised for queries like: SELECT col_inet6 FROM t1 UNION SELECT col_int FROM t2; SELECT COALESCE(col_inet6, col_int) FROM t1; Before this change the error was caught only during the execution time, when a Field_xxx::store_xxx() was called for the very firts row. The behavior was not consistent between various statements and could do different things: - abort the statement - set a column to the data type default value (e.g. '::' for INET6) - set a column to NULL A typical old error was: ERROR 22007: Incorrect inet6 value: '1' for column `test`.`t1`.`a` at row 1 EXCEPTION: Note, there is an exception: a multi-row INSERT..VALUES, e.g.: INSERT INTO t1 (col_a,col_b) VALUES (a1,b1),(a2,b2); checks assignment compability at the preparation time for the very first row only: (col_a,col_b) vs (a1,b1) Other rows are still checked at the execution time and return the old warnings or errors in case of a failure. This is done because catching all rows at the preparation time would change behavior significantly. So it still works according to the STRICT_XXX_TABLES sql_mode flags and the table transaction ability. This is too late to change this behavior in 10.7. There is no a firm decision yet if a multi-row INSERT..VALUES behavior will change in later versions.
| | | * | | | | MDEV-28829 Deprecate spider_semi_table_lock and ↵Nayuta Yanagisawa2022-06-274-3/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | spider_semi_table_lock_connection When the variable, spider_semi_table_lock, is 1, Spider sends LOCK TABLES before each SQL execution. The feature is for non-transactional remote tables and adds some overhead to query executions. We change the default value of the plugin variable to 0 and then deprecate the variable because it is rare to use non-transactional engines these days and the variable complicates the code. The variable, spider_semi_table_lock_connection, should be too deprecated because it is for tweaking the semi-table locking.