summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-22424 Server crashes in handler::check_duplicate_long_entry_key or ↵Sergei Golubchik2020-05-051-2/+1
| | | | | | | | | Assertion `inited == NONE || lookup_handler != this' failed upon DELETE FOR PORTION on table with long unique key even if we're *allowed to* convert DELETE .. FOR PERIOD OF into an update internally, doesn't think we'll *be able to*. We always have to prepare for insert.
* MDEV-22185 Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON or ↵Sergei Golubchik2020-05-051-1/+1
| | | | | | | | | ER_KEY_NOT_FOUND or Assertion `inited==NONE' failed in handler::ha_index_init long unique checks should be done for a partitioned table as a whole, not for individual partitions. Followup for f3f31eaa8e8 that extends it to UPDATE
* cleanup: ha_external_unlock() helperSergei Golubchik2020-05-057-10/+11
| | | | | as mentioned in f9f33b85be6 and generally to make it easier to talk about
* MDEV-22437 make THR_THD* variable thread_localEugene Kosov2020-05-0515-71/+35
| | | | | | | Now all access goes through _current_thd() and set_current_thd() functions. Some functions like THD::store_globals() can not fail now.
* Merge 10.4 into 10.5Marko Mäkelä2020-05-043-9/+25
|\
| * MDEV-21489 : wsrep_cluster_conf_id has wrong valueJan Lindström2020-05-041-0/+1
| | | | | | | | Variable was not updated after initialization.
| * MDEV-22401: Optimizer trace: multi-component range is not printed correctlySergei Petrunia2020-04-292-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | KEY_MULTI_RANGE::range_flag does not have correct flag bits for per-endpoint flags (NEAR_MIN, NEAR_MAX, NO_MIN_RANGE, NO_MAX_RANGE). It only has bits for flags that describe both endpoints. So - Document this. - Switch optimizer trace to using {start|end}_key.flag values, instead. This fixes the bug. - Switch records_in_column_ranges() to doing that too. (This used to work, because KEY_MULTI_RANGE::range_flag had correct flag value for the last key component, and EITS only uses one-component pseudo-indexes)
* | MDEV-22454 Allow -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ONVladislav Vaintroub2020-05-041-2/+3
| | | | | | | | | | | | Disable IPO (interprocedural optimization, aka /GL) on Windows on libraries, from which server.dll exports symbols - exporting symbols does not work for objects compiled with /GL.
* | MDEV-22317: SIGSEGV in my_free/delete_dynamic in optimized builds (ARIA)Sujatha2020-04-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | Post push fix. when "replicate_wild_do_table" and "replicate_wild_ignore_table" filters and changed dynamically the filter list gets cleared but the corresponding "wild_do_table_inited" and "wild_ignore_table_inited" flags are not getting cleared. Fix: Clear the flags.
* | MDEV-22337: Fix type mismatchMarko Mäkelä2020-04-291-3/+2
| |
* | Merge 10.4 into 10.5Marko Mäkelä2020-04-2910-34/+56
|\ \ | |/
| * Merge 10.3 into 10.4Marko Mäkelä2020-04-293-6/+10
| |\
| | * MDEV-19611 INPLACE ALTER does not fail on bad implicit default valueThirunarayanan Balathandayuthapani2020-04-282-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Inplace alter shouldn't set default date column as '0000-00-00' when table is not empty. So mysql_inplace_alter_table() copied alter_ctx.error_if_not_empty to a new field of Alter_inplace_info. In ha_innobase::check_if_supported_inplace_alter() should check the error_if_not_empty flag and return INPLACE_NOT_SUPPORTED if the table is not empty
| * | Merge 10.3 into 10.4Marko Mäkelä2020-04-276-27/+31
| |\ \ | | |/
| | * Merge 10.2 into 10.3Marko Mäkelä2020-04-2711-44/+47
| | |\
| | | * Merge 10.1 into 10.2Marko Mäkelä2020-04-2710-36/+40
| | | |\
| | | | * MDEV-22271 Excessive stack memory usage due to WSREP_LOGSergei Golubchik2020-04-272-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix embedded innodb_plugin tests followup for 7198c6ab2dc
| | | | * MDEV-22203: WSREP_ON is unnecessarily expensive to evaluateMarko Mäkelä2020-04-279-37/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a backport of the applicable part of commit 93475aff8de80a0ef53cbee924bcb70de6e86f2c and commit 2c39f69d34e64a5cf94720e82e78c0ee91bd4649 from 10.4. Before 10.4 and Galera 4, WSREP_ON is a macro that points to a global Boolean variable, so it is not that expensive to evaluate, but we will add an unlikely() hint around it. WSREP_ON_NEW: Remove. This macro was introduced in commit c863159c320008676aff978a7cdde5732678f975 when reverting WSREP_ON to its previous definition. We replace some use of WSREP_ON with WSREP(thd), like it was done in 93475aff8de80a0ef53cbee924bcb70de6e86f2c. Note: the macro WSREP() in 10.1 is equivalent to WSREP_NNULL() in 10.4. Item_func_rand::seed_random(): Avoid invoking current_thd when WSREP is not enabled.
| | | | * Fix clang 10 warningsMarko Mäkelä2020-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _ma_fetch_keypage(): Correct an assertion that used to always hold. Thanks to clang -Wint-in-bool-context for flagging this. double_to_datetime_with_warn(): Suppress -Wimplicit-int-float-conversion by adding a cast. LONGLONG_MAX converted to double will actually be LONGLONG_MAX+1.
| | | | * MDEV-22271: Follow-up fix of --embeddedMarko Mäkelä2020-04-271-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 7198c6ab2dc8f8286f6732824ab985a76ebaaddc the ./mtr --embedded tests would fail to start innodb_plugin because of an undefined reference to the symbol wsrep_log(). Let us define a stub for that function. The embedded server is never built WITH_WSREP, but there are no separate storage engine builds for the embedded server. Hence, by default, the dynamic InnoDB storage engine plugin would be built WITH_WSREP and it would fail to load into the embedded server library due to a reference to the undefined symbol.
| | | * | cleanup THR_KEY_mysysEugene Kosov2020-04-251-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | read TLS with my_thread_var write TLS with set_mysys_var() my_thread_var is no longer __attribute__ ((const)): this attribute is simply incorrect here. Read gcc manual for more information. sql/threadpool_generic.cc fails with that attribute.
| | * | | After-merge fixMarko Mäkelä2020-04-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysqld_exit(): Change the assertion failure on global_status_var.global_memory_used == 0 to fprintf, like in 0bcb65d358087bf94e217254f812f913343a6f5d It appears that in some cases, that variable may be nonzero even when LeakSanitizer (WITH_ASAN) would not report errors. This was observed in 10.4 88cf6f1c7ff5d56138c8b53a5adaca4c61752f86 with the MDEV-22348 test case (Aria startup failure when running main.default_storage_engine).
| * | | | MDEV-20257 Server crashes in Grant_table_base::init_read_record upon ↵Sergei Golubchik2020-04-271-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | crash-upgrade when opening the `user` table separately, reset `thd->open_tables` for the duration of open, otherwise auto-repair fallback-and-retry will close *all* tables (but reopen only `user`)
| * | | | MDEV-21928 ALTER USER doesn't remove excess authentication plugins from ↵Sergei Golubchik2020-04-271-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql.global_priv only use auth1 update (no "auth_or":[]) array, if there was no "auth_or" array in the json yet.
* | | | | MDEV-22337 Assertion `Alloced_length >= (str_length + length + net_le… ↵Alexey Botchkov2020-04-291-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | …ngth_size(length))' failed in Binary_string::q_net_store_data on long MULTIPOLYGON query with session_track_user_variables=1 (optimized builds). We have to reserve enough space in String to use q_something(). Also pointer calculations fixed.
* | | | | MDEV-21915 Server crashes in copy_fields,Item_func_group_concat::add …Alexey Botchkov2020-04-293-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | …while using json_arrayagg() as a window function. We don't support JSON_ARRAYAGG and JSON_OBJECTAGG in window functions yet.
* | | | | MDEV-22317: SIGSEGV in my_free/delete_dynamic in optimized builds (ARIA)Sujatha2020-04-291-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======= SET @@GLOBAL.replicate_wild_ignore_table=''; SET @@GLOBAL.replicate_wild_do_table=''; Reports following valgrind error. Conditional jump or move depends on uninitialised value(s) Rpl_filter::set_wild_ignore_table(char const*) (rpl_filter.cc:439) Conditional jump or move depends on uninitialised value(s) at 0xF60390: delete_dynamic (array.c:304) by 0x74F3F2: Rpl_filter::set_wild_do_table(char const*) (rpl_filter.cc:421) Analysis: ======== List of values provided for options "wild_do_table" and "wild_ignore_table" are stored in DYNAMIC_ARRAYS. When an empty list is provided these dynamic arrays are not initialized. Existing code treats empty element list as an error and tries to clean the uninitialized list. This results in above valgrind issue. Fix: === The clean up should be initiated only when there is an error while parsing the 'wild_do_table' or 'wild_ignore_table' list and the dynamic_array is in initialized state. Otherwise for empty list it should simply return success.
* | | | | MDEV-22128 : Server with wsrep_on crashes in do_rename upon RENAME TABLE on ↵Jan Lindström2020-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a view We need to make sure that hton is not same as view_pseudo_hton that is not NULL but not usable.
* | | | | MDEV-22236 JSON_ARRAYAGG query leads to SIGSEGV in Charset::swap on ↵Alexey Botchkov2020-04-281-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | optimized builds. The json_arrayagg::val_str should handle NULL result.
* | | | | Compilation fixbb-10.5-6915-extAleksey Midenkov2020-04-271-0/+2
| | | | |
* | | | | MDEV-22155 ALTER add default history partitions name clash on non-default ↵Aleksey Midenkov2020-04-273-10/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partitions If any of default names clashes with existing names find next large enough name gap for the requested number of partitions.
* | | | | MDEV-22207 Drop default history partitions renders table inaccessibleAleksey Midenkov2020-04-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is continuation of MDEV-22153 bug when contiguity of history partitions is broken. ha_partition::open_read_partitions() can not handle non-contiguous list of default partitions. Fix: when default partition is dropped convert list of partitions to non-default.
* | | | | Merge 10.4 into 10.5Marko Mäkelä2020-04-2538-165/+285
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | The functional changes of commit 5836191c8f0658d5d75484766fdcc3d838b0a5c1 (MDEV-21168) are omitted due to MDEV-742 having addressed the issue.
| * | | | MDEV-14735: Fix -Wunused-const-variableMarko Mäkelä2020-04-241-1/+3
| | | | |
| * | | | MDEV-7962 wsrep_on() takes 0.14% in OLTP ROMarko Mäkelä2020-04-242-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason why we have wsrep_on() at all is that the macro WSREP(thd) depends on the definition of THD, and that is intentionally an opaque data type for InnoDB. So, we cannot avoid invoking wsrep_on(), but we can evaluate the less expensive conditions thd && WSREP_ON before calling the function. Global_read_lock: Use WSREP_NNULL(thd) instead of wsrep_on(thd) because we not only know the definition of THD but also that the pointer is not null. wsrep_open(): Use WSREP(thd) instead of wsrep_on(thd). InnoDB: Replace thd && wsrep_on(thd) with wsrep_on(thd), now that the condition has been merged to the definition of the macro wsrep_on().
| * | | | MDEV-22203: WSREP_ON is unnecessarily expensive WITH_WSREP=OFFMarko Mäkelä2020-04-244-17/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the server is compiled WITH_WSREP=OFF, we should avoid evaluating conditions on a global variable that is constant. WSREP_ON_: Renamed from WSREP_ON. Defined only WITH_WSREP=ON. WSREP_ON: Defined as unlikely(WSREP_ON_). wsrep_on(): Defined as WSREP_ON && wsrep_service->wsrep_on_func(). The reason why we have wsrep_on() at all is that the macro WSREP(thd) depends on the definition of THD, and that is intentionally an opaque data type for InnoDB. So, we cannot avoid invoking wsrep_on(), but we can evaluate the less expensive condition WSREP_ON before calling the function.
| * | | | MDEV-22203: WSREP_ON is unnecessarily expensive to evaluateJan Lindström2020-04-2418-49/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced WSREP_ON macro by single global variable WSREP_ON that is then updated at server statup and on wsrep_on and wsrep_provider update functions.
| * | | | Merge 10.3 into 10.4Marko Mäkelä2020-04-226-19/+30
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.2 into 10.3Marko Mäkelä2020-04-225-18/+29
| | |\ \ \ | | | |/ /
| | | * | Merge 10.1 into 10.2Marko Mäkelä2020-04-223-14/+25
| | | |\ \ | | | | |/
| | | | * MDEV-22271 Excessive stack memory usage due to WSREP_LOGMarko Mäkelä2020-04-172-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several tests that involve stored procedures fail on 10.4 kvm-asan (clang 10) due to stack overrun. The main contributor to this stack overrun is mysql_execute_command(), which is invoked recursively during stored procedure execution. Rebuilding with cmake -DWITH_WSREP=OFF shrunk the stack frame size of mysql_execute_command() by more than 10 kilobytes in a WITH_ASAN=ON, CMAKE_BUILD_TYPE=Debug build. The culprit turned out to be the macro WSREP_LOG, which is allocating a separate 1KiB buffer for every occurrence. We replace the macro with a function, so that the stack will be allocated only when the function is actually invoked. In this way, no stack space will be wasted by default (when WSREP and Galera are disabled). This backports commit b6c5657ef27de034439b1505a8b4815c263d6455 from MariaDB 10.3.1. Without ASAN, compilers can be smarter and optimize the stack usage. The original commit message mentions that 1KiB was saved on GCC 5.4, and 4KiB on Mac OS X Lion, which presumably uses a clang-based compiler.
| | | | * Merge branch '5.5' into 10.1Varun Gupta2020-04-161-6/+11
| | | | |\
| | | | | * Minor fixup to MDEV-22191Varun Gupta2020-04-161-6/+11
| | | | | |
| | | * | | Don't write warning about uninitialized mutex if there is a memory leakMonty2020-04-181-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of: MDEV-21056 Assertion `global_status_var.global_memory_used == 0' failed upon shutdown after query with DEFAULT on a geometry field Fixed by changing the ASSERT for memory leaks to a printf() on stderr. This has needed as all mutex in mysys has been deleted and we can't call functions like my_open() anymore. Also added printing of leaks if safemalloc is used (like we do in 10.5)
| | | * | | Fixed memory leak with DEFAULT(f) on Geometry fieldMonty2020-04-183-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-21056 Assertion `global_status_var.global_memory_used == 0' failed upon shutdown after query with DEFAULT on a geometry field
| | * | | | MDEV-22263: main.func_debug fails on a valgrind build with wrong resultAnel Husakovic2020-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Patches of interest:374dae3ecc49, 374dae3ecc49
| * | | | | MDEV-21025 Server crashes on START TRANSACTION after INSERT IGNORE (#1489)Teemu Ollakka2020-04-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a transaction had no effect due to INSERT IGNORE and a new transaction was started with START TRANSACTION without committing the previous one, the server crashed on assertion when starting a new wsrep transaction. As a fix, refined the condition to do wsrep_commit_empty() at the end of the ha_commit_trans().
| * | | | | MDEV-22271 Excessive stack memory usage due to WSREP_LOGTeemu Ollakka2020-04-172-7/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Made WSREP_LOG a function and moved the body out of header. - Reduced the stack allocated buffer size and implemented reprint into dynamically allocated buffer if stack buffer is not large enough to hold the message.
| * | | | | Merge 10.3 into 10.4Marko Mäkelä2020-04-1610-59/+104
| |\ \ \ \ \ | | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In main.index_merge_myisam we remove the test that was added in commit a2d24def8cc42d27c72d833abfb39ef24a2b96ba because it duplicates the test case that was added in commit 5af12e463549e4bbc2ce6ab720d78937d5e5db4e.
| | * | | | fix tests related to SQL comment lengthEugene Kosov2020-04-152-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tests are: engines/funcs.jp_comment_column engines/funcs.jp_comment_index engines/funcs.jp_comment_table