summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-16958 Assertion `field_length < 5' failed in Field_year::val_str or ↵Alexander Barkov2019-03-151-1/+4
| | | | data corruption upon SELECT with UNION and aggregate functions
* fix gcc 8 compiler warningsSergei Golubchik2019-03-1422-72/+85
| | | | | | | | | | | | | | | | | | | | There were two newly enabled warnings: 1. cast for a function pointers. Affected sql_analyse.h, mi_write.c and ma_write.cc, mf_iocache-t.cc, mysqlbinlog.cc, encryption.cc, etc 2. memcpy/memset of nontrivial structures. Fixed as: * the warning disabled for InnoDB * TABLE, TABLE_SHARE, and TABLE_LIST got a new method reset() which does the bzero(), which is safe for these classes, but any other bzero() will still cause a warning * Table_scope_and_contents_source_st uses `TABLE_LIST *` (trivial) instead of `SQL_I_List<TABLE_LIST>` (not trivial) so it's safe to bzero now. * added casts in debug_sync.cc and sql_select.cc (for JOIN) * move assignment method for MDL_request instead of memcpy() * PARTIAL_INDEX_INTERSECT_INFO::init() instead of bzero() * remove constructor from READ_RECORD() to make it trivial * replace some memcpy() with c++ copy assignments
* MDEV-18626 ASAN stack-buffer-overflow in int10_to_str / make_date_time upon ↵Alexander Barkov2019-03-141-1/+1
| | | | DATE_FORMAT
* MDEV-14926 AddressSanitizer: heap-use-after-free in make_date_time on weird ↵Alexander Barkov2019-03-141-10/+6
| | | | combination of functions
* MDEV-18907 Slow log: RENAME TABLE is not "admin", while ALTER TABLE..RENAME isAlexander Barkov2019-03-131-1/+2
|
* MDEV-14033: wsrep_on=off + binlog = mixed on MariaDB 10.2.9Jan Lindström2019-03-131-1/+1
| | | | | If wsrep provider (i.e. galera library) is defined but wsrep_on=OFF we should not force row binlog row format.
* Tests for MDEV-18892 Regression in slow log and admin statementsAlexander Barkov2019-03-121-0/+3
| | | | The patch for MDEV-15945 fixed MDEV-18892. Adding tests only.
* MDEV-15945 --ps-protocol does not test some queriesSergei Golubchik2019-03-1210-125/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make mysqltest to use --ps-protocol more use prepared statements for everything that server supports with the exception of CALL (for now). Fix discovered test failures and bugs. tests: * PROCESSLIST shows Execute state, not Query * SHOW STATUS increments status variables more than in text protocol * multi-statements should be avoided (see tests with a wrong delimiter) * performance_schema events have different names in --ps-protocol * --enable_prepare_warnings mysqltest.cc: * make sure run_query_stmt() doesn't crash if there's no active connection (in wait_until_connected_again.inc) * prepare all statements that server supports protocol.h * Protocol_discard::send_result_set_metadata() should not send anything to the client. sql_acl.cc: * extract the functionality of getting the user for SHOW GRANTS from check_show_access(), so that mysql_test_show_grants() could generate the correct column names in the prepare step sql_class.cc: * result->prepare() can fail, don't ignore its return value * use correct number of decimals for EXPLAIN columns sql_parse.cc: * discard profiling for SHOW PROFILE. In text protocol it's done in prepare_schema_table(), but in --ps it is called on prepare only, so nothing was discarding profiling during execute. * move the permission checking code for SHOW CREATE VIEW to mysqld_show_create_get_fields(), so that it would be called during prepare step too. * only set sel_result when it was created here and needs to be destroyed in the same block. Avoid destroying lex->result. * use the correct number of tables in check_show_access(). Saying "as many as possible" doesn't work when first_not_own_table isn't set yet. sql_prepare.cc: * use correct user name for SHOW GRANTS columns * don't ignore verbose flag for SHOW SLAVE STATUS * support preparing REVOKE ALL and ROLLBACK TO SAVEPOINT * don't ignore errors from thd->prepare_explain_fields() * use select_send result for sending ANALYZE and EXPLAIN, but don't overwrite lex->result, because it might be needed to issue execute-time errors (select_dumpvar - too many rows) sql_show.cc: * check grants for SHOW CREATE VIEW here, not in mysql_execute_command sql_view.cc: * use the correct function to check privileges. Old code was doing check_access() for thd->security_ctx, which is invoker's sctx, not definer's sctx. Hide various view related errors from the invoker. sql_yacc.yy: * initialize lex->select_lex for LOAD, otherwise it'll contain garbage data that happen to fail tests with views in --ps (but not otherwise).
* cleanup: miscSergei Golubchik2019-03-126-73/+33
|
* pass the slow logging information in thd->query_plan_flagsSergei Golubchik2019-03-127-74/+39
| | | | | | | | | | | | This solves the following issues: * unlike lex->m_sql_cmd and lex->sql_command, thd->query_plan_flags is not reset in Prepared_statement::execute, it survives till the log_slow_statement(), so slow logging behaves correctly in --ps * using thd->query_plan_flags for both slow_log_filter and log_slow_admin_statements means the definition of "admin" statements for the slow log is the same no matter how it is filtered out.
* Fix of prepared CREATE VIEW with global ORDER/GROUPOleksandr Byelkin2019-03-121-10/+21
|
* MDEV-11975: SQLCOM_PREPARE of EXPLAIN & ANALYZE statement do not return ↵Oleksandr Byelkin2019-03-123-10/+45
| | | | | | correct metadata info Added metadate info after prepare EXPLAIN/ANALYZE.
* MDEV-11966: Impossible to execute prepared ANALYZE SELECTOleksandr Byelkin2019-03-121-1/+1
| | | | Prepare os ANALYZE now respond as EXPLAIN.
* Merge remote-tracking branch 'origin/10.0' into 10.1Sergey Vojtovich2019-03-111-12/+8
|\
| * MDEV-17595 - ALTER TABLE ADD FOREIGN KEY crashSergey Vojtovich2019-03-111-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ALTER TABLE ... ADD FOREIGN KEY may trigger assertion failure when it has LOCK=EXCLUSIVE clause or concurrent FLUSH TABLES is being executed. In both cases being altered table is marked as flushed, which forces subsequent attempt to open parent table to re-open. Which in turn is not allowed while transaction is running. Rather than opening parent table, just take appropriate MDL lock. Also removed table_already_fk_prelocked() check: MDL itself has much better methods to handle duplicate locks. E.g. the former won't acquire MDL_SHARED_NO_WRITE if it already has MDL_SHARED_READ.
* | A cleanup for MDEV-18333 Slow_queries count doesn't increase when ↵Alexander Barkov2019-03-061-0/+5
| | | | | | | | | | | | | | slow_query_log is turned off thd->lex->m_sql_cmd was not cleared between queries. log_slow_query() could crash (when running mtr --ps) because of this.
* | MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned offAlexander Barkov2019-03-049-29/+84
| |
* | Merge branch '10.0' into 10.1Oleksandr Byelkin2019-03-019-58/+67
|\ \ | |/
| * Merge branch '5.5' into 10.0Oleksandr Byelkin2019-02-289-58/+67
| |\
| | * MDEV-17055: Server crashes in find_order_in_list upon 2nd (3rd) execution of ↵Oleksandr Byelkin2019-02-286-15/+30
| | | | | | | | | | | | | | | | | | | | | SP with UPDATE 1. Always drop merged_for_insert flag on cleanup (there could be errors which prevent TABLE to be assigned) 2. Make more precise cleanup of select parts which was touched
| | * A cleanup in derived table handling: removing duplicate code from ↵Alexander Barkov2019-02-287-44/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | st_select_lex::handle_derived() st_select_lex::handle_derived() and mysql_handle_list_of_derived() had exactly the same implementations. - Adding a new method LEX::handle_list_of_derived() instead - Removing public function mysql_handle_list_of_derived() - Reusing LEX::handle_list_of_derived() in st_select_lex::handle_derived()
| | * MDEV-15950: LOAD DATA INTO compex_view crashedVarun Gupta2019-01-301-0/+5
| | | | | | | | | | | | | | | For multi-table views with LOAD, updates are not allowed, so we should just throw an error.
| | * MDEV-15744: Assertion `derived->table' failed in mysql_derived_merge_for_insertVarun Gupta2019-01-291-2/+3
| | | | | | | | | | | | | | | For singe-table views, we need to find the bottom most base table in the embedded views and then update that table
* | | Revert offending part of MDEV-9519: Data corruption will happen on the ↵Jan Lindström2019-02-281-13/+25
| | | | | | | | | | | | | | | | | | | | | Galera cluster size change This will allow test binlog.binlog_stm_binlog to pass more often. Note that this is not a real fix to that test failure.
* | | MDEV-9519: Data corruption will happen on the Galera cluster size changeJulius Goryavsky2019-02-2510-36/+256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we have a 2+ node cluster which is replicating from an async master and the binlog_format is set to STATEMENT and multi-row inserts are executed on a table with an auto_increment column such that values are automatically generated by MySQL, then the server node generates wrong auto_increment values, which are different from what was generated on the async master. In the title of the MDEV-9519 it was proposed to ban start slave on a Galera if master binlog_format = statement and wsrep_auto_increment_control = 1, but the problem can be solved without such a restriction. The causes and fixes: 1. We need to improve processing of changing the auto-increment values after changing the cluster size. 2. If wsrep auto_increment_control switched on during operation of the node, then we should immediately update the auto_increment_increment and auto_increment_offset global variables, without waiting of the next invocation of the wsrep_view_handler_cb() callback. In the current version these variables retain its initial values if wsrep_auto_increment_control is switched on during operation of the node, which leads to inconsistent results on the different nodes in some scenarios. 3. If wsrep auto_increment_control switched off during operation of the node, then we must return the original values of the auto_increment_increment and auto_increment_offset global variables, as the user has set. To make this possible, we need to add a "shadow copies" of these variables (which stores the latest values set by the user). https://jira.mariadb.org/browse/MDEV-9519
* | | MDEV-17942 fixup : protect rebuild_check_host() / rebuild_role_grants() ↵Vladislav Vaintroub2019-02-201-6/+7
| | | | | | | | | | | | with acl_cache->lock mutex
* | | MDEV-17942 Assertion `found' failed in remove_ptr_from_dynarray after ↵Vladislav Vaintroub2019-02-201-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | failed CREATE OR REPLACE Failed CREATE OR REPLACE for existing user removes that user from acl_users array. Thus dependend structures (roles, check_host) must be rebuilt.
* | | Merge 10.1 into 10.1Marko Mäkelä2019-02-027-76/+104
|\ \ \ | |/ / | | | | | | This is joint work with Oleksandr Byelkin.
| * | Merge branch '5.5' into 10.0Oleksandr Byelkin2019-01-286-24/+89
| |\ \ | | |/
| | * Bug #28499924: INCORRECT BEHAVIOR WITH UNION IN SUBQUERYSreeharsha Ramanavarapu2019-01-231-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: ------ When a subquery contains UNION the count of the number of subquery columns is calculated incorrectly. Only the first query block in the subquery's UNION is considered and an array indexing goes out-of-bounds, and this is caught by an assert. Solution: --------- Sum up the columns from all query blocks of the query expression. Change specific to 5.6/5.5: --------------------------- The "child" points to the last query block of the UNION (as opposed to 5.7+ where it points to the first member of UNION). So "child->master_unit()->first_select()" is used to reach the first query block of UNION.
| | * Bug #28178776 COMPARISON OF UNINITAILIZED MEMORY IN LOG_IN_USEAditya A2019-01-232-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PROBLEM ------- Memory sanitizer reports uninitialized comparisons in log_in_use(), because strings are compared with memcmp() instead of strncmp. FIX --- Use strncmp() to compare strings
| | * MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctlyOleksandr Byelkin2019-01-161-1/+4
| | | | | | | | | | | | The problem was in calculating of the mask to clear unused null bits in case of using full byte.
| | * Backport MDEV-17504 to 5.5Vladislav Vaintroub2019-01-112-7/+67
| | | | | | | | | | | | | | | mysql_install_db.exe should not remove datadir, if it was not created by it.
| * | cleanup: fill_alter_inplace_infoSergei Golubchik2019-01-251-51/+13
| | | | | | | | | | | | | | | remove attempts to track "candidate keys", use what was already decided in create_table_impl().
| * | compiler warningSergei Golubchik2019-01-251-1/+1
| | |
| * | MDEV-18255: Server crashes in Bitmap<64u>::intersectVarun Gupta2019-01-241-1/+2
| | | | | | | | | | | | | | | | | | | | | Calling st_select_lex::update_used_tables in JOIN::optimize_unflattened_subqueries only when we are sure that the join have not been cleaned up. This can happen for a case when we have a non-merged semi-join and an impossible where which would lead to the cleanup of the join which has the non-merged semi-join
* | | Fix embedded innodb_plugin after 560799ebd8efe11f4c4ae1bb9ed4d39185e03800Marko Mäkelä2019-02-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wsrep_certification_rules: Define as a weak global symbol. While there are separate _embedded.a for statically linked storage engine plugins, there is only one ha_innodb.so which is supposed to work with both values of WITH_WSREP. The merge from 10.0-galera introduced a reference to a global variable that is only defined when the server is built WITH_WSREP. We must define that symbol as weak global, so that when a dynamically linked InnoDB or XtraDB is used with the embedded server (which never includes write-set replication patches), the variable will be read as 0, instead of causing a failure to load the InnoDB or XtraDB plugin.
* | | postmerge rollbacks and fixesOleksandr Byelkin2019-01-311-11/+1
| | |
* | | Merge branch '10.0-galera' into 10.1Oleksandr Byelkin2019-01-315-0/+62
|\ \ \
| * \ \ Merge remote-tracking branch 'origin/10.0' into 10.0-galeraJan Lindström2018-11-021-0/+6
| |\ \ \
| * \ \ \ Merge remote-tracking branch 'origin/10.0' into bb-10.0-galeraJan Lindström2018-10-3129-198/+328
| |\ \ \ \
| * \ \ \ \ Merge remote-tracking branch 'origin/5.5-galera' into 10.0-galeraJan Lindström2018-10-3032-347/+278
| |\ \ \ \ \
| | * \ \ \ \ Merge tag 'mariadb-5.5.62' into 5.5-galeramariadb-galera-5.5.62Jan Lindström2018-10-2928-344/+213
| | |\ \ \ \ \
| | * | | | | | Add missing file.Jan Lindström2018-10-101-0/+26
| | | | | | | |
| | * | | | | | Make config knob wsrep_certification_rules dynamicVasil Dimov2018-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no reason for it to be readonly at runtime and it is dynamic in 5.6+ already.
| | * | | | | | Add a new config variable wsrep_certification_rulesVasil Dimov2018-10-103-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is used for controlling whether to use a new/optimized certification rules or the old/classic ones that could cause more certification failures - when foreign keys are used and two INSERTs are done concurrently to the child table from different nodes. (cherry picked from commit 815d73e6af8daace6262ab63ca6c043ffc4204b3)
* | | | | | | | MDEV-18379: Unification of check for IPv6Julius Goryavsky2019-01-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains the port of the MDEV-18379 patch for 10.1 branch, but also includes a number of changes made within MDEV-17835, which are necessary for the normal operation of tests that use IPv6: 1) Fixed flaws in the galera_3nodes mtr suite control scripts, because of which they could not work with mariabackup. 2) Fixed numerous bugs in the SST scripts and in the mtr test files (galera_3nodes mtr suite) that prevented the use of Galera with IPv6 addresses. 3) Fixed flaws in tests for rsync and mysqldump (for galera_3nodes mtr tests suite). These tests were not performed successfully without these fixes. 4) Currently, the three-node mtr suite for Galera (galera_3nodes) uses a separate IPv6 availability check using the "have_ipv6.inc" file. This check duplicates a more accurate check at suite.pm level, which can be used by including the file "check_ipv6.inc". This patch removes this discrepancy between suites. 5) GAL-501 test in the galera_3nodes suite does not contain the option "--bind-address=::" which is needed for the test to work correctly with IPv6 (at least on some systems), since without it the server will not wait for connections on the IPv6 interface. https://jira.mariadb.org/browse/MDEV-18379 and partially https://jira.mariadb.org/browse/MDEV-17835
* | | | | | | | MDEV-17803: ulonglongization of table_mapping entry::table_id to fix windows ↵Andrei Elkin2019-01-253-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | compilation in particular.
* | | | | | | | MDEV-10963 Fragmented BINLOG queryAndrei Elkin2019-01-248-36/+277
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was originally stated in http://bugs.mysql.com/bug.php?id=82212 The size of an base64-encoded Rows_log_event exceeds its vanilla byte representation in 4/3 times. When a binlogged event size is about 1GB mysqlbinlog generates a BINLOG query that can't be send out due to its size. It is fixed with fragmenting the BINLOG argument C-string into (approximate) halves when the base64 encoded event is over 1GB size. The mysqlbinlog in such case puts out SET @binlog_fragment_0='base64-encoded-fragment_0'; SET @binlog_fragment_1='base64-encoded-fragment_1'; BINLOG @binlog_fragment_0, @binlog_fragment_1; to represent a big BINLOG. For prompt memory release BINLOG handler is made to reset the BINLOG argument user variables in the middle of processing, as if @binlog_fragment_{0,1} = NULL is assigned. Notice the 2 fragments are enough, though the client and server still may need to tweak their @@max_allowed_packet to satisfy to the fragment size (which they would have to do anyway with greater number of fragments, should that be desired). On the lower level the following changes are made: Log_event::print_base64() remains to call encoder and store the encoded data into a cache but now *without* doing any formatting. The latter is left for time when the cache is copied to an output file (e.g mysqlbinlog output). No formatting behavior is also reflected by the change in the meaning of the last argument which specifies whether to cache the encoded data. Rows_log_event::print_helper() is made to invoke a specialized fragmented cache-to-file copying function which is copy_cache_to_file_wrapped() that takes care of fragmenting also optionally wraps encoded strings (fragments) into SQL stanzas. my_b_copy_to_file() is refactored to into my_b_copy_all_to_file(). The former function is generalized to accepts more a limit argument to constraint the copying and does not reinitialize anymore the cache into reading mode. The limit does not do any effect on the fully read cache.
* | | | | | | | MDEV-14605 Changes to "ON UPDATE CURRENT_TIMESTAMP" fields are notAndrei Elkin2019-01-243-5/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | always logged properly with binlog_row_image=MINIMAL There are two issues fixed in this commit. The first is an observation of a multi-table UPDATE binlogged in row-format in binlog_row_image=MINIMAL mode. While the UPDATE aims at a table with an ON-UPDATE attribute its binlog after-image misses to record also installed default value. The reason for that turns out missed marking of default-capable fields in TABLE::write_set. This is fixed to mark such fields similarly to 10.2's MDEV-10134 patch (db7edfed17efe6) that introduced it. The marking follows up 93d1e5ce0b841bed's idea to exploit TABLE:rpl_write_set introduced there though, and thus does not mess (in 10.1) with the actual MDEV-10134 agenda. The patch makes formerly arg-less TABLE::mark_default_fields_for_write() to accept an argument which would be TABLE:rpl_write_set. The 2nd issue is extra columns in in binlog_row_image=MINIMAL before-image while merely a packed primary key is enough. The test main.mysqlbinlog_row_minimal always had a wrong result recorded. This is fixed to invoke a function that intended for read_set possible filtering and which is called (supposed to) in all type of MDL, UPDATE including; the test results have gotten corrected. At *merging* from 10.1->10.2 the 1st "main" part of the patch is unnecessary since the bug is not observed in 10.2, so only hunks from sql/sql_class.cc are required.