Commit graph

196657 commits

Author SHA1 Message Date
Marko Mäkelä
89eb6fa8a7 MDEV-31308 InnoDB monitor trx_rseg_history_len was accidentally disabled by default
innodb_counter_info[]: Revert a change that was accidentally made in
commit 204e7225dc
2023-06-03 11:12:21 +02:00
Marko Mäkelä
883333a74e MDEV-31158: Potential hang with ROW_FORMAT=COMPRESSED tables
btr_cur_need_opposite_intention(): Check also page_zip_available()
so that we will escalate to exclusive index latch when a non-leaf
page may have to be split further due to ROW_FORMAT=COMPRESSED page
overflow.

Tested by: Matthias Leich
2023-06-03 11:12:16 +02:00
Marko Mäkelä
459eb9a686 MDEV-29593 fixup: Avoid a leak if rseg.undo_cached is corrupted
trx_purge_truncate_rseg_history(): Avoid a leak similar to the one
that was fixed in MDEV-31324, in case a supposedly cached undo log
page is not found in the rseg.undo_cached list.
2023-06-03 11:12:11 +02:00
Marko Mäkelä
e89bd39c9b MDEV-31343 Another server hang with innodb_undo_log_truncate=ON
trx_purge_truncate_history(): While waiting for a write-fixed block
to become available, simply wait for an exclusive latch on it.
Also, simplify the iteration: first check for oldest_modification>2
(to ignore clean pages or pages belonging to the temporary tablespace)
and then compare the tablespace identifier.

Before releasing buf_pool.flush_list_mutex we will buffer-fix the block
of interest. In that way, buf_page_t::can_relocate() will not hold on
the block and it must remain in the buffer pool until we have acquired
an exclusive latch on it. If the block is still dirty, we will register
it with the tablespace truncation mini-transaction; else, we will simply
release the latch and buffer-fix and move to the next block.

This also reverts commit c4d7939989
because that fix should no longer be necessary; the wait for an
exclusive block latch should allow buf_pool_t::release_freed_page()
on the same block to proceed.

Tested by: Axel Schwenke, Matthias Leich
2023-06-03 11:12:03 +02:00
Sergei Petrunia
a24f2bb50b MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on
Derived table creation code would call Field::make_new_field() which would
memcpy the Field object from the source table, including Field::read_stats.

But the temp. table as a whole had table->stats_is_read=false. Which was
correct but not consistent with Field::read_stats and caused an assertion.

Fixed by making sure that Field::read_stats=NULL for fields in the new
temporary (i.e. work) tables.
2023-05-05 13:55:42 +03:00
Oleksandr Byelkin
1c39479598 Merge branch '10.5' into 10.6 2023-05-05 11:09:46 +02:00
Oleksandr Byelkin
b735ca4773 Merge branch '10.4' into 10.5 2023-05-05 10:50:02 +02:00
Sergei Petrunia
2594da7a33 MDEV-31194: Server crash or assertion failure with join_cache_level=4
The problem, introduced in patch for MDEV-26301:

When check_join_cache_usage() decides not to use join buffer, it must
adjust the access method accordingly. For BNL-H joins this means switching
from pseudo-"ref access"(with index=MAX_KEY) to some other access method.

Failing to do this will cause assertions down the line when code that is
not aware of BNL-H will try to initialize index use for ref access with
index=MAX_KEY.

The fix is to follow the regular code path to disable the join buffer for
the join_tab ("goto no_join_cache") instead of just returning from
check_join_cache_usage().
2023-05-05 11:16:23 +03:00
Oleksandr Byelkin
db3342b325 Merge branch '10.5' into 10.6 2023-05-04 18:47:11 +02:00
Oleksandr Byelkin
ba0433dc1c Merge branch '10.4' into 10.5 2023-05-04 18:19:47 +02:00
Oleksandr Byelkin
7973ffde0f MDEV-31189 Server crash or assertion failure in upon 2nd execution of PS with views and HAVING
Do not try to decide merge/materialize for derived if it was already decided
(even if it is a view).
2023-05-04 17:51:27 +02:00
Sergei Golubchik
cf4a16b555 MDEV-31057 rocksdb does not compile with gcc-13
RocksDB (in a submodule) has to include <cstdint> to use uint64_t
but it doesn't. Until the submodule is upgraded, let's replace
problematic types with something that's available
2023-05-04 16:07:44 +02:00
Sergei Golubchik
4d6e458f9f MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases
select_insert::store_values() must reset
has_value_set bitmap before every row, just like mysql_insert() does.
because ON DUPLICATE KEY UPDATE and triggers modify it
2023-05-04 16:07:39 +02:00
Oleksandr Byelkin
5dc0f3dafa Merge branch '10.5' into 10.6 2023-05-04 11:26:45 +02:00
Oleksandr Byelkin
749c512911 Merge branch '10.4' into 10.5 2023-05-04 11:23:37 +02:00
Oleksandr Byelkin
f5e7c56e32 MDEV-31181 Server crash in subselect_uniquesubquery_engine::print upon EXPLAIN EXTENDED DELETE
Temporary fix to avoid the server crash.
2023-05-04 11:20:35 +02:00
Oleksandr Byelkin
62ec258f10 Fix of selectivity test to behave correctly with embedded and view protocols. 2023-05-04 11:20:35 +02:00
Oleksandr Byelkin
652d54bf00 Merge branch '10.5' into 10.6 2023-05-04 07:36:37 +02:00
Oleksandr Byelkin
e87440b79e Merge branch '10.4' into 10.5 2023-05-03 15:53:14 +02:00
Sergei Petrunia
ed3e6f66a2 MDEV-26301: Split optimization refills: Optimizer Trace coverage
Add Optimizer Trace printouts.
2023-05-03 14:11:25 +02:00
Igor Babaev
ce7ffe61d8 MDEV-26301 Split optimization refills temporary table too many times
This patch optimizes the number of refills for the lateral derived table
to which a materialized derived table subject to split optimization is
is converted. This optimized number of refills is now considered as the
expected number of refills of the materialized derived table when searching
for the best possible splitting of the table.
2023-05-03 14:11:11 +02:00
Oleksandr Byelkin
043d69bbcc Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
Oleksandr Byelkin
69932b6e68 Merge branch '10.4' into 10.5 2023-05-03 09:46:49 +02:00
Andrei
ec79f37718 MDEV-29621 part 2 of post-merge fixes in galera
(part 1 is in the previous commit)
to [ pass ] galera.MDEV-18832, galera.MDEV-27862
2023-05-03 10:32:29 +03:00
Oleksandr Byelkin
430b972702 Protect a new condition (by Andrei) 2023-05-03 07:45:15 +02:00
Oleksandr Byelkin
8c793eaaf4 Fix test after merge (by Thiru) 2023-05-03 07:30:12 +02:00
Oleksandr Byelkin
46ebddba61 Merge branch '10.4' into 10.5 2023-05-02 20:16:14 +02:00
Oleksandr Byelkin
5597562aa6 Merge branch '10.3' into 10.4 2023-05-02 20:14:47 +02:00
Oleksandr Byelkin
ca001cf204 New CC 3.1 2023-05-02 20:13:48 +02:00
Oleksandr Byelkin
10e135b679 Merge branch 'bb-10.4-release' into bb-10.5-release 2023-05-02 15:47:10 +02:00
Oleksandr Byelkin
1d15300b30 Merge branch '10.4' into bb-10.4-release 2023-05-02 15:45:35 +02:00
Andrei
495f1ecac2 MDEV-29621 manual merge from 10.4 -> 10.5
1. log_event.cc stuff should go into log_event_server.cc
2. the test's wait condition is textually different in 10.5, fixed.
3. pre-exec 'optimistic' global var value is correct for 10.5 indeed.
2023-05-02 15:52:36 +03:00
Oleksandr Byelkin
edf8ce5b97 Merge branch 'bb-10.4-release' into bb-10.5-release 2023-05-02 13:54:54 +02:00
Julius Goryavsky
c6ef9b1c1a wsrep-lib external submodule update 2023-05-02 11:20:35 +02:00
Oleksandr Byelkin
edd0b03e60 Merge branch '10.3' into 10.4 2023-05-02 10:09:27 +02:00
Igor Babaev
fe89df4268 MDEV-31162 Crash for query using ROWNUM over multi-table view with ORDER BY
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>
2023-05-02 01:05:18 -07:00
Tuukka Pasanen
5f3a4beb9d MDEV-31045: Update debian/rules to be in sync to MariaDB LTS 10.6
To make sure that PMEM problem does not happen again sync
10.9 and up debian/rules to make sure that they are not making
anymore problems with autobake-debs.sh
2023-05-02 16:37:01 +10:00
Daniele Sciascia
ef227762b1 MDEV-30838 Assertion `m_thd == _current_thd()'
- Update wsrep-lib which contains fix for the assertion
- Fix error handling for appending fragment to streaming log,
  make sure tables are closed after rollback.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-05-02 03:42:39 +02:00
sara
4e942bcd93 MDEV-30414 sporadic failures with galera var retry autocommit
changed tast case 2 to be deterministic

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-05-02 03:42:17 +02:00
Igor Babaev
7e2e968997 MDEV-31143 Crash for query using ROWNUM() over view with ORDER BY
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>
2023-04-30 11:53:21 -07:00
Alexander Barkov
ddcc9d2281 MDEV-31153 New methods Schema::make_item_func_* for REPLACE, SUBSTRING, TRIM
Adding virtual methods to class Schema:

  make_item_func_replace()
  make_item_func_substr()
  make_item_func_trim()

This is a non-functional preparatory change for MDEV-27744.
2023-04-29 08:06:46 +04:00
Alexander Barkov
2e74f9d281 Adding "const" qualifiers to a few trivial Lex_input_string methods 2023-04-29 06:33:09 +04:00
Angelique
1963a87b2e MDEV-30221: Move environmental macros to before master-slave
The fix was introduced, along with re-ordering to do other macros that check test environment capabilities before master/slave is set up.
2023-04-28 20:06:02 +00:00
Sergei Petrunia
85cc831880 MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram
Variant #2.

When Histogram::point_selectivity() sees that the point value of interest
falls into one bucket, it tries to guess whether the bucket has many
different (unpopular) values or a few popular values. (The number of
rows is fixed, as it's a Height-balanced histogram).
The basis for this guess is the "width" of the value range the bucket
covers. Buckets covering wider value ranges are assumed to contain
values with proportionally lower frequencies.

This is just a [brave] guesswork. For a very narrow bucket, it may
produce an estimate that's larger than total #rows in the bucket
or even in the whole table.

Remove the guesswork and replace it with basic logic: return
either the per-table average selectivity of col=const, or selectivity
of one bucket, whichever is lower.
2023-04-28 22:39:25 +03:00
Sergei Petrunia
4329ec5d3b MDEV-30812: Improve output cardinality estimates for hash join
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>
2023-04-28 16:24:08 +03:00
Sergei Golubchik
bc970573b3 MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
exclude generated columns from the "has default value" check
2023-04-28 14:11:59 +02:00
Oleksandr Byelkin
d821fd7fab Merge branch 'merge-perfschema-5.7' into 10.5 2023-04-28 08:22:17 +02:00
Oleksandr Byelkin
512dbc4527 5.7.42 (only copyright year in all files changed) 2023-04-28 08:09:26 +02:00
Oleg Smirnov
adbad5e36f MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key with DISTINCT and group function
Fix-up for commit 476b24d084
  Author: Monty
  Date:   Thu Feb 16 14:19:33 2023 +0200
    MDEV-20057 Distinct SUM on CROSS JOIN and grouped returns wrong result
which misses initializing of sorder->suffix_length.
In this commit the initialization is implemented by passing
MY_ZEROFILL flag to the allocation of SORT_FIELD elements
2023-04-28 09:35:27 +07:00
Oleksandr Byelkin
2eb7bf1ec3 MDEV-31073 Server crash, assertion `table != 0 && view->field_translation != 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.
2023-04-27 21:19:10 +02:00