summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.4 into 10.5Marko Mäkelä2020-08-148-23/+44
|\
| * Merge 10.3 into 10.4, except MDEV-22543Marko Mäkelä2020-08-139-29/+52
| |\ | | | | | | | | | Also, fix GCC -Og -Wmaybe-uninitialized in run_backup_stage()
| | * Fix GCC 10.2.0 -Og -Wmaybe-uninitializedMarko Mäkelä2020-08-135-20/+30
| | | | | | | | | | | | | | | | | | Fix some more cases after merging commit 31aef3ae99dff6b7154cf288b3dc508d367f19f8. Some warnings look possibly genuine, others are clearly bogus.
| | * Merge 10.2 into 10.3Marko Mäkelä2020-08-138-48/+78
| | |\
| | | * Fix GCC 10.2.0 -Og -Wmaybe-uninitializedMarko Mäkelä2020-08-114-40/+37
| | | | | | | | | | | | | | | | | | | | | | | | For some reason, GCC emits more -Wmaybe-uninitialized warnings when using the flag -Og than when using -O2. Many of the warnings look genuine.
| | | * MDEV-22543 : Galera SST donation fails, FLUSH TABLES WITH READ LOCK times outJan Lindström2020-08-113-9/+31
| | | | | | | | | | | | | | | | | | | | During SST we need to let FTWRL to use normal timeout method even when client is disconnected.
| | | * MDEV-23378 - fix an alleged memory "leak" in threadpool.Vladislav Vaintroub2020-08-101-0/+11
| | | | | | | | | | | | | | | | Implement a workaround to shut the "memory not freed" message.
* | | | MDEV-23162: Fix clang -Winconsistent-missing-overrideMarko Mäkelä2020-08-141-2/+2
| | | |
* | | | MDEV-23162 Improve Protocol performance for numeric dataAlexander Barkov2020-08-145-44/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An alternative implementation (replacing the one based on repertoire). This implementation makes Field send itself to Protocol_text using data type specific Protocol methods rather than field->val_str() followed by protocol_text->store_str(). As now Field sends itself in the same way to all protocol types (e.g. Protocol_binary, Protocol_text, Protocol_local), the method Field::send_binary() was renamed just to Field::send(). Note, this change introduces symmetry between Field and Item, because Items also send themself using a single method Item::send(), which is used for *all* protocol types. Performance improvement is achieved by the fact that Protocol_text implements these data type specific methods using store_numeric_string_aux() rather than store_string_aux(). The conversion now happens only when character_set_results is not ASCII compatible character sets (e.g. UCS2, UTF16, UTF32). In the old code (before any MDEV-23162 work, e.g. as of 10.5.4), Protocol_text::store(Field*) used val_str() for all data types. So the execution went through the character set conversion routines even for numeric and temporal data types. Benchmarking summary (see details in MDEV-23478): The new approach stably demonstrates additional improvement comparing to the previous implementation (the smaller time - the better): Original - the commit before MDEV-23162 be98036f25ac8cfb34fa5bb5066975d79f595aec 1m9.336s 1m9.290s 1m9.300s MDEV-23162 - the repertoire optimization 1m6.101s 1m5.988s 1m6.264s MDEV-23478 - this commit 1m2.150s 1m2.079s 1m2.099s
* | | | Revert "MDEV-23162 Improve Protocol performance for numeric data"Alexander Barkov2020-08-143-69/+31
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit eb2eaba7fdbd13c9814ab4619cc23d9f140e5485. A different implementation of MDEV-23162 is coming.
* | | | MDEV-23270 Remove a String parameter from Protocol::store(double/float)Alexander Barkov2020-08-148-32/+29
| | | |
* | | | MDEV-23279 postfix - delay accepting connections until server startup is ↵Vladislav Vaintroub2020-08-111-15/+14
| | | | | | | | | | | | | | | | finished.
* | | | MDEV-23054 Assertion `!item->null_value' failed in ↵Alexander Barkov2020-08-111-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Type_handler_inet6::make_sort_key_part (#2) IFNULL(inet6_not_null_expr, 'foo') erroneously set its nullability to NOT NULL. Fix: - Moving the line "maybe_null= args[1]->maybe_null" before the call of fix_length_and_dec2(), so the call of Type_handler method Item_hybrid_func_fix_attributes() can reset it when desired. - Fixing Type_handler_inet6::Item_hybrid_func_fix_attributes() to ignore args[0] when detecting nullability of IFNULL().
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-08-1018-88/+244
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-08-1011-63/+138
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-08-1010-62/+128
| | |\ \ | | | |/
| | | * Merge 10.1 into 10.2Marko Mäkelä2020-08-103-3/+33
| | | |\
| | | | * Better comment about TABLE::maybe_nullSergei Petrunia2020-08-061-3/+10
| | | | |
| | | | * MDEV-9513: Assertion `join->group_list || !join->is_in_subquery()' failed in ↵Varun Gupta2020-08-062-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | create_sort_index Removing the ORDER BY clause from the UNION when UNION is inside an IN/ALL/ANY/EXISTS subquery. The rewrites are done for subqueries but this rewrite is not done for the fake_select of the UNION.
| | | * | Merge mariadb-10.2.33Marko Mäkelä2020-08-102-5/+24
| | | |\ \
| | | * | | MDEV-22626: mysql_tzinfo_to_sql not replicates timezone to galeranodes if ↵Jan Lindström2020-08-071-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | only 1 timezone will be loaded. Move alter to InnoDB earlier to more correct place to handle also if only a one timezone file is loaded.
| | | * | | MDEV-15180: server crashed with NTH_VALUE()Varun Gupta2020-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix_fields for the arguments of the NTH_VALUE function was updating the same reference, so for the second argument (or after the first argument) the items were not resolved to their corresponding field from the view as they were updating the reference to the first argument.
| | | * | | MDEV-17066: Bytes lost or Assertion `status_var.local_memory_used == 0 after ↵Varun Gupta2020-08-054-25/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DELETE with subquery with ROLLUP The issue here is when records are read from the temporary file (filesort result in this case) via a cache(rr_from_cache). The cache is initialized with init_rr_cache. For correlated subquery the cache allocation is happening at each execution of the subquery but the deallocation happens only once and that was when the query execution was done. So generally for subqueries we do two types of cleanup 1) Full cleanup: we should free all resources of the query(like temp tables). This is done generally when the query execution is complete or the subquery re-execution is not needed (case with uncorrelated subquery) 2) Partial cleanup: Minor cleanup that is required if the subquery needs recalculation. This is done for all the structures that need to be allocated for each execution (example SORT_INFO for filesort is allocated for each execution of the correlated subquery). The fix here would be free the cache used by rr_from_cache in the partial cleanup phase.
| | | * | | MDEV-23082: ER_TABLEACCESS_DENIED_ERROR error message is truncated,Rucha Deodhar2020-08-041-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and inaccurately Analysis: The list of all privileges is 118 characters wide. However, the format of error message was: "%-.32s command denied to user...". get_length() sets the maximum width to 32 characters. As a result, only first 32 characters of list of privilege are stored. Fix: Changing the format to "%-.100T..." so that get_length() sets width to 100. Hence, first 100 characters of the list of privilege are stored and the type specifier 'T' appends '...' so that truncation can be seen.
| | | * | | MDEV-14836: Assertion `m_status == DA_ERROR' failed inRucha Deodhar2020-08-041-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED open_normal_and_derived_table() fails because the query was already killed as rows examined by the query are more than the limit. However, this isn't a real error. Fix: Check if there is actually an error before calling thd->sql_errno() and later send a warning in handle_select() if no real error.
| | * | | | Merge mariadb-10.3.24Marko Mäkelä2020-08-1048-283/+358
| | |\ \ \ \
| | | * \ \ \ Merge branch '10.2' into 10.3mariadb-10.3.24Sergei Golubchik2020-08-061-4/+23
| | | |\ \ \ \ | | | | | |/ / | | | | |/| |
| | | | * | | Merge branch '10.1' into 10.2mariadb-10.2.33Sergei Golubchik2020-08-062-5/+24
| | | | |\ \ \ | | | | | |/ / | | | | |/| / | | | | | |/
| | | | | * MDEV-23089 rpl_parallel2 fails in 10.5Sachin2020-08-041-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem:- rpl_parallel2 was failing non-deterministically Analysis:- When FLUSH TABLES WITH READ LOCK is executed, it will allow all worker threads to complete their ongoing transactions and then it will pause them. At this state FTWRL will proceed to acquire global read lock. FTWRL first blocks threads from starting new commits, then upgrades the lock to block commit of existing transactions. Step1: FLUSH TABLES WITH READ LOCK - Blocks new commits Step2: * STOP SLAVE command enables 'force_abort=1' which unblocks workers, they continue to execute events. * T1: Waits in 'record_gtid' call to update 'gtid_slave_pos' table with its current GTID, but it is blocked becuase of Step1. * T2: Holds COMMIT lock and waits for T1 to commit. Step3: FLUSH TABLES WITH READ LOCK - Waiting to get BLOCK_COMMIT. This results in deadlock. When STOP SLAVE command allows paused workers to proceed, workers should skip the execution of all further events, similar to 'conservative' parallel mode. Solution:- We will assign 1 to skip_event_group when we are aborted in do_ftwrl_wait. rpl_parallel_entry->pause_sub_id is only reset when force_abort is off in rpl_pause_after_ftwrl.
| | * | | | MDEV-22022 Various mangled SQL statements will crash 10.3 to 10.5 debug buildsAlexander Barkov2020-08-041-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lex_input_stream::scan_ident_delimited() could go beyond the end of the input when a starting backtick (`) delimiter did not have a corresponding ending backtick. Fix: catch the case when yyGet() returns 0, which means either eof-of-query or straight 0x00 byte inside backticks, and make the parser fail on syntax error, displaying the left backtick as the syntax error place. In case of filename in a script like this: SET CHARACTER_SET_CLIENT=17; -- 17 is 'filename' SELECT doc.`Children`.0 FROM t1; the ending backtick was not recognized as such because my_charlen() returns 0 for a straight backtick (backticks must normally be encoded as @0060 in filename). The same fix works for 'filename': the execution skips the backtick and reaches the end of the query, then yyGet() returns 0. This fix is OK for now. But eventually 'filename' should either be disallowed as a parser character set, or fixed to handle encoded punctuation properly.
| * | | | | Merge mariadb-10.4.14Marko Mäkelä2020-08-1059-332/+611
| |\ \ \ \ \
| * | | | | | MDEV-23415 Server crash or Assertion `dec_length <= str_length' failed in ↵Alexander Barkov2020-08-083-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Item_func_format::val_str_ascii Problem: The crash happened in FORMAT(double, dec>=31, 'de_DE'). The patch for MDEV-23118 (commit 0041dacc1b8e85e1958355d1cfdc36055b05a884) did not take into account that String::set_real() has a limit of 31 (FLOATING_POINT_DECIMALS) fractional digits. So for the range of 31..38 digits, set_real() switches to use: - my_fcvt() - decimal point notation, e.g. 1.9999999999 - my_gcvt() - scientific notation, e.g. 1e22 my_gcvt() returned a shorter string than Item_func_format::val_str_ascii() expected to get after the my_fcvt() call, so it crashed on assert. Solution: We cannot extend set_real() to use the my_fcvt() mode for the range of 31..38 fractional digits, because set_real() is used in a lot of places and such a change will break everything. Introducing String::set_fcvt() which always prints using my_fcvt() for the whole range of decimals 0..38, supported by the FORMAT() function.
| * | | | | | MDEV-23118 FORMAT(d1,dec) where dec=0/38 and d1 is DECIMAL(38,38) gives ↵Alexander Barkov2020-08-051-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | incorrect results FORMAT() can print more integer digits (than the argument has) if rounding happens: FORMAT(9.9,0) -> '10' The old code did not take this into account. Fix: 1. One extra digit is needed in case of rounding - If args[1] is a not-NULL constant, then reserve space for one extra integer digit if the requested number of decimals is less than args[0]->decimals. - Otherwise, reserve space for one extra integer digit if args[0]->decimals is not 0, because rounding can potentially happen (depending on the exact data in arguments). 2. One extra digit is also needed if the argument has no integer digits, e.g. in a data type like DECIMAL(38,38). The conditions 1 and 2 are ORed. 3. Fixing FORMAT_MAX_DECIMALS from 30 to 38. This was forgotten in 10.2.1 (when the limit for the number of fractional digits in DECIMAL was extended).
| * | | | | | MDEV-23388 Assertion `args[0]->decimals == 0' failed in ↵Alexander Barkov2020-08-042-4/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Item_func_round::fix_arg_int Type_handler_temporal_result::Item_func_min_max_fix_attributes() in an expression GREATEST(string,date), e.g: SELECT GREATEST('1', CAST('2020-12-12' AS DATE)); incorrectly evaluated decimals as 6 (like for DATETIME). Adding a separate virtual implementation: Type_handler_date_common::Item_func_min_max_fix_attributes() This makes the code simpler.
| * | | | | | MDEV-23032 FLOOR()/CEIL() incorrectly calculate the precision of a ↵Alexander Barkov2020-08-042-18/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DECIMAL(M,D) column The code in Item_func_int_val::fix_length_and_dec_int_or_decimal() calculated badly the result data type for FLOOR()/CEIL(), so for example the decimal(38,10) input created a decimal(28,0) result. That was not correct, because one extra integer digit is needed. floor(-9.9) -> -10 ceil(9.9) -> 10 Rewritting the code in a more straightforward way. Additional changes: - FLOOR() now takes into account the presence of the UNSIGNED flag of the argument: FLOOR(unsigned decimal) does not need an extra digits. - FLOOR()/CEILING() now preserve the unsigned flag in the result data type is decimal. These changes give nicer data types.
* | | | | | | Merge mariadb-10.5.5Marko Mäkelä2020-08-1060-510/+826
|\ \ \ \ \ \ \
| * | | | | | | MDEV-23330 Server crash or ASAN negative-size-param in my_strnncollsp_binary ↵Sergei Golubchik2020-08-076-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | / SORT_FIELD_ATTR::compare_packed_varstrings and MDEV-23414 Assertion `res->charset() == item->collation.collation' failed in Type_handler_string_result::make_packed_sort_key_part pack_sort_string() *must* take a collation from the Item, not from the String value. Because when casting a string to _binary the original String is not copied for performance reasons, it's reused but its collation does not match Item's collation anymore. Note, that String's collation cannot be simply changed to _binary, because for an Item_string literal the original String must stay unchanged for the duration of the query. this partially reverts 61c15ebe323
| * | | | | | | fixup 58e759a9393f76e558c016a3f84656401b9de1ce: clang ↵Marko Mäkelä2020-08-073-59/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -Winconsistent-missing-override
| * | | | | | | Added 'final' to some classes to improve generated codeMichael Widenius2020-08-045-114/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Final added to: - All reasonable classes inhereted from Field - All classes inhereted from Protocol - Almost all Handler classes - Some important Item classes The stripped size of mariadbd is just 4K smaller, but several object files showed notable improvements in common execution paths. - Checked field.o and item_sum.o Other things: - Added 'override' to a few class functions touched by this patch. - Removed 'virtual' from a new class functions that had/got 'override' - Changed Protocol_discard to inherit from Protocol instad of Protocol_text
| * | | | | | | Merge branch '10.4' into 10.5Oleksandr Byelkin2020-08-0457-326/+630
| |\ \ \ \ \ \ \ | | | |/ / / / / | | |/| | | | |
| | * | | | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2020-08-0359-332/+611
| | |\ \ \ \ \ \ | | | |/ / / / / | | |/| | / / / | | | | |/ / / | | | |/| | |
| | | * | | | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-08-0347-279/+335
| | | |\ \ \ \ | | | | |/ / / | | | |/| | |
| | | | * | | Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-031-1/+1
| | | | |\ \ \ | | | | | |/ / | | | | |/| / | | | | | |/
| | | | | * Fix the typo in fix for MDEV-21472Sergei Petrunia2020-08-031-1/+1
| | | | | |
| | | | * | Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-0248-285/+344
| | | | |\ \ | | | | | |/
| | | | | * improve the error message for a dropped current roleSergei Golubchik2020-07-301-3/+5
| | | | | |
| | | | | * MDEV-22521 Server crashes in traverse_role_graph_up or Assertion `user' ↵Sergei Golubchik2020-07-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | fails in traverse_role_graph_impl
| | | | | * MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks ↵Sergei Petrunia2020-07-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all rows Do not collect EITS statistics for this statement: ALTER TABLE t ANALYZE PARTITION p EITS stats are currently global, not per-partition. Collecting global stats when we are asked to process just one partition causes issues for DBAs.
| | | | | * MDEV-23010 UPDATE privilege at Database and Table level fail to update with ↵Sergei Golubchik2020-07-291-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SELECT command denied to user check both column- and table-level grants when looking for SELECT privilege on UPDATE statement.
| | | | | * cleanup: reduce code duplicationSergei Golubchik2020-07-293-45/+21
| | | | | |