- 21 Jul, 2023 1 commit
-
-
Oleksandr Byelkin authored
-
- 20 Jul, 2023 1 commit
-
-
Oleksandr Byelkin authored
-
- 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 2 commits
-
-
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.
-
Rucha Deodhar authored
MDEV-23187 misses resetting collation connection causing test failures for 10.5+ bugs.
-
- 04 Jul, 2023 2 commits
-
-
Kristian Nielsen authored
Fix that rpl_slave_state::load() was calling rpl_slave_state::update() without holding LOCK_slave_state. Reviewed-by: Monty <monty@mariadb.org> Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
-
Yuchen Pei authored
This fixes mdev_26541.test, and the new clean_up_spider.inc will be useful for other tests where part of deinit_spider does not apply, e.g. those testing spider initialisation only.
-
- 03 Jul, 2023 8 commits
-
-
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
-
Vicentiu Ciorbaru authored
The original code generated a warning in gcc 13.1
-
Sergei Golubchik authored
-
Sergei Golubchik authored
make it "query reached <some limit> result may be incomplete"
-
Sergei Golubchik authored
also make sure all unused error messages are "You should never see it" and have no translations
-
Marko Mäkelä authored
btr_node_ptr_max_size(): Handle BINARY(0) and VARBINARY(0) as special cases, similar to CHAR(0) and VARCHAR(0).
-
Marko Mäkelä authored
-
Anel Husakovic authored
Reviewer: <daniel@mariadb.org>
-
- 29 Jun, 2023 5 commits
-
-
Sergei Golubchik authored
workaround cmake bug #25044 https://gitlab.kitware.com/cmake/cmake/-/issues/25044
-
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.
-
Alexander Barkov authored
'long long int'; cast to an unsigned type to negate this value .. to itself in Item_func_mul::int_op and Item_func_round::int_op Problems: The code in multiple places in the following methods: - Item_func_mul::int_op() - longlong Item_func_int_div::val_int() - Item_func_mod::int_op() - Item_func_round::int_op() did not properly check for corner values LONGLONG_MIN and (LONGLONG_MAX+1) before doing negation. This cuased UBSAN to complain about undefined behaviour. Fix summary: - Adding helper classes ULonglong, ULonglong_null, ULonglong_hybrid (in addition to their signed couterparts in sql/sql_type_int.h). - Moving the code performing multiplication of ulonglong numbers from Item_func_mul::int_op() to ULonglong_hybrid::ullmul(). - Moving the code responsible for extracting absolute values from negative numbers to Longlong::abs(). It makes sure to perform negation without undefinite behavior: LONGLONG_MIN is handled in a special way. - Moving negation related code to ULonglong::operator-(). It makes sure to perform negation without undefinite behavior: (LONGLONG_MAX + 1) is handled in a special way. - Moving signed<=>unsigned conversion code to Longlong_hybrid::val_int() and ULonglong_hybrid::val_int(). - Reusing old and new sql_type_int.h classes in multiple places in Item_func_xxx::int_op(). Fix details (explain how sql_type_int.h classes are reused): - Instead of straight negation of negative "longlong" arguments *before* performing unsigned multiplication, Item_func_mul::int_op() now calls ULonglong_null::ullmul() using Longlong_hybrid_null::abs() to pass arguments. This fixes undefined behavior N1. - Instead of straight negation of "ulonglong" result *after* performing unsigned multiplication, Item_func_mul::int_op() now calls ULonglong_hybrid::val_int(), which recursively calls ULonglong::operator-(). This fixes undefined behavior N2. - Removing duplicate negating code from Item_func_mod::int_op(). Using ULonglong_hybrid::val_int() instead. This fixes undefinite behavior N3. - Removing literal "longlong" negation from Item_func_round::int_op(). Using Longlong::abs() instead, which correctly handler LONGLONG_MIN. This fixes undefinite behavior N4. - Removing the duplicate (negation related) code from Item_func_int_div::val_int(). Reusing class ULonglong_hybrid. There were no undefinite behavior in here. However, this change allowed to reveal a bug in "-9223372036854775808 DIV 1". The removed negation code appeared to be incorrect when negating +9223372036854775808. It returned the "out of range" error. ULonglong_hybrid::operator-() now handles all values correctly and returns +9223372036854775808 as a negation for -9223372036854775808. Re-recording wrong results for SELECT -9223372036854775808 DIV 1; Now instead of "out of range", it returns -9223372036854775808, which is the smallest possible value for the expression data type (signed) BIGINT. - Removing "no UBSAN" branch from Item_func_splus::int_opt() and Item_func_minus::int_opt(), as it made UBSAN happy but in RelWithDebInfo some MTR tests started to fail.
-
Yuchen Pei authored
-
- 28 Jun, 2023 3 commits
-
-
Marko Mäkelä authored
-
Yuchen Pei authored
Will re-enable once MDEV-31101 is no longer blocked by MDEV-22979, as the patch for the latter might fix the former.
-
Yuchen Pei authored
The server needs to have a unique name
-
- 27 Jun, 2023 4 commits
-
-
Sergei Golubchik authored
-
Thirunarayanan Balathandayuthapani authored
- When foreign_key_check is disabled, allowing to modify the column which is part of foreign key constraint can lead to refusal of TRUNCATE TABLE, OPTIMIZE TABLE later. So it make sense to block the column modify operation when foreign key is involved irrespective of foreign_key_check variable. Correct way to modify the charset of the column when fk is involved: SET foreign_key_checks=OFF; ALTER TABLE child DROP FOREIGN KEY fk, MODIFY m VARCHAR(200) CHARSET utf8mb4; ALTER TABLE parent MODIFY m VARCHAR(200) CHARSET utf8mb4; ALTER TABLE child ADD CONSTRAINT FOREIGN KEY (m) REFERENCES PARENT(m); SET foreign_key_checks=ON; fk_check_column_changes(): Remove the FOREIGN_KEY_CHECKS while checking the column change for foreign key constraint. This is the partial revert of commit 5f1f2fc0 and it changes the behaviour of copy alter algorithm ha_innobase::prepare_inplace_alter_table(): Find the modified column and check whether it is part of existing and newly added foreign key constraint.
-
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).
-
Yuchen Pei authored
spider_db_mbase_util::open_item_func() is a monster function. It is difficult to maintain while it is expected that we need to modify it when a new SQL function or a new func_type is added. We split the function into two distinct functions: one handles the case of str != NULL and the other handles the case of str == NULL. This refactoring was done in a conservative way because we do not have comprehensive tests on the function. It also fixes MDEV-29447 and MDEV-31338 where field items that are arguments of a func item may be used before created / initialised. Note this commit is adapted from a patch by Nayuta for MDEV-26285.
-
- 26 Jun, 2023 1 commit
-
-
Marko Mäkelä authored
-
- 22 Jun, 2023 2 commits
-
-
Sergei Golubchik authored
also, add static
-
Sergei Golubchik authored
This reverts commit a1b6691f. because #ifdef checks the symbol defined in ssl_compat.h, so #include <ssl_compat.h> cannot be inside #ifdef
-
- 20 Jun, 2023 1 commit
-
-
Sergei Petrunia authored
-
- 19 Jun, 2023 1 commit
-
-
Sergei Golubchik 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>
-