summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-22830:SQL_CALC_FOUND_ROWS not working properly for single SELECT for DUALbb-10.1-MDEV-22830rucha1742020-06-093-1/+13
| | | | | | | | | | | In case of SELECT without tables which returns either 0 or 1 rows, JOIN::exec_inner() did not check if the flag representing SQL_CALC_FOUND_ROWS is set or not and send_records was direclty assigned 0. So SELECT FOUND_ROWS() was giving 0 in the output. Now it checks if the flag is set, if it is set send_record=1 else 0. 1 is the number of rows that could have been sent to the client if the SELECT query had SQL_CALC_FOUND_ROWS. It is 0 when no rows were sent because the SELECT query did not have SQL_CALC_FOUND_ROWS.
* MDEV-22728: SIGFPE in Unique::get_cost_calc_buff_size from ↵Varun Gupta2020-06-074-1/+70
| | | | | | | | prepare_search_best_index_intersect on optimized builds For low sort_buffer_size, in the cost calculation of using the Unique object the elements in the tree were evaluated to 0, make sure to have atleast 1 element in the Unique tree. Also for the function Unique::get allocate memory for atleast MERGEBUFF2+1 keys.
* MDEV-22715: SIGSEGV in radixsort_for_str_ptr and in native_compare/my_qsort2 ↵Varun Gupta2020-06-0523-47/+135
| | | | | | | | | | | | | (optimized builds) For DECIMAL[(M[,D])] datatype max_sort_length was not being honoured which was leading to buffer overflow while making the sort key. The fix to this problem would be to create sort keys for decimals with atmost max_sort_key bytes Important: The minimum value of max_sort_length has been raised to 8 (previously was 4), so fixed size datatypes like DOUBLE and BIGINIT are not truncated for lower values of max_sort_length.
* Added missing include files to check for debug_syncJulius Goryavsky2020-06-032-0/+6
|
* MDEV-22763 backporting MDEV-20225 fix into 10.1sjaakola2020-06-0311-12/+978
| | | | | | Backported the support for aborting and replaying stored procedure and fix for trigger key assigments from 10.4 version. Backported also two mtr tests: wsrep_sp_bf_abort and MDEV-20225
* Fix duplicate wordBernard Spil2020-06-021-1/+1
| | | | | both both -> both Closes #1560
* Attempt fixing mroonga gcc 8 build failureSergey Vojtovich2020-05-291-1/+1
| | | | | Part of MDEV-19061 - table_share used for reading statistical tables is not protected
* Thread safe histograms loadingSergey Vojtovich2020-05-294-103/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously multiple threads were allowed to load histograms concurrently. There were no known problems caused by this. But given amount of data races in this code, it'd happen sooner or later. To avoid scalability bottleneck, histograms loading is protected by per-TABLE_SHARE atomic variable. Whenever histograms were loaded by preceding statement (hot-path), a scalable load-acquire check is performed. Whenever histograms have to be loaded anew, mutual exclusion for loaders is established by atomic variable. If histograms are being loaded concurrently, statement waits until load is completed. - Table_statistics::total_hist_size moved to TABLE_STATISTICS_CB: only meaningful within TABLE_SHARE (not used for collected stats). - TABLE_STATISTICS_CB::histograms_can_be_read and TABLE_STATISTICS_CB::histograms_are_read are replaced with a tri state atomic variable. - Simplified away alloc_histograms_for_table_share(). Note: there's still likely a data race if a thread attempts accessing histograms data after it failed to load it (because of concurrent load). It was there previously and goes out of the scope of this effort. One way of fixing it could be reviving TABLE::histograms_are_read and adding appropriate checks whenever it is needed. Part of MDEV-19061 - table_share used for reading statistical tables is not protected
* Thread safe statistics loadingSergey Vojtovich2020-05-293-60/+116
| | | | | | | | | | | | | | | | | | | | | | | Previously multiple threads were allowed to load statistics concurrently. There were no known problems caused by this. But given amount of data races in this code, it'd happen sooner or later. To avoid scalability bottleneck, statistics loading is protected by per-TABLE_SHARE atomic variable. Whenever statistics were loaded by preceding statement (hot-path), a scalable load-acquire check is performed. Whenever statistics have to be loaded anew, mutual exclusion for loaders is established by atomic variable. If statistics are being loaded concurrently, statement waits until load is completed. TABLE_STATISTICS_CB::stats_can_be_read and TABLE_STATISTICS_CB::stats_is_read are replaced with a tri state atomic variable. Part of MDEV-19061 - table_share used for reading statistical tables is not protected
* Simplified away statistics_for_tables_is_needed()Sergey Vojtovich2020-05-291-81/+31
| | | | | | | | | | Removed redundant loops, integrated logics into the caller instead. Unified condition in read_statistics_for_tables(), less "table_share != NULL" checks, no more potential "table_share == NULL" dereferencing. Part of MDEV-19061 - table_share used for reading statistical tables is not protected
* MDEV-22744 *SAN: sql/item_xmlfunc.cc:791:43: runtime error: downcast of ↵Alexander Barkov2020-05-291-2/+1
| | | | | | | | | address ... which does not point to an object of type 'Item_func' note: object is of type 'Item_bool' (on optimized builds) In Item_nodeset_func_predicate::val_nodeset, args[1] is not necessarily an Item_func descendant. It can be Item_bool. Removing a wrong cast. It was not really needed anyway.
* fix pre-definition for embedded server for find_user_or_anon()Anel Husakovic2020-05-281-28/+22
| | | | | | | | | | | | | | | | | | | | | | | | Pre-definitions are allowed for non-embedded. Failur catched with: ``` cmake ../../10.1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=g++-9 -DCMAKE_C_COMPILER=gcc-9 -DWITH_EMBEDDED_SERVER=ON -DCMAKE_BUILD_TYPE=Debug -DPLUGIN_{ARCHIVE,TOKUDB,MROONGA,OQGRAPH,ROCKSDB,PERFSCHEMA,SPIDER,SPHINX}=N -DMYSQL_MAINTAINER_MODE=ON -DNOT_FOR_DISTRIBUTION=ON ``` Alternative fix would be ``` --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -201,8 +201,10 @@ LEX_STRING current_user= { C_STRING_WITH_LEN("*current_user") }; LEX_STRING current_role= { C_STRING_WITH_LEN("*current_role") }; LEX_STRING current_user_and_current_role= { C_STRING_WITH_LEN("*current_user_and_current_role") }; +#ifndef EMBEDDED_LIBRARY class ACL_USER; static ACL_USER *find_user_or_anon(const char *host, const char *user, const char *ip); +#endif ```
* MDEV-22312: Bad error message for SET DEFAULT ROLE when user account is not ↵Anel Husakovic2020-05-288-45/+294
| | | | | | | | | | | | | | | granted the role - `SET DEFAULT ROLE xxx [FOR yyy]` should say: "User yyy has not been granted a role xxx" if: - The current user (not the user `yyy` in the FOR clause) can see the role xxx. It can see the role if: * role exists in `mysql.roles_mappings` (traverse the graph), * If the current user has read access on `mysql.user` table - in that case, it can see all roles, granted or not. - Otherwise it should be "Invalid role specification". In other words, it should not be possible to use `SET DEFAULT ROLE` to discover whether a specific role exist or not.
* MDEV-15152 Optimistic parallel slave doesnt cope well with START SLAVE UNTILAndrei Elkin2020-05-266-19/+806
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The immediate bug was caused by a failure to recognize a correct position to stop the slave applier run in optimistic parallel mode. There were the following set of issues that the analysis unveil. 1 incorrect estimate for the event binlog position passed to is_until_satisfied 2 wait for workers to complete by the driver thread did not account non-group events that could be left unprocessed and thus to mix up the last executed binlog group's file and position: the file remained old and the position related to the new rotated file 3 incorrect 'slave reached file:pos' by the parallel slave report in the error log 4 relay log UNTIL missed out the parallel slave branch in is_until_satisfied. The patch addresses all of them to simplify logics of log change notification in either the master and relay-log until case. P.1 is addressed with passing the event into is_until_satisfied() for proper analisis by the function. P.2 is fixed by changes in handle_queued_pos_update(). P.4 required removing relay-log change notification by workers. Instead the driver thread updates the notion of the current relay-log fully itself with aid of introduced bool Relay_log_info::until_relay_log_names_defer. An extra print out of the requested until file:pos is arranged with --log-warning=3.
* Merge 5.5 into 10.1Marko Mäkelä2020-05-262-0/+4
|\
| * MDEV-22513 main.processlist_notembedded Timeout in wait_until_count_sessionsMarko Mäkelä2020-05-262-0/+4
| | | | | | | | | | | | Do not blindly disconnect the connection that is in WAIT_FOR because it could happen that neither the disconnect nor the SIGNAL would be processed before RESET would discard the signal.
| * bump the VERSIONDaniel Bartholomew2020-05-111-1/+1
| |
* | MDEV-21495: Conditional jump or move depends on uninitialised value in ↵Varun Gupta2020-05-264-0/+43
| | | | | | | | | | | | | | sel_arg_range_seq_next Initialize the parameter PARAM::max_key_part when we iterate over the ranges to get estimates from EITS.
* | MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets ↵Alexander Barkov2020-05-224-60/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed The code incorrectly assumed in multiple places that TYPELIB values cannot have 0x00 bytes inside. In fact they can: CREATE TABLE t1 (a ENUM(0x61, 0x0062) CHARACTER SET BINARY); Note, the TYPELIB value encoding used in FRM is ambiguous about 0x00. So this fix is partial. It fixes 0x00 bytes in many (but not all) places: - In the middle or in the end of a value: CREATE TABLE t1 (a ENUM(0x6100) ...); CREATE TABLE t1 (a ENUM(0x610062) ...); - In the beginning of the first value: CREATE TABLE t1 (a ENUM(0x0061)); CREATE TABLE t1 (a ENUM(0x0061), b ENUM('b')); - In the beginning of the second (and following) value of the *last* ENUM/SET in the table: CREATE TABLE t1 (a ENUM('a',0x0061)); CREATE TABLE t1 (a ENUM('a'), b ENUM('b',0x0061)); However, it does not fix 0x00 when: - 0x00 byte is in the beginning of a value of a non-last ENUM/SET causes an error: CREATE TABLE t1 (a ENUM('a',0x0061), b ENUM('b')); ERROR 1033 (HY000): Incorrect information in file: './test/t1.frm' This is an ambuguous case and will be fixed separately. We need a new TYPELIB encoding to fix this. Details: - unireg.cc The function pack_header() incorrectly used strlen() to detect a TYPELIB value length. Adding a new function typelib_values_packed_length() which uses TYPELIB::type_lengths[n] to detect the n-th value length, and reusing the new function in pack_header() and packed_fields_length() - table.cc fix_type_pointers() assumed in multiple places that values cannot have 0x00 inside and used strlen(TYPELIB::type_names[n]) to set the corresponding TYPELIB::type_lengths[n]. Also, fix_type_pointers() did not check the encoded data for consistency. Rewriting fix_type_pointers() code to populate TYPELIB::type_names[n] and TYPELIB::type_lengths[n] at the same time, so no additional loop with strlen() is needed any more. Adding many data consistency tests. Fixing the main loop in fix_type_pointers() to use memchr() instead of strchr() to handle 0x00 properly. Fixing create_key_infos() to return the result in a LEX_STRING rather that in a char*.
* | MDEV-22451: SIGSEGV in __memmove_avx_unaligned_erms/memcpy from _my_b_write ↵Sujatha2020-05-206-1/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on CREATE after RESET MASTER Analysis: ======== RESET MASTER TO # command deletes all binary log files listed in the index file, resets the binary log index file to be empty, and creates a new binary log with number #. When the user provided binary log number is greater than the max allowed value '2147483647' server fails to generate a new binary log. The RESET MASTER statement marks the binlog closure status as 'LOG_CLOSE_TO_BE_OPENED' and exits. Statements which follow RESET MASTER try to write to binary log they find the log_state != LOG_CLOSED and proceed to write to binary log cache and it results in crash. Fix: === During MYSQL_BIN_LOG open, if generation of new binary log name fails then the "log_state" needs to be marked as "LOG_CLOSED". With this further statements will find binary log as closed and they will skip writing to the binary log.
* | MDEV-22631 fixRasmus Johansson2020-05-201-1/+11
| |
* | MDEV-22258 Limit innodb_encryption_threads to 255Marko Mäkelä2020-05-203-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For no good reason, innodb_encryption_threads was limited to 4,294,967,295. Expectedly, the server would crash if such an insane value was specified. Let us limit the maximum to 255. The encryption threads are not doing much useful work. They are basically only dirtying pages by performing dummy writes via the redo log. The encryption key rotation or the in-place addition or removal of encryption will take place in the page cleaner. In a quick test on a 20-core CPU (40 threads in total), the sweet spot on an otherwise idle server seemed to be innodb_encryption_threads=16 for the test encryption.encrypt_and_grep. The new limit 255 should be more than enough for even bigger servers.
* | MDEV-22472 rpl.rpl_fail_register failed in buildbot with wrong resultAndrei Elkin2020-05-191-2/+1
| | | | | | | | | | | | | | | | This is a new test from upstream that did not expect the correct value of the command slot of the Dump thread when the latter gets killed. The test is made to expect "Killed" string as the command in show-processlist as it is supposed to when a thread gets killed.
* | MDEV-22636 XML output for mtr doesn't work with valgrind optionRasmus Johansson2020-05-191-0/+1
| |
* | MDEV-22631 some test causes MTR interruption without generating summary and XMLRasmus Johansson2020-05-192-3/+11
| |
* | MDEV-22520 Assertion `gathered_length == thd->lex->comment.length` failed in ↵Andrei Elkin2020-05-183-1/+10
| | | | | | | | | | | | | | | | | | | | | | binlog_defragment The assert was caused by early cleanup of a user variable participant in BINLOG @var,@var where it plays twice. That was unexpected by the base code to clear its value prematurely. Fixed with relocating the user var destruction after operations with its value is over.
* | MDEV-21976: mtr main.udf - broaden localhost (#1543)Daniel Black2020-05-182-4/+4
| | | | | | | | Localhost, depending on the platform can return any 127.0.0.1/8 address.
* | MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a ↵Alexander Barkov2020-05-154-4/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | virtual column The code erroneously allowed both: INSERT INTO t1 (vcol) VALUES (DEFAULT); INSERT INTO t1 (vcol) VALUES (DEFAULT(non_virtual_column)); The former is OK, but the latter is not. Adding a new virtual method in Item: virtual bool vcol_assignment_allowed_value() const { return false; } Item_null, Item_param and Item_default_value override it. Item_default_value overrides it in the way to: - allow DEFAULT - disallow DEFAULT(col)
* | MDEV-22498: SIGSEGV in Bitmap<64u>::merge on SELECTVarun Gupta2020-05-143-3/+62
| | | | | | | | | | | | | | | | For the case when the optimizer does the IN-EXISTS transformation, the equality condition is injected in the WHERE OR HAVING clause of the subquery. If the select list of the subquery has a reference to the parent select make sure to use the reference and not the original item.
* | MDEV-22070 MSAN use-of-uninitialized-value in encryption.innodb-redo-badkeyMarko Mäkelä2020-05-142-6/+14
| | | | | | | | | | | | | | | | | | | | | | On a checksum failure of a ROW_FORMAT=COMPRESSED page, buf_LRU_free_one_page() would invoke buf_LRU_block_remove_hashed() which will read the uncompressed page frame, although it would not be initialized. With bad enough luck, fil_page_get_type(page) could return an unrecognized value and cause the server to abort. buf_page_io_complete(): On the corruption of a ROW_FORMAT=COMPRESSED page, zerofill the uncompressed page frame.
* | MDEV-22502 MDB crashes in CREATE TABLE AS SELECT when the precision of ↵Alexander Barkov2020-05-143-0/+32
| | | | | | | | | | | | | | returning type = 0. TRUNCATE(decimal_5_5) erroneously tried to create a DECIMAL(0,0) column. Creating a DECIMAL(1,0) column instead.
* | MDEV-22503 MDB limits DECIMAL column precision to 16 doing CTAS with ↵Alexander Barkov2020-05-143-0/+768
| | | | | | | | | | | | | | | | floor/ceil over DECIMAL(X,Y) where X > 16 The DECIMAL data type branch in Item_func_int_val::fix_length_and_dec() incorrectly used DOUBLE-style length calculation, which resulted in a smaller data type than the actual result of FLOOR()/CEIL() needs.
* | Merge branch '10.1-release' into 10.1Oleksandr Byelkin2020-05-1113-348/+436
|\ \
| * | cleanup: foreign-keys.test vs foreign_key.testmariadb-10.1.45Sergei Golubchik2020-05-086-377/+371
| | |
| * | MDEV-22180 Planner opens unnecessary tables when updated table is referenced ↵Sergei Golubchik2020-05-083-1/+57
| | | | | | | | | | | | | | | | | | | | | | | | by foreign keys under LOCK TABLES we still have to open everything, otherwise DML prelocking will try to take an MDL on a table that wasn't in the LOCK TABLES list.
| * | MDEV-22180 Planner opens unnecessary tables when updated table is referenced ↵Sergei Golubchik2020-05-063-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | by foreign keys only MDL-prelock but do not open FK child tables for read-only (RESTRICT) FK actions. Tables still needs to be opened for CASCADE actions, see 9180e8666b8
| * | Merge branch '5.5' into 10.1Sergei Golubchik2020-05-062-3/+9
| |\ \ | | |/
| | * MDEV-21462: Actually test for the original bugmariadb-5.5.68Marko Mäkelä2020-05-061-1/+1
| | | | | | | | | | | | We must ensure that the NUL will not terminate the query string.
| | * MDEV-21462 main.processlist_notembedded fails to clean upMarko Mäkelä2020-05-062-3/+9
| | | | | | | | | | | | | | | Replace the 30-second sleep in the test with proper DEBUG_SYNC interlocking.
| * | MDEV-21437 MariaDB's SUSE/SLES packages don't "provide" all of the same ↵Sergei Golubchik2020-05-052-2/+11
| | | | | | | | | | | | capabilities as the platform's default packages
| * | List of unstable tests for 10.1.45 releaseElena Stepanova2020-05-051-57/+33
| | |
* | | bump the VERSIONDaniel Bartholomew2020-05-111-1/+1
| | |
* | | MDEV-22501 Various issues when using --innodb-data-file-size-debug=-1Marko Mäkelä2020-05-083-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let us limit the maximum value of the debug parameter innodb_data_file_size to 256 MiB. It is only being used in the test innodb.log_data_file_size, and the size of the system tablespace should never exceed some 70 MiB in ./mtr. Thus, 256 MiB should be a reasonable limit. The fact that negative values that are passed to unsigned parameters wrap around to the maximum value appears to be a regression due to commit 18ef02b04dfae21148c7397d088c7ffdfcd23c4e and has been filed as bug MDEV-22219.
* | | MDEV-22497 [ERROR] InnoDB: Unable to purge a recordMarko Mäkelä2020-05-072-82/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The InnoDB insert buffer was upgraded in MySQL 5.5 into a change buffer that also covers delete-mark and delete (purge) operations. There is an important constraint for delete operations: a B-tree leaf page must not become empty unless the entire tree becomes empty, consisting of an empty root page. Because change buffer merges only occur on a single leaf page at a time, delete operations must not be buffered if it is possible that the last record of the page could be deleted. (In that case, we would refuse to use the change buffer, and if we really delete the last record, we would shrink the index tree.) The function ibuf_get_volume_buffered_hash() is part of our insurance that the page would not become empty. It is supposed to map each buffered INSERT or DELETE_MARK record payload into a hash value. We will only count each such record as a distinct key if there is no hash collision. DELETE operations will always decrement the predicted number fo records in the page. Due to a bug in the function, we would actually compute the hash value not only on the record payload, but also on some following bytes, in case the record contains NULL values. In MySQL Bug #61104, we had some examples of this dating back to 2012. But back then, we failed to reproduce the bug, and in commit d84c95579ba1eca2f9bf5b0be9f14040e4441227 we simply demoted the hard assertion to a message printout and a debug assertion failure. ibuf_get_volume_buffered_hash(): Correctly compute the hash value of the payload bytes only. Note: we will consider ('foo','bar'),(NULL,'foobar'),('foob','ar') to be equal, but this is not a problem, because in case of a hash collision, we could also consider ('boo','far') to be equal, and underestimate the number of records in the page, leading to refusing to buffer a DELETE.
* | | Windows, mtr : Fix "Subroutine HAVE_WIN32_CONSOLE redefined at (eval 25) ↵Vladislav Vaintroub2020-05-071-1/+1
| | | | | | | | | | | | line 1."
* | | MDEV-22344: Fix typos in commentsAnel Husakovic2020-05-063-4/+4
| | |
* | | postfix after e3f5789ac0b2 - var/log/stdout.log contains escape sequences.Vladislav Vaintroub2020-05-051-1/+1
| | |
* | | MDEV-22273 jUnit patch: xml test result differs from MTR output in case if retryRasmus Johansson2020-05-042-4/+8
| | |
* | | MDEV-22270 JUnit patch: test name contains classnameRasmus Johansson2020-05-041-0/+1
|/ /
* | MDEV-19092 Server crash when renaming the column whenbb-10.1-MDEV-19092Thirunarayanan Balathandayuthapani2020-05-044-14/+101
| | | | | | | | | | | | | | | | FOREIGN_KEY_CHECKS is disabled - Referenced index can be null While renaming the referenced column name. In that case, rename the referenced column name in dict_foreign_t and find the equivalent referenced index.