summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-31162 Crash for query using ROWNUM over multi-table view with ORDER BYbb-10.6-igorIgor Babaev2023-05-024-9/+10
| | | | | | | | | | | | | | | | | | | | | This bug could cause a crash of the server when processing a query with ROWNUM() if it used in its FROM list a reference to a mergeable view defined as SELECT over more than one table that contained ORDER BY clause. When a mergeable view with ORDER BY clause and without LIMIT clause is used in the FROM list of a query that does not have ORDER BY clause the ORDER BY clause of the view is moved to the query. The code that performed this transformation forgot to delete the moved ORDER BY list from the view. If a query contains ROWNUM() and uses a mergeable multi-table view with ORDER BY then according to the current code of TABLE_LIST::init_derived() the view has to be forcibly materialized. As the query and the view shared the same items in its ORDER BY lists they could not be properly resolved either in the query or in the view. This led to a crash of the server. This patch has returned back the original signature of LEX::can_not_use_merged() to comply with 10.4 code of the condition that checks whether a megeable view has to be forcibly materialized. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* MDEV-31143 Crash for query using ROWNUM() over view with ORDER BYIgor Babaev2023-04-302-2/+2
| | | | | | | | | | | | | | | When processing a query over a mergeable view at some conditions checked at prepare stage it may be decided to materialize the view rather than to merge it. Before this patch in such case the field 'derived' of the TABLE_LIST structure created for the view remained set to 0. As a result the guard condition preventing range analysis for materialized views did not work properly. This led to a call of some handler method for the temporary table created to contain the view's records that was supposed to be used only for opened tables. However temporary tables created for materialization of derived tables or views are not opened yet when range analysis is performed. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* MDEV-30812: Improve output cardinality estimates for hash joinbb-10.6-mdev30812Sergei Petrunia2023-04-283-33/+196
| | | | | | | | | | | Introduce @@optimizer_switch flag: hash_join_cardinality When it is on, use EITS statistics to produce tighter bounds for hash join output cardinality. Amended by Monty. Reviewed by: Monty <monty@mariadb.org>
* MDEV-31073 Server crash, assertion `table != 0 && view->field_translation != ↵Oleksandr Byelkin2023-04-274-3/+20
| | | | | | | | 0' failure with ROWNUM and view Now the same rule applied to vews and derived tables. So we should allow merge of views (and derived) in queries with rownum, because it do not change results, only makes query plans better.
* Merge 10.5 into 10.6Marko Mäkelä2023-04-276-20/+41
|\
| * Merge 10.4 into 10.5Marko Mäkelä2023-04-276-20/+41
| |\
| | * MDEV-11356 Option skip-core-file does not workSergei Golubchik2023-04-262-9/+3
| | | | | | | | | | | | | | | remove ancient hard-coded treatment of --core-file. This enables normal my_getopt behavior for the already existing sysvar
| | * MDEV-30620 Trying to lock uninitialized LOCK_parallel_entryAndrei2023-04-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The error was seen by a number of mtr tests being caused by overdue initialization of rpl_parallel::LOCK_parallel_entry. Specifically, SHOW-SLAVE-STATUS might find in rpl_parallel::workers_idle() a gtid domain hash entry already inserted whose mutex had not done mysql_mutex_init(). Fixed with swapping the mutex init and the its entry's stack insertion. Tested with a generous number of `mtr --repeat` of a few of the reported to fail tests, incl rpl.parallel_backup.
| | * MDEV-30430: Enabling system versioning on tables without primary key breaks ↵Brandon Nesterenko2023-04-241-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | replication When replicating MDL events for a table that uses system versioning without primary keys, ensure that for data sets with duplicate records, the updates to these records with duplicates are enacted on the correct row. That is, there was a bug (reported in MDEV-30430) such that the function to find the row to update would stop after finding the first matching record. However, in the absence of primary keys, the version of the record is needed to compare the row to ensure we are updating the correct one. The fix, therefore, updates the record comparison functionality to use system version columns when there are no primary keys on the table. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
| | * MDEV-28798: Previously Binlog Encrypted Master Segfaults on Binlog Dump with ↵Brandon Nesterenko2023-04-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using_Gtid=Slave_Pos Problem: ======== A master can segfault if it can't set up decryption for its binary log during a binlog dump with Using_Gtid=Slave_Pos. If slave connects using GTID mode, the master will call into log.cc::get_gtid_list_event(), which iterate through binlog events looking for a Gtid_list_log_event. On an encrypted binlog that the master cannot decrypt, the first event will be a START_ENCRYPTION_EVENT which will call into the following decryption branch if (fdle->start_decryption((Start_encryption_log_event*) ev)) errormsg= ‘Could not set up decryption for binlog.’; The event iteration however, does not stop in spite of this error. The master will try to read the next event, but segfault while trying to decrypt it because decryption failed to initialize. Solution: ======== Break the event iteration if decryption cannot be set up. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
| | * MDEV-31102 Crash when pushing condition into view defined as unionIgor Babaev2023-04-241-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug could manifest itself at the first execution of prepared statement created for queries using a materialized view defined as union. A crash could happen for sure if the query contained a condition pushable into the view and this condition was over the column defined via a complex string expression requiring implicit conversion from one charset to another for some of its sub-expressions. The bug could cause crashes when executing PS for some other queries whose optimization needed building clones for such expressions. This bug was introduced in the patch for MDEV-29988 where the class Item_direct_ref_to_item was added. The implementations of the virtual methods get_copy() and build_clone() were invalid for the class and this could cause crashes after the method build_clone() was called for expressions containing objects of the Item_direct_ref_to_item type. Approved by Sergei Golubchik <serg@mariadb.com>
* | | Merge 10.5 into 10.6Marko Mäkelä2023-04-2513-49/+126
|\ \ \ | |/ /
| * | MDEV-31038: Parallel Replication Breaks if XA PREPARE Fails Updating Slave ↵Brandon Nesterenko2023-04-243-22/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GTID State If a replica failed to update the GTID slave state when committing an XA PREPARE, the replica would retry the transaction and get an out-of-order GTID error. This is because the commit phase of an XA PREPARE is bifurcated. That is, first, the prepare is handled by the relevant storage engines. Then second, the GTID slave state is updated as a separate autocommit transaction. If the second phase fails, and the transaction is retried, then the same transaction is attempted to be committed again, resulting in a GTID out-of-order error. This patch fixes this error by immediately stopping the slave and reporting the appropriate error. That is, there was logic to bypass the error when updating the GTID slave state table if the underlying error is allowed for retry on a parallel slave. This patch adds a parameter to disallow the error bypass, thereby forcing the error state to still happen. Reviewed By ============ Andrei Elkin <andrei.elkin@mariadb.com>
| * | Merge branch '10.4' into 10.5Oleksandr Byelkin2023-04-2412-27/+75
| |\ \ | | |/
| | * MDEV-31085 Crash when processing multi-update using view with optimizer_trace onIgor Babaev2023-04-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This bug caused server crash when processing a multi-update statement that used views if optimizer tracing was enabled. The bug was introduced in the patch for MDEV-30539 that could incorrectly detect the most top level selects of queries if views were used in them. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| | * Merge branch '10.3' into 10.4Oleksandr Byelkin2023-04-214-31/+85
| | |\
| | | * MDEV-30818 invalid ssl prevents bootstrapSergei Golubchik2023-03-091-1/+4
| | | | | | | | | | | | | | | | | | | | in bootstrap the server reads stdin and does not listen to network. it won't use ssl anyway
| | | * MDEV-30151 parse error 1=2 not between/inbb-10.3-bar-MDEV-30151Alexander Barkov2023-01-262-30/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the problem by adding a new rule booleat_test. This makes the grammar clearer and less conflicting. Additionally, fixing %prec in this grammar branch: - | boolean_test IS NULL_SYM %prec PREC_BELOW_NOT + | boolean_test IS NULL_SYM %prec IS to have consistently "%prec IS" in all grammar branches starting with "boolean_test IS ...". It's not clear why these three rules needed different %prec before the fix: - boolean_test IS TRUE - boolean_test IS UNKNOWN - boolean_test IS NULL
| | | * Revert "MDEV-30151 parse error 1=2 not between/in"Alexander Barkov2023-01-262-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit eba099184e1f6704894694ea41f97f216eae5f21. A different patch with less shift-reduce conflicts is coming.
| | | * MDEV-28616 Crash when using derived table over union with order by clausebb-10.3-igorIgor Babaev2023-01-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug manifested itself when the server processed a query containing a derived table over union whose ORDER BY clause included a subquery with unresolvable column reference. For such a query the server crashed when trying to resolve column references in the ORDER BY clause used by union. For any union with ORDER BY clause an extra SELECT_LEX structure is created and it is attached to SELECT_LEX_UNIT structure of the union via the field fake_select_lex. The outer context for fake_select_lex must be the same as for other selects of the union. If the union is used in the FROM list of a derived table then the outer context for fake_select_lex must be set to NULL in line with other selects of the union. It was not done and it caused a crash when searching for possible resolution of an unresolvable column reference occurred in a subquery used in the ORDER BY clause. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| | * | MDEV-30955 Explicit locks released too early in rollback pathDaniele Sciascia2023-04-183-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assertion `thd->mdl_context.is_lock_owner()` fires when a client is disconnected, while transaction and and a table is opened through `HANDLER` interface. Reason for the assertion is that when a connection closes, its ongoing transaction is eventually rolled back in `Wsrep_client_state::bf_rollback()`. This method also releases explicit which are expected to survive beyond the transaction lifetime. This patch also removes calls to `mysql_ull_cleanup()`. User level locks are not supported in combination with Galera, making these calls unnecessary.
| | * | MDEV-30862 Assertion `mode_ == m_high_priority' failedDaniele Sciascia2023-04-181-0/+13
| | | | | | | | | | | | | | | | | | | | CREATE TABLE AS SELECT is not supported in combination with streaming replication.
| | * | MDEV-20773 Error from UPDATE when estimating selectivity of a rangeIgor Babaev2023-04-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug could affect multi-update statements as well as single-table update statements processed as multi-updates when the where condition contained a range condition over a non-indexed varchar column. The optimizer calculates selectivity of such range conditions using histograms. For each range the buckets containing endpoints of the the range are determined with a procedure that stores the values of the endpoints in the space of the record buffer where values of the columns are usually stored. For a range over a varchar column the value of a endpoint may exceed the size of the buffer and in such case the value is stored with truncation. This truncations cannot affect the result of the calculation of the range selectivity as the calculation employes only the beginning of the value string. However it can trigger generation of an unexpected error on this truncation if an update statement is processed. This patch prohibits truncation messages when selectivity of a range condition is calculated for a non-indexed column. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| | * | MDEV-26175 : Assertion `! thd->in_sub_stmt' failed in bool ↵Jan Lindström2023-04-111-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | trans_rollback_stmt(THD*) If we are inside stored function or trigger we should not commit or rollback current statement transaction. Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
| | * | fix typolilinjie2023-04-102-2/+2
| | | | | | | | | | | | | | | | Signed-off-by: lilinjie <1136268146@qq.com>
* | | | Merge 10.5 into 10.6Marko Mäkelä2023-04-212-19/+41
|\ \ \ \ | |/ / /
| * | | MDEV-30804 Rollback multi-engine transaction requiring 2PC but committing in ↵Denis Protivensky2023-04-191-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | one phase Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
| * | | MDEV-30605: Wrong result while using index for group-bySergei Petrunia2023-04-181-18/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A GROUP BY query which uses "MIN(pk)" and has "pk<>const" in the WHERE clause would produce wrong result when handled with "Using index for group-by". Here "pk" column is the table's primary key. The problem was introduced by fix for MDEV-23634. It made the range optimizer to not produce ranges for conditions in form "pk != const". However, LooseScan code requires that the optimizer is able to convert the condition on the MIN/MAX column into an equivalent range. The range is used to locate the row that has the MIN/MAX value. LooseScan checks this in check_group_min_max_predicates(). This fix makes the code in that function to take into account that "pk != const" does not produce a range.
* | | | [MDEV-30854] Do not use " as string delimiter in mariadb-tzinfo-to-sqlDaniel Lenski2023-04-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If SQL_MODE contains ANSI_QUOTES (https://mariadb.com/kb/en/sql-mode/), then the double-quote character (") is not a legal string delimiter. In https://github.com/MariaDB/server/commit/13e77930e615f05cc74d408110e887b00e1abcc9#diff-a333d4ebb2d73b6361ef7dfebc86d883f7e19853b4a9eb85984b039058fae47cR2431-R2435, Daniel Black introduced a case where the double-quote character would be used as a string delimiter in the SQL queries generated by mariadb-tzinfo-to-sql. This tool tool generates SQL queries which should be able to run on any MariaDB server of the matching version. Therefore, it should be extremely conservative in the SQL that it outputs, in order to maximize the chance that it can run regardless of the build or execution environment of the server. See MDEV-18778, MDEV-28263, and MDEV-28782 for previous cases where MariaDB has FAILED TO ENSURE that the generated timezone.sql actually works in different build and execution environments. More test coverage is clearly needed here. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
* | | | Merge 10.5 into 10.6Marko Mäkelä2023-04-1146-446/+979
|\ \ \ \ | |/ / /
| * | | Merge remote-tracking branch 'origin/10.4' into 10.5Alexander Barkov2023-04-054-16/+19
| |\ \ \ | | |/ /
| | * | MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collationsAlexander Barkov2023-04-043-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Adding a new argument "flag" to MY_COLLATION_HANDLER::strnncollsp_nchars() and a flag MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES. The flag defines if strnncollsp_nchars() should emulate trailing spaces which were possibly trimmed earlier (e.g. in InnoDB CHAR compression). This is important for NOPAD collations. For example, with this input: - str1= 'a ' (Latin letter a followed by one space) - str2= 'a ' (Latin letter a followed by two spaces) - nchars= 3 if the flag is given, strnncollsp_nchars() will virtually restore one trailing space to str1 up to nchars (3) characters and compare two strings as equal: - str1= 'a ' (one extra trailing space emulated) - str2= 'a ' (as is) If the flag is not given, strnncollsp_nchars() does not add trailing virtual spaces, so in case of a NOPAD collation, str1 will be compared as less than str2 because it is shorter. - Field_string::cmp_prefix() now passes the new flag. Field_varstring::cmp_prefix() and Field_blob::cmp_prefix() do not pass the new flag. - The branch in cmp_whole_field() in storage/innobase/rem/rem0cmp.cc (which handles the CHAR data type) now also passed the new flag. - Fixing UCA collations to respect the new flag. Other collations are possibly also affected, however I had no success in making an SQL script demonstrating the problem. Other collations will be extended to respect this flags in a separate patch later. - Changing the meaning of the last parameter of Field::cmp_prefix() from "number of bytes" (internal length) to "number of characters" (user visible length). The code calling cmp_prefix() from handler.cc was wrong. After this change, the call in handler.cc became correct. The code calling cmp_prefix() from key_rec_cmp() in key.cc was adjusted according to this change. - Old strnncollsp_nchar() related tests in unittest/strings/strings-t.c now pass the new flag. A few new tests also were added, without the flag.
| * | | MDEV-28641 : Query cache entries not invalidated on slave of a Galera clusterJan Lindström2023-04-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Query cache should be invalidated if we are not in applier. For some reason this condition was incorrect starting from 10.5 but it is correct in 10.4. Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
| * | | Merge branch '10.4' into 10.5Oleksandr Byelkin2023-04-032-10/+10
| |\ \ \ | | |/ /
| | * | ensure that STRING_WITH_LEN is only used with string literalsSergei Golubchik2023-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is allowed: STRING_WITH_LEN("string literal") This is not: char *str = "pointer to string"; ... STRING_WITH_LEN(str) .. In C++ this is also allowed: const char str[] = "string literal"; ... STRING_WITH_LEN(str) ...
| | * | Fix passing correct length of string in command print.Oleksandr Byelkin2023-04-011-9/+9
| | | |
| * | | Merge remote-tracking branch '10.4' into 10.5Oleksandr Byelkin2023-03-3140-368/+894
| |\ \ \ | | |/ /
| | * | MDEV-25045 : Assertion `client_state_.mode() != wsrep::client_state::m_toi' ↵Jan Lindström2023-03-311-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | failed in int wsrep::transaction::before_commit() CREATE [TEMPORARY] SEQUENCE is internally CREATE+INSERT (initial value) and it is replicated using statement based replication. In Galera we use either TOI or RSU so we should skip commit time hooks for it. Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
| | * | MDEV-27317 wsrep_checkpoint order violation due to certification failureTeemu Ollakka2023-03-311-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With binlogs enabled, debug assertion ut_ad(xid_seqno > wsrep_seqno) fired in trx_rseg_update_wsrep_checkpoint() when an applier thread synced the seqno out of order for write set which had failed certification. This was caused by releasing commit order too early when binlogs were on, allowing group commit to run in parallel and commit following transactions too early. Fixed by extending the commit order critical section to cover call to wsrep_set_SE_checkpoint() also when binlogs are on. Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
| | * | MDEV-30351 crash in Item_func_left::val_strWeijun Huang2023-03-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using LEFT() function with a string that is without a charset, the function crashes. This is because the function assumes that the string has a charset, and tries to use it to calculate the length of the string. Two functions, UNHEX and WEIGHT_STRING, returned a string without the charset being set to a not null value. The fix is to set charset when calling val_str on these two functions. Reviewed-by: Alexander Barkov <bar@mariadb.com> Reviewed-by: Daniel Black <daniel@mariadb.org>
| | * | MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!?Alexander Barkov2023-03-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: UNIX_TIMESTAMP() called for a expression of the TIME data type returned NULL. Inside Type_handler_timestamp_common::Item_val_native_with_conversion the call for item->get_date() did not convert TIME to DATETIME automatically (because it does not have to, by design). As a result, Type_handler_timestamp_common::TIME_to_native() received a MYSQL_TIME value with zero date 0000-00-00 and therefore returned "true" (indicating SQL NULL value). Fix: Removing the call for item->get_date(). Instantiating Datetime(item) instead. This forces automatic TIME to DATETIME conversion (unless @@old_mode is zero_date_time_cast).
| | * | MDEV-30539 EXPLAIN EXTENDED: no message with queries for DML statementsIgor Babaev2023-03-2510-54/+341
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EXPLAIN EXTENDED for an UPDATE/DELETE/INSERT/REPLACE statement did not produce the warning containing the text representation of the query obtained after the optimization phase. Such warning was produced for SELECT statements, but not for DML statements. The patch fixes this defect of EXPLAIN EXTENDED for DML statements.
| | * | sql_class: sprintf -> snprintfDaniel Black2023-03-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This was failing to compile with AppleClang 14.0.0.14000029. Thanks to Arunesh Choudhary for noticing.
| | * | MDEV-30269: Remove rpl_semi_sync_[slave,master] usage in codeAnel Husakovic2023-03-232-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Description: - Before 10.3.8 semisync was a plugin that is built into the server with MDEV-13073,starting with commit cbc71485e24c31fc822277625512e55c2a8b650b. There are still some usage of `rpl_semi_sync_master` in mtr. Note: - To recognize the replica in the `dump_thread`, replica is creating local variable `rpl_semi_sync_slave` (the keyword of plugin) in function `request_transmit`, that is catched by primary in `is_semi_sync_slave()`. This is the user variable and as such not related to the obsolete plugin. - Found in `sys_vars.all_vars` and `rpl_semi_sync_wait_point` tests, usage of plugins `rpl_semi_sync_master`, `rpl_semi_sync_slave`. The former test is disabled by default (`sys_vars/disabled.def`) and marked as `obsolete`, however this patch will remove the queries. - Add cosmetic fixes to semisync codebase Reviewer: <brandon.nesterenko@mariadb.com> Closes PR #2528, PR #2380
| | * | MDEV-30780 optimistic parallel slave hangs after hit an errorAndrei2023-03-163-8/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hang could be seen as show slave status displaying an error like Last_Error: Could not execute Write_rows_v1 along with Slave_SQL_Running: Yes accompanied with one of the replication threads in show-processlist characteristically having status like 2394 | system user | | NULL | Slave_worker | 50852| closing tables It turns out that closing tables worker got entrapped in endless looping in mark_start_commit_inner() across already garbage-collected gco items. The reclaimed gco links are explained with actually possible out-of-order groups of events termination due to the Last_Error. This patch reinforces the correct ordering to perform finish_event_group's cleanup actions, incl unlinking gco:s from the active list.
| | * | MDEV-30826 Invalid data on mysql.host segfaults the server after an upgrade ↵Sergei Golubchik2023-03-101-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | to 10.4 convert empty host.db to "%", just as it's done for host.hostname (in update_hostname())
| | * | MDEV-30613 output_core_info crashes in my_read()Daniel Black2023-03-081-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and my_getwd(). The cause is my_errno define which depends on my_thread_var being a not null pointer otherwise it will be de-referenced and cause a SEGV already in the signal handler. Replace uses of these functions in the output_core_info using posix read/getcwd functions instead. The getwd fallback in my_getcwd isn't needed as its been obsolute for a very long time. Thanks Vladislav Vaintroub for diagnosis and posix recommendation.
| | * | MDEV-30706 Different results of selects from view and CTE with same definitionIgor Babaev2023-03-028-58/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-30668 Set function aggregated in outer select used in view definition This patch fixes two bugs concerning views whose specifications contain subqueries with set functions aggregated in outer selects. Due to the first bug those such views that have implicit grouping were considered as mergeable. This led to wrong result sets for selects from these views. Due to the second bug the aggregation select was determined incorrectly and this led to bogus error messages. The patch added several test cases for these two bugs and for four other duplicate bugs. The patch also enables view-protocol for many other test cases. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| | * | MDEV-26831 fallout: fix problems of name resolution cacheOleksandr Byelkin2023-03-021-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Avoid passing real field cache as a parameter when we check for duplicates. - Correct cache cleanup (cached field number also have to be reset). - Name resolution cache simple test added.
| | * | MDEV-30746 Regression in ucs2_general_mysql500_ciAlexander Barkov2023-03-013-48/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Adding a separate MY_COLLATION_HANDLER my_collation_ucs2_general_mysql500_ci_handler implementing a proper order for ucs2_general_mysql500_ci The problem happened because ucs2_general_mysql500_ci erroneously used my_collation_ucs2_general_ci_handler. 2. Cosmetic changes: Renaming: - plane00_mysql500 to my_unicase_mysql500_page00 - my_unicase_pages_mysql500 to my_unicase_mysql500_pages to use the same naming style with: - my_unicase_default_page00 - my_unicase_defaul_pages 3. Moving code fragments from - handler::check_collation_compatibility() in handler.cc - upgrade_collation() in table.cc into new methods in class Charset, to reuse the code easier.