Commit graph

198601 commits

Author SHA1 Message Date
Yasuhiro-gh
26b96094ec MDEV-23865 Create malloc function attribute 2023-07-12 14:22:44 +10:00
Marko Mäkelä
cee9b3b850 Merge 11.0 into 11.1 2023-07-04 08:20:55 +03:00
Marko Mäkelä
a906046f1f Merge 10.11 into 11.0 2023-07-04 08:20:20 +03:00
Marko Mäkelä
3430767e00 Merge 10.10 into 10.11 2023-07-04 08:19:48 +03:00
Marko Mäkelä
c2d5523545 Merge 10.9 into 10.10 2023-07-04 08:18:30 +03:00
Nicholas Othieno
c054a62816 MDEV-31530 Localizations for Swahili language
Kenyan Swahili is enabled for error messages as well as datetime.

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.
2023-07-04 13:02:49 +10:00
Yuchen Pei
a9e13866e2
MDEV-31463 [fixup] Spider: error code in mdev_31463.test
The error code is non-deterministic, presumably due to some race
condition from the SLEEP statement above. The correct error should be
12701 ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM as it is the last failure.
Nevertheless, this contrived test is needed to cover the error
reporting when setting lock wait timeout, until we find a better test
case and/or fixing the non-deterministic error reporting (MDEV-31586)
2023-07-04 10:26:05 +10:00
Marko Mäkelä
35de8326fb MDEV-31311: The test innodb.log_file_size_online occasionally hangs
log_t::write_checkpoint(), log_t::resize_start(): Invoke buf_flush_ahead()
with buf_pool.get_oldest_modification(0)+1 so that another checkpoint will
be invoked, to complete the log resizing.

Tested by: Oleg Smirnov (on Microsoft Windows, where this hung most often)
2023-07-03 16:50:01 +03:00
Marko Mäkelä
26fc07b162 Merge 10.6 into 10.9 2023-07-03 16:49:55 +03:00
Marko Mäkelä
f7b8a2c953 MDEV-31607 ER_DUP_KEY in mysql.innodb_table_stats upon RENAME on sequence
ha_innobase::delete_table(): Also on DROP SEQUENCE, do try to drop any
persistent statistics. They should really not be created for
SEQUENCE objects (which internally are 1-row no-rollback tables),
but that is how happened to always work.
2023-07-03 16:47:58 +03:00
Marko Mäkelä
dc1bd1802a MDEV-31386 InnoDB: Failing assertion: page_type == i_s_page_type[page_type].type_value
i_s_innodb_buffer_page_get_info(): Correct a condition.
After crash recovery, there may be some buffer pool pages in FREED state,
containing garbage (invalid data page contents). Let us ignore such pages
in the INFORMATION_SCHEMA output.

The test innodb.innodb_defragment_fill_factor will be removed, because
the queries that it is invoking on information_schema.innodb_buffer_page
would start to fail. The defragmentation feature was removed in
commit 7ca89af6f8 in MariaDB Server 11.1.

Tested by: Matthias Leich
2023-07-03 14:39:29 +03:00
Trevor Gross
941f91edbc Fix encryption calls with overlapping buffers
Allocate a temporary buffer instead of using the same buffer in some
cases, and add assertions to verify the buffers do not overlap. See [1]
for reasonsing.

[1] https://github.com/MariaDB/server/pull/2438#discussion_r1137403645

Signed-off-by: Trevor Gross <tmgross@umich.edu>
2023-07-02 12:17:08 +02:00
Trevor Gross
17a32c3bbc MDEV-30389 Ensure correct dlen during encryption
This patch ensures that all direct and indirect calls to
encryption_crypt provide a `dlen` value correctly initialized to the
destination buffer length, allowing encryption plugins to verify
available space. It also adds assertions to verify related invariants.

Signed-off-by: Trevor Gross <tmgross@umich.edu>
2023-07-02 12:17:08 +02:00
Sergei Golubchik
279b0db8c6 MDEV-29827 collateral cleanup
* removed universal suppression of everything "Event Schedule" everywhere
* added suppressions in tests as needed
* moved events test to the events suite
* renamed -master.opt -> .opt
* added standard test header
* verified in the test that the error, indeed, was written into the log
* removed useless suppressions
* removed ER_EVENTS_NO_ACL, replaced with ER_OPTION_PREVENTS_STATEMENT
* fixed error message to say exactly what option disabled event scheduler
  instead of "this or that or that, you figure it out"
* also fixed old message for SET event_scheduler=
  (it was also non-translatable)
* changed to use sql_print_error() when an error is not sent to the user
* removed duplicate hard-coded error message
2023-07-02 12:15:11 +02:00
Marko Mäkelä
3d90143859 MDEV-31559 btr_search_hash_table_validate() does not check if CHECK TABLE is killed
btr_search_hash_table_validate(), btr_search_validate(): Add the
parameter THD for checking if the statement has been killed.
Any non-QUICK CHECK TABLE will validate the entire adaptive hash index
for all InnoDB tables, which may be extremely slow when running
multiple concurrent CHECK TABLE.
2023-06-30 17:07:21 +03:00
Marko Mäkelä
d04de1aa13 Merge 10.6 into 10.9 2023-06-30 13:42:52 +03:00
Oleg Smirnov
6d911219d6 MDEV-30639 Upgrade to 10.8 and later does not work on Windows
During the upgrade procedure on Windows mysqld.exe is started with
the named pipe connection protocol. mysqladmin.exe then pings the
server to check if is up and running. Command line looks like:
   mysqladmin.exe --protocol=pipe --socket=mysql_upgrade_service_xxx ping
But the "socket" parameter resets the "protocol" which was previously
initialized with the "pipe" value, setting it to "socket".
As a result, connection cannot be established and the upgrade
procedure fails.
"socket" in Windows is used to pass the name of the pipe so resetting
the protocol is not valid in this case.

This commit fixes resetting of the "protocol" parameter with "socket"
parameter in the case when protocol has been previously initialized
to "pipe" value
2023-06-30 15:59:14 +07:00
Oleg Smirnov
d6c6102cad MDEV-30828 Prevent pushing down unions with incorrect ORDER BY
Fake_select_lex->join was prepared at the unit execution stage so
the validation of fake_select_lex before the unit pushdown
was incomplete. That caused pushing down of statements having
an incorrect ORDER BY clause.
This commit moves preparation of the fake_select_lex->join to the unit
prepare() method, before initializing of the pushdown handler,
so incorrect clauses error out before being pushed down
2023-06-30 12:36:47 +07:00
Oleg Smirnov
8e2b20bfb0 MDEV-30639 Upgrade to 10.8 and later does not work on Windows
During the upgrade procedure on Windows mysqld.exe is started with
the named pipe connection protocol. mysqladmin.exe then pings the
server to check if is up and running. Command line looks like:
   mysqladmin.exe --protocol=pipe --socket=mysql_upgrade_service_xxx ping
But the "socket" parameter resets the "protocol" which was previously
initialized with the "pipe" value, setting it to "socket".
As a result, connection cannot be established and the upgrade
procedure fails.
"socket" in Windows is used to pass the name of the pipe so resetting
the protocol is not valid in this case.

This commit fixes resetting of the "protocol" parameter with "socket"
parameter in the case when protocol has been previously initialized
to "pipe" value
2023-06-29 19:16:45 +07:00
Sergei Petrunia
cd39f4ab6f MDEV-31573: rocksdb.group_min_max test fails
Set the histogram_type to be DOUBLE_PREC_HB as
it originally was.
2023-06-28 22:01:16 +03:00
Vlad Lesin
3e89b4fcc6 MDEV-31570 gap_lock_split.test hangs sporadically
The fix is in replacing the waiting for the whole purge finishing
with the the waiting for only delete-marked records purging finishing.

Reviewed by: Marko Mäkelä
2023-06-28 14:22:40 +03:00
Thirunarayanan Balathandayuthapani
73f78fb3b0 MDEV-31537 Bulk insert operation aborts the server for redundant table
- InnoDB bulk insert operation aborts the server for redundant
table. InnoDB miscalculates the record size in temporary file
for the redundant table. CHAR in redundant row format table
always fixed length, but in temporary file, it is variable-length
for variable-length character sets.
2023-06-28 15:26:22 +05:30
Vlad Lesin
687fd6bef5 MDEV-30648 btr_estimate_n_rows_in_range() accesses unfixed, unlatched page
The issue is caused by MDEV-30400 fix.

There are two cursors in btr_estimate_n_rows_in_range() - p1 and p2, but
both share the same mtr. Each cursor contains mtr savepoint for the
previously fetched block to release it then the current block is
fetched.

Before MDEV-30400 the block was released with
mtr_t::release_block_at_savepoint(), it just unfixed a block and
released its page patch. In MDEV-30400 it was replaced with
mtr_t::rollback_to_savepoint(), which does the same as the former
mtr_t::release_block_at_savepoint(ulint begin, ulint end) but also
erases the corresponding slots from mtr memo, what invalidates any
stored mtr's memo savepoints, greater or equal to "begin".

The idea of the fix is to get rid of savepoints at all in
btr_estimate_n_rows_in_range() and
btr_estimate_n_rows_in_range_on_level(). As
mtr_t::rollback_to_savepoint() erases elements from mtr_t::m_memo, we
know what element of mtr_t::m_memo can be deleted on the certain case,
so there is no need to store savepoints.

See also the following slides for details:
https://docs.google.com/presentation/d/1RFYBo7EUhM22ab3GOYctv3j_3yC0vHtBY9auObZec8U

Reviewed by: Marko Mäkelä
2023-06-28 11:00:02 +03:00
Marko Mäkelä
8290a46d50 Merge 11.0 into 11.1 2023-06-28 09:38:59 +03:00
Marko Mäkelä
1fe4bcbe05 Merge 10.11 into 11.0 2023-06-28 09:19:19 +03:00
Yuchen Pei
5ef27d271d
MDEV-31463 Spider should check connection before setting lock wait timeout
When setting the server lockwait timeout, spider should do some basic
checks first, like whether the remote server is still reachable. So
instead of directly calling spider_db_mbase::exec_query(), it should
call spider_db_query().

The reset of the lock wait timeout does not need to do such checks,
because they happen after the successfully setting the lock wait
timeout, implying the checks have been passed already.
2023-06-28 12:14:33 +10:00
Marko Mäkelä
71a1a28a49 Merge 10.10 into 10.11 2023-06-27 17:45:06 +03:00
Marko Mäkelä
135e976696 Merge 10.9 into 10.10 2023-06-27 17:43:31 +03:00
Marko Mäkelä
eb6b521f1b Merge 10.6 into 10.9 2023-06-27 13:48:46 +03:00
Marko Mäkelä
694ce0d08e Merge 10.5 into 10.6 2023-06-27 13:03:32 +03:00
Marko Mäkelä
84dbd0253d MDEV-31487: Recovery or backup failure after innodb_undo_log_truncate=ON
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 461402a564 (MDEV-30479).
2023-06-27 09:12:38 +03:00
Marko Mäkelä
493083833b Merge 10.5 into 10.6 2023-06-26 17:11:38 +03:00
Marko Mäkelä
aeeca7111b MDEV-22570 fixup: GCC 13 -Wpessimizing-move 2023-06-26 16:40:36 +03:00
Rucha Deodhar
14275b4715 MDEV-28915: mysql_upgrade fails due to old_mode="", with "Cannot load from
mysql.proc. The table is probably corrupted"

Analysis: When mysql_upgrade runs statements for upgrade, characterset is
converted to utf8mb4 because server starts with old_mode that interprets
utf8 to utf8mb4, but mysql.proc table has "utf8mb3" as hardcoded, so
it crashes with corrupted table.

Fix: Changed Table_check_intact::check() definition to allow both
utf8mb3 and utf8mb4 by checking prefix and changing the upgrade scripts
to explicitly use utf8mb3
2023-06-26 15:10:30 +05:30
Monty
6daccd4e48 Moved test from group_min_max.test to group_min_max_not_embedded.test 2023-06-25 16:26:28 +03:00
Monty
40b9b980da Removed wrongly placed test from group_min_max.test
This is mainly done to be able to push to 11.0
The test is moved in 10.6 to another file, which will add back the test.
2023-06-25 16:22:02 +03:00
Michael Widenius
3c7fd3c89b MDEV-23106 Unable to recognize/import partitioned tables from physical MySQL databases
MDEV-29253 Detect incompatible MySQL partition scheme and either convert
them or report to user and in error log.

This task is about converting in place MySQL 5.6 and 5.7 partition tables
to MariaDB as part of mariadb-upgrade.

- Update TABLE_SHARE::init_from_binary_frm_image() to be able to read
  MySQL frm files with partitions.
- Create .par file, if it do not exists, on open of partitioned table.

Executing mariadb-upgrade will create all the missing .par files.
The MySQL .frm file will be changed to MariaDB format after next
ALTER TABLE.

Other changes:
- If we are using stored mysql_version to distingush between MySQL and
  MariaDB  .frm file information, do not upgrade mysql_version in the
  .frm file as part of CHECK TABLE .. FOR UPGRADE as this would cause
  problems next time we parse the .frm file.
2023-06-25 16:15:08 +03:00
Monty
d671fec431 Fixed some errors & warnings when running mariadb-upgrade on MySQL instance
- Moved view checks after privilege tables are fixed. This is to avoid
  warnings about wrongly defined mysql.proc when checking views.
- Don't use stat tables before they have been fixed.
- Don't run mysql_fix_view() if 'FOR MYSQL' is used if the view is
  already a MariaDB view.
- Added 'FOR UPGRADE' as an option for 'REPAIR VIEW' to be able to
  detect if the REPAIR command comes from mariadb_upgrade. In this
  case we get a warning, instead of an error, if a definer of a view
  does not exists.
2023-06-25 16:15:08 +03:00
Vicentiu Ciorbaru
324d8a6036 Fix segfault in find_files if db is NULL and path does not exist or can't be read
In this case, one would end up calling my_error(ER_BAD_DB_ERROR, ...)
with a null ptr for DB, which caused a NULL ptr dereference.
2023-06-25 16:15:08 +03:00
Vicentiu Ciorbaru
38fe266ea9 Fix gcc warning for wsrep_plug 2023-06-25 16:15:08 +03:00
Vicentiu Ciorbaru
f20d556f19 Fix use of uninitialized variable
The original code generated a warning in gcc 13.1
2023-06-25 16:15:08 +03:00
Monty
ecd8a52252 Renamed 'mysql' -> 'mariadb' in mtr 2023-06-25 16:15:08 +03:00
Monty
ccc48b40e3 Fixed window warning 2023-06-25 15:38:20 +03:00
Brandon Nesterenko
c2d44ecb90 MDEV-29894: Calling a function from a different database in a slave side trigger crashes
When opening and locking tables, if triggers will be invoked in a
separate database, thd->set_db() is invoked, thus freeeing the memory
and headers which thd->db had previously pointed to. In row based
replication, the event execution logic initializes thd->db to point
to the database which the event targets, which is owned by the
corresponding table share (introduced in d9898c9 for MDEV-7409).
The problem then, is that during the table opening and locking
process for a row event, memory which belongs to the table share
would be freed, which is not valid.

This patch replaces the thd->reset_db() calls to thd->set_db(),
which copies-by-value, rather than by reference. Then when the
memory is freed, our copy of memory is freed, rather than memory
which belongs to a table share.

Notes:
  1. The call to change thd->db now happens on a higher-level, in
Rows_log_event::do_apply_event() rather than ::do_exec_row(), in the
call stack. This is because do_exec_row() is called within a loop,
and each invocation would redundantly set and unset the db to the
same value.
  2. thd->set_db() is only used if triggers are to be invoked, as
there is no vulnerability in the non-trigger case, and copying
memory would be an unnecessary inefficiency.

Reviewed By:
============
Andrei Elkin <andrei.elkin@mariadb.com>
2023-06-21 12:51:01 -06:00
Monty
3d617fdc7f MDEV-31375 Assertion `dbl_records <= s->records' failed with optimizer_use_condition_selectivity=1
The reason for the crash wad that 'best splitting' optimization
predicted less rows to be found than what opt_range did.
This code in apply_selectivity_for_table(), when using use_cond_selectivity=1,
was not prepared for this case which caused an assert in debug builds.
Production builds is not affected.

The fix is to choose the smaller of the two row counts. It will have a
minimum on costs when using use_cond_selectivity=1 and should not cause
any problems in production.
2023-06-21 15:44:25 +03:00
Monty
d3c81804ba MDEV-31494 Server crashes in ha_partition::index_blocks / get_key_scans_params
MDEV-31445 Server crashes in ha_partition::index_blocks / cost_for_index_read

The crash happened in the case where partition pruning finds 0
partitions.
2023-06-21 15:43:46 +03:00
Sergei Petrunia
0b61f4e0e4 Fix comment 2023-06-20 12:58:39 +03:00
Meng-Hsiu Chiang
774dee9abc Fix compiler warnings
-Wdeprecated-declarations:
  Replace deprecated xmlXPathInit() with xmlInitParser()[1]

-Wmaybe-uninitialized:
  `fil1` was initialized to 0 in commit 0138220 to fix compiler
  warnings, but `fil2` was missed.

ref:
[1]: https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathInit
2023-06-19 10:27:46 +01:00
Monty
f25a74c0b0 Fixed typo on opt_range.cc: SEL_ARG::number_of_eq_groups()
It could cause wrong range estimation for GROUP BY queries that are
using 'WHERE index_part >= constant'.
(The function was trying to check for 'index_part = constant')

Reporter: Yuty Chaikou
2023-06-18 12:11:18 +03:00
Thirunarayanan Balathandayuthapani
bd076d4dff MDEV-31442 page_cleaner thread aborts while releasing the tablespace
- InnoDB shouldn't acquire the tablespace when it is being stopped
or closed
2023-06-16 14:58:48 +05:30