- 19 Jul, 2023 1 commit
-
-
Rex authored
When constructing a SEL_TREE, an unsigned integer greater than its signed equivalent caused an incorrect comparison operator to be chosen.
-
- 18 Jul, 2023 1 commit
-
-
Alexander Barkov authored
MDEV-26186 280 Bytes lost in mysys/array.c, mysys/hash.c, sql/sp.cc, sql/sp.cc, sql/item_create.cc, sql/item_create.cc, sql/sql_yacc.yy:10748 when using oracle sql_mode There was a memory leak under these conditions: - YYABORT was called in the end-of-rule action of a rule containing expr_lex - This expr_lex was not bound to any sp_lex_keeper Bison did not call %destructor <expr_lex> in this case, because its stack already contained a reduced upper-level rule. Fixing rules starting with RETURN, CONTINUE, EXIT keywords: Turning end-of-rule actions with YYABORT into mid-rule actions by adding an empty trailing { } block. This prevents the upper level rule from being reduced without calling %destructor <expr_lex>. In other rules expr_lex is used not immediately before the last end-of-rule { } block, so they don't need changes.
-
- 17 Jul, 2023 1 commit
-
-
Alexander Barkov authored
MDEV-27207 Assertion `!m_null_value' failed in int FixedBinTypeBundle<FbtImpl>::cmp_item_fbt::compare or in cmp_item_inet6::compare Also fixing: MDEV-31719 Wrong result of: WHERE inet6_column IN ('','::1') Problem: When converting an Item value from string to INET6 it's possible that the Item value itself is a not-NULL string value, while the following result of the string-to-INET6 conversion returns NULL. Methods cmp_item_xxx::set(), cmp_item_xxx::store_value_by_template(), in_inet6::set() did not take this scenario into account and tested source_item->null_value, which does not indicate if the conversion failed. Changing the return data type of the mentioned methods from "void" to "bool". "true" means that: - either the source Item was NULL - or the source Item was not NULL, but the data type coversion to the destination data type (INET6 in this issue) returned NULL. "false" means that the Item was not NULL and the data type conversion to the destination data type worked without error. This patches fixes the INET6 data type. After merging to 10.9, this patch should also fix same problems in UUID.
-
- 14 Jul, 2023 1 commit
-
-
Alexander Barkov authored
- Moving the code from a public function trim_whitespaces() to the class Lex_cstring as methods. This code may be useful in other contexts, and also this code becomes visible inside sql_class.h - Adding a helper method THD::strmake_lex_cstring_trim_whitespaces() - Unifying the way how CREATE PROCEDURE/CREATE FUNCTION and CREATE PACKAGE/CREATE PACKAGE BODY work: a) Now CREATE PACKAGE/CREATE PACKAGE BODY also calls Lex->sphead->set_body_start() to remember the cpp body start inside an sp_head member. b) adding a "const char *cpp_body_end" parameter to sp_head::set_stmt_end(). These changes made it possible to reuse sp_head::set_stmt_end() inside LEX::create_package_finalize() and remove the duplucate code. - Renaming sp_head::m_body_begin to m_cpp_body_begin and adding a comment to make it clear that this member is used only during parsing, and points to a fragment inside the cpp buffer. - Changed sp_head::set_body_start() and sp_head::set_stmt_end() to skip the calls related to "body_utf8" in cases when m_parent is not NULL. A non-NULL m_parent means that we're inside a package routine. "body_utf8" in such case belongs not to the current sphead itself, but to parent (the package) sphead. So an sphead instance of a package routine should neither initialize, nor finalize, nor change in any other ways the "body_utf8" related members of Lex_input_stream, and should not take over or copy "body_utf8" data from Lex_input_stream to "this".
-
- 11 Jul, 2023 1 commit
-
-
Brandon Nesterenko authored
Where a read-only server permits writes through replication, it should not permit user connections to commit/rollback XA transactions prepared via replication. The bug reported in MDEV-30978 shows that this can happen. This is because there is no read only check in the XA transaction logic, the most relevant one occurs in ha_commit_trans() for normal statements/transactions. This patch extends the XA transaction logic to check the read only status of the server before performing an XA COMMIT or ROLLBACK. Reviewed By: Andrei Elkin <andrei.elkin@mariadb.com>
-
- 06 Jul, 2023 1 commit
-
-
Alexander Barkov authored
Removing the method LEX::delete_if_not_sp_lex_in_use(). It was not really used.
-
- 05 Jul, 2023 1 commit
-
-
Marko Mäkelä authored
fil_node_open_file_low(): Always acquire an advisory lock on the system tablespace. Originally, we already did this in SysTablespace::open_file(), but SysTablespace::open_or_create() would release those locks when it is closing the file handles. This is a 10.5+ specific follow up to commit 0ee1082b (MDEV-28495). Thanks to Daniel Black for verifying this bug.
-
- 03 Jul, 2023 1 commit
-
-
Daniel Black authored
file /usr/lib64/libmariadb.so.3 from install of MariaDB-shared-10.11.3-1.fc38.x86_64 conflicts with file from package mariadb-connector-c-3.3.5-1.fc38.x86_64
-
- 29 Jun, 2023 2 commits
-
-
Alexander Barkov authored
When CURSOR parameters get parsed, their sp_assignment_lex instances (one instance per parameter) get collected to List<sp_assignment_lex>. These instances get linked to sphead only in the end of the list. If a syntax error happened in the middle of the parameter list, these instances were not deleted, which caused memory leaks. Fix: using a Bison %destructor to free rules of the <sp_assignment_lex_list> type (on syntax errors). Afte the fix these sp_assignment_lex instances from CURSOR parameters deleted as follows: - If the CURSOR statement was fully parsed, then these instances get properly linked to sp_head structures, so they are deleted during ~sp_head (this did not change) - If the CURSOR statement failed on a syntax error, then by Bison's %destructor (this is being added in the current patch).
-
Alexander Barkov authored
The parser works as follows: The rule expr_lex returns a pointer to a newly created sp_expr_lex instance which is not linked to any MariaDB structures yet - it is pointed only from a Bison stack variable. The sp_expr_lex instance gets linked to other structures (such as sp_instr_jump_if_not) later, after scanning some following grammar. Problem before the fix: If a parse error happened immediately after expr_lex (before it got linked), the created sp_expr_lex value got lost causing a memory leak. Fix: - Using Bison's "destructor" directive to free the results of expr_lex on parse/oom errors. - Moving the call for LEX::cleanup_lex_after_parse_error() from MYSQL_YYABORT and yyerror inside parse_sql(). This is needed because Bison calls destructors after yyerror(), while it's important to delete the sp_expr_lex instance before LEX::cleanup_lex_after_parse_error(). The latter frees the memory root containing the sp_expr_lex instance. After this change the code block are executed in the following order: - yyerror() -- now only raises the error to DA (no cleanup done any more) - %destructor { delete $$; } <expr_lex> -- destructs the sp_expr_lex instance - LEX::cleanup_lex_after_parse_error() -- frees the memory root containing the sp_expr_lex instance - Removing the "delete sublex" related code from restore_lex(): - restore_lex() is called in most cases on success, when delete is not needed. - There is one place when restore_lex() is called on error: In sp_create_assignment_instr(). But in this case LEX::sp_lex_in_use is true anyway. The patch adds a new DBUG_ASSERT(lex->sp_lex_in_use) to guard this.
-
- 28 Jun, 2023 2 commits
-
-
Marko Mäkelä authored
-
Yuchen Pei authored
The server needs to have a unique name
-
- 27 Jun, 2023 1 commit
-
-
Marko Mäkelä authored
recv_sys_t::parse(): For undo tablespace truncation mini-transactions, remember the start_lsn instead of the end LSN. This is what we expect after commit 461402a5 (MDEV-30479).
-
- 20 Jun, 2023 1 commit
-
-
Sergei Petrunia authored
-
- 16 Jun, 2023 1 commit
-
-
Thirunarayanan Balathandayuthapani authored
- InnoDB shouldn't acquire the tablespace when it is being stopped or closed
-
- 15 Jun, 2023 1 commit
-
-
Sergei Petrunia authored
Fix a typo in make_join_statistics(): when updating statistics for derived table, set s->table->... not "table->..."
-
- 14 Jun, 2023 1 commit
-
-
Sergei Petrunia authored
(Same as TODO-3938: best_access_path shows negative costs for mrr=on) best_access_path() assumes that quick select cost includes (quick->rows/TIME_FOR_COMPARE) as a cost of checking the attached part of the WHERE condition. It calls adjust_quick_cost() to subtract addition from quick's cost. The problem was that DS-MRR cost formula didn't include this cost. For very large tables, adjust_quick_cost() would produce a negative cost which would cause assert in debug build or bad query plan choice in release builds. Approved-by: Monty <monty@mariadb.org>
-
- 09 Jun, 2023 1 commit
-
-
Thirunarayanan Balathandayuthapani authored
After further I/O on a tablespace has been stopped (for example due to DROP TABLE or an operation that rebuilds a table), page cleaner thread tries to flush the pending writes for the tablespace and releases the tablespace reference even though it was not acquired. fil_space_t::flush(): Don't release the tablespace when it is being stopped and closed Thanks to Marko Mäkelä for suggesting this patch.
-
- 08 Jun, 2023 5 commits
-
-
Sergei Petrunia authored
embedded doesn't have optimizer trace, view-protocol doesn't work with long column names.
-
Marko Mäkelä authored
The test gcol.gcol_purge would reliably hang on 10.6 on a Microsoft Windows builder without this adjustment. A similar adjustment was applied in commit 3e40f9a7 to the tests innodb.dml_purge and innodb.instant_alter_purge.
-
Marko Mäkelä authored
-
Marko Mäkelä authored
innodb_undo_log_truncate_update(): A callback function. If SET GLOBAL innodb_undo_log_truncate=ON, invoke srv_wake_purge_thread_if_not_active(). srv_wake_purge_thread_if_not_active(): If innodb_undo_log_truncate=ON, always wake up the purge subsystem. srv_do_purge(): If the history is empty, invoke trx_purge_truncate_history() in order to free undo log pages. trx_purge_truncate_history(): If head.trx_no==0, consider the cached undo logs to be free. trx_purge(): Remove the parameter "bool truncate" and let the caller invoke trx_purge_truncate_history() directly. Reviewed by: Vladislav Lesin
-
Marko Mäkelä authored
purge_sys_t::sees(): Wrapper for view.sees(). trx_purge_truncate_history(): Invoke purge_sys.sees() instead of comparing to head.trx_no, to determine if undo pages can be safely freed. The test innodb.cursor-restore-locking was adjusted by Vladislav Lesin, as was the the debug instrumentation in row_purge_del_mark(). Reviewed by: Vladislav Lesin
-
- 07 Jun, 2023 3 commits
-
-
Marko Mäkelä authored
-
Daniel Bartholomew authored
-
Sergei Petrunia authored
LooseScan code set opt_range_condition_rows to be the MIN(loose_scan_plan->records, table->records) totally ignoring possible quick range selects. If there was a quick select $QUICK on another index with $QUICK->records < loose_scan_plan->records this would create a situation where opt_range_condition_rows > $QUICK->records which causes an assert in 10.6+ and potentially wrong query plan choice in 10.5. Fixed by making opt_range_condition_rows to be the minimum #rows of any quick select. Approved-by: Monty <monty@mariadb.org>
-
- 05 Jun, 2023 2 commits
-
-
Sergei Golubchik authored
-
Sergei Petrunia authored
The code in choose_best_splitting() assumed that the join prefix is in join->positions[]. This is not necessarily the case. This function might be called when the join prefix is in join->best_positions[], too. Follow the approach from best_access_path(), which calls this function: pass the current join prefix as an argument, "const POSITION *join_positions" and use that.
-
- 03 Jun, 2023 8 commits
-
-
Marko Mäkelä authored
trx_purge_truncate_history(): Relax a condition that would prevent undo log truncation if the undo log tablespaces were "contaminated" by the bug that commit e0084b9d fixed. That is, trx_purge_truncate_rseg_history() would have invoked flst_remove() on TRX_RSEG_HISTORY but not reduced TRX_RSEG_HISTORY_SIZE. To avoid any regression with normal operation, we implement this fixup during slow shutdown only. The condition on the history list being empty is necessary: without it, in the test innodb.undo_truncate_recover there may be much fewer than the expected 90,000 calls to row_purge() before the truncation. That is, we would truncate the undo tablespace before actually having processed all undo log records in it. To truncate such "contaminated" or "bloated" undo log tablespaces (when using innodb_undo_tablespaces=2 or more) you can execute the following SQL: BEGIN;INSERT mysql.innodb_table_stats VALUES('','',DEFAULT,0,0,0);ROLLBACK; SET GLOBAL innodb_undo_log_truncate=ON, innodb_fast_shutdown=0; SHUTDOWN; The first line creates a dummy InnoDB transaction, to ensure that there will be some history to be purged during shutdown and that the undo tablespaces will be truncated.
-
Marko Mäkelä authored
trx_purge_truncate_rseg_history(): Add a parameter to specify if the entire rollback segment is safe to be freed. If not, we may still be able to invoke trx_undo_truncate_start() and free some pages.
-
Marko Mäkelä authored
trx_purge_truncate_history(): Only call trx_purge_truncate_rseg_history() if the rollback segment is safe to process. This will avoid leaking undo log pages that are not yet ready to be processed. This fixes a regression that was introduced in commit 0de3be8c (MDEV-30671). trx_sys_t::any_active_transactions(): Separately count XA PREPARE transactions. srv_purge_should_exit(): Terminate slow shutdown if the history size does not change and XA PREPARE transactions exist in the system. This will avoid a hang of the test innodb.recovery_shutdown. Tested by: Matthias Leich
-
Sergei Golubchik authored
This reverts commit b05218e0.
-
Sergei Golubchik authored
This reverts commit 844ddb11. This fixes MDEV-30967, MDEV-31325, MDEV-31388
-
Igor Babaev authored
This bug could affect queries containing a subquery over splittable derived tables and having an outer references in its WHERE clause. If such subquery contained an equality condition whose left part was a reference to a column of the derived table and the right part referred only to outer columns then the server crashed in the function st_join_table::choose_best_splitting() The crashing code was added in the commit ce7ffe61 that made the code of the function sensitive to presence of the flag OUTER_REF_TABLE_BIT in the KEYUSE_EXT::needed_in_prefix fields. The field needed_in_prefix of the KEYUSE_EXT structure should not contain table maps with OUTER_REF_TABLE_BIT or RAND_TABLE_BIT. Note that this fix is quite conservative: for affected queries it just returns the query plans that were used before the above mentioned commit. In fact the equalities causing crashes should be pushed into derived tables without any usage of split optimization. Approved by Sergei Petrunia <sergey@mariadb.com>
-
Igor Babaev authored
EXPLAIN EXTENDED should always print the field item used in the left part of an equality expression from the SET clause of an update statement as a reference to table column. Approved by Oleksandr Byelkin <sanja@mariadb.com>
-
Daniel Bartholomew authored
-
- 01 Jun, 2023 2 commits
-
-
Marko Mäkelä authored
recv_sys_t::apply(): When applying an undo log truncation operation, invoke os_file_truncate() on space->recv_size, which must not be less than the original truncated file size. Alternatively, as pointed out by Thirunarayanan Balathandayuthapani, we could assign space->size = t.pages, so that fil_system_t::extend_to_recv_size() would extend the file back to space->recv_size.
-
Marko Mäkelä authored
fil_space_t::add(): If a file handle was passed, invoke fil_node_t::find_metadata() before releasing fil_system.mutex. The call was moved from fil_ibd_create(). This is a 10.5 version of commit e3b06156 from 10.6.
-
- 24 May, 2023 2 commits
-
-
Marko Mäkelä authored
-
Marko Mäkelä authored
trx_purge_truncate_rseg_history(): Add a parameter to specify if the entire rollback segment is safe to be freed. If not, we may still be able to invoke trx_undo_truncate_start() and free some pages.
-