Commit graph

198268 commits

Author SHA1 Message Date
Otto Kekäläinen
2972fbc771 Fix syntax error in man page headers
Add \FR on lines that start with \FB as it is likely useful, but not
stricly necessary. However if there is just \ the line won't render at
all as happened in example below from 'man mysql-test-test.pl.1':

  AUTHOR
         MariaDB Foundation (http://www.mariadb.org/).
                                                 MYSQL-TEST-RUN()
  ->
  AUTHOR
         MariaDB Foundation (http://www.mariadb.org/).
  MariaDB 10.11        15 May 2020              MYSQL-TEST-RUN(1)

Also use full command name instead of truncated ones.

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-24 13:37:55 +10:00
Otto Kekäläinen
e36b648077 MDEV-23789: Fix unnecessary acute accents in man pages
The man pages has several places where \' is intended to escape the single
quote and just print '. However, in reality this will print an ` (acute
accent). Fix this by removing excess backslashes. Also remove some excess
& in front of dots, such escaping is also unnecessary.

Also join several lines to avoid lone words in quotes to be read by groff
as macros when they are just text.

In a table (t{}) the content must be on new lines separately, so groff
will try to read them as macros too, so use \(aq that renders to '
(single quote).

This error was originally detected by Lintian:
https://lintian.debian.org/tags/acute-accent-in-manual-page

Example of man page sections before and after:

  Make a backup of each table´s data file using the name tbl_name.OLD.
  ->
  Make a backup of each table's data file using the name tbl_name.OLD.

  A typical debug_options string is ´d:t:o,file_name´.
  The default is ´d:t:o,/tmp/my_print_defaults.trace´.
  ->
  A typical debug_options string is 'd:t:o,file_name'.
  The default is 'd:t:o,/tmp/my_print_defaults.trace'.

  shell> mysql --xml -uroot -e "SHOW VARIABLES LIKE ´version%´"
  <?xml version="1.0"?>
  <resultset statement="SHOW VARIABLES LIKE ´version%´" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  ->
  shell> mysql --xml -uroot -e "SHOW VARIABLES LIKE 'version%'"
  <?xml version="1.0"?>
  <resultset statement="SHOW VARIABLES LIKE 'version%'" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

This command was used to validate no man pages have syntax errors:

  for x in *.?
  do
    echo "##### $x #####"
    LC_ALL=C.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings -E UTF-8 -l -Tutf8 -Z $x >/dev/null
  done

The man pages are not perfect after this, there are still a lot of
suboptimal syntax, but this helps towards better man pages.

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-24 13:37:55 +10: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
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
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
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ä
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
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
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
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
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
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
Sergei Petrunia
f7e9ac0d88 MDEV-31449: Assertion s->table->opt_range_condition_rows <= s->found_records
Fix a typo in make_join_statistics(): when updating statistics for
derived table, set s->table->... not "table->..."
2023-06-15 11:27:31 +03:00
Sergei Petrunia
0e2e70c4c1 MDEV-31479: Inconsistency between MRR and SQL layer costs can cause poor query plan
(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>
2023-06-14 13:56:33 +03:00
Monty
e1a631fecc Fixed wrong assignment in calculate_block_sizes() for MEM_ROOT
The effect was that that ROOT_FLAG_THREAD_SPECIFIC was cleared and
the memory allocated by memroot would be contributed the the system,
not to the thread.

This exposed a bug in how "show explain for ..." allocated data.
- The thread that did provide the explain allocated data in the
  "show explain" threads mem_root, which is marked as THREAD_SPECIFIC.
- Fixed by allocating the explain data in a temporary explain_mem_root
  which is not THREAD_SPECIFIC.

Other things:
- Added extra checks when using update_malloc_size()
- Do not call update_malloc_size() for memory not registered with
  update_malloc_size(). This avoid some wrong 'memory not freed' reports.
- Added a checking of 'thd->killed' to ensure that
  main.truncate_notembedded.test still works.

Reported by: Yury Chaikou
2023-06-14 00:39:14 +03:00
Monty
c4cf5e17ac Fixed main.mysqld-help and connect.drop-open-error tests 2023-06-14 00:39:14 +03:00
Monty
3eab2275d0 Added option sql_error_warnings to sql_error_log plugin 2023-06-12 14:57:21 +03:00
Monty
582d0cf5b0 Added not_as_root.inc to some test scripts that fails if run as root 2023-06-10 11:14:15 +03:00
Thirunarayanan Balathandayuthapani
841e905f20 MDEV-31442 page_cleaner thread aborts while releasing the tablespace
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.
2023-06-09 18:15:33 +05:30
Tuukka Pasanen
8171f9da87 MDEV-31423: Make sure that datadir is available with SySV-init script
Commit fixes Debian SySV-init script fail:
  /etc/init.d/mariadb: line 90: [: : integer expression expected
which happens if datadir is not changed in configuration which
makes it invisible when printing MariaDB config defaults.

Commit makes sure that there is some value if nothing else if in hand
use default /usr/lib/mysql or fail with correct error message if
directory is not present
2023-06-09 10:22:34 +10:00
Monty
c70f35f00b Disable flush_logs_not_windows.test of run as root (causes failure) 2023-06-08 17:15:16 +03:00
Monty
29ec07a5b1 Update BUILD scripts
- Remove -Wimplicit-fallthrough=2 for gcc versions < 6
- Don't do git submodule update one fresh git clones
  This fixes an issue when using git 1.0 that gives
  errors on empty submodule directories
2023-06-08 17:08:38 +03:00
Thirunarayanan Balathandayuthapani
bf0a54df34 MDEV-31416 ASAN errors in dict_v_col_t::detach upon adding key to virtual column
- InnoDB throws ASAN error while adding the index on virtual column
of system versioned table. InnoDB wrongly assumes that virtual
column collation type changes, creates new column with different
character set. This leads to failure while detaching the column
from indexes.
2023-06-08 16:34:45 +05:30
Marko Mäkelä
56bcb2b5c6 MariaDB 10.11.4 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEF39AEP5WyjM2MAMF8WVvJMdM0dgFAmSAdPoACgkQ8WVvJMdM
 0dhX6g//WFQ0jMtd5get3IFkaUggulfaz0z5HWifxBFxTQWDlebgq8t1TLNKP+iX
 9PXPN+QOyGKeDqo5UdOgsl/A0pm1pKq99J3m7tPgJ/creRkRrQgDTW+ZaTRXbZsn
 hC6Nz6XHwKCX0fuwme/k/sCqxTh1ePRnnHtkQBRShyRgnessnY2jB9wRDNPl3nPT
 Bd27Y2deuW3VRzDtSg7j244mGozXDlMFZN21g5nHLlRvqa3NBxKrhDDyZj+kQKBG
 urbYzf0UNjKncegqYplUw61MglMrKOsBKXCoyu/YMrpBxaNpnoZVfQ3q4hmW/KjG
 Z+9cVyzrsB/WkF+FyO6i6rZ9imWBn/EJ/p8fvpBseTPsorEQ5yKh/4SMpgp3OOUM
 K6IFae8tuSHg/8brE1Ywt/Ib8WbZ0pwr9vdFRohoBlRTs84XGdYHyzxVTRXHXmKR
 ED3JMMmLyOlKcYCQIBg52IVAUq2BwsHfZjUu2sUQ8DVCFOy0gS+OeK93XKq0nLyl
 qz54bfokuLCDw1EIS5n9lXJT6yD5cSZXOBiv4l5aUj7KirrTIKHoNd3OXPzuIBE9
 C+2MJu3+Cw1eLElAR1C+zebqzQvh6Ii1nUd3Mgi9P5mKUy57WCtynP9II5Ft/0Yd
 Nb1BTNqDsqPSiwt/q+CimbhXi6N51SLuJBDYe5PMAAzY83nj578=
 =FXKK
 -----END PGP SIGNATURE-----

Merge mariadb-10.11.4 into 10.11
2023-06-08 11:23:45 +03:00
Marko Mäkelä
5d7b957eb0 Merge 10.10 into 10.11 2023-06-08 11:23:08 +03:00
Marko Mäkelä
47c9a61d96 MariaDB 10.10.5 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEF39AEP5WyjM2MAMF8WVvJMdM0dgFAmSAdK8ACgkQ8WVvJMdM
 0djVHA/+OFBiJlc0XIPSJAzxvsjVeh9ufjRCEaugj3SQv9oAI5C/teegVRjxl+6E
 BZWZUpGHzr+p5w50M9P3oThqMriawyJne48cAcuNa6rWG7OAOqCLD0VAc/QL6lF5
 diRutRv8DoRC3iHTIKQlFOR18pQDbcczgBtgznI/bmtf5SIFKd1mrq0z+iA5wQ++
 0/VPqcIixumGCFsjaBxzafOz4wD4oYed3HCuVs143ZHqP99HGmsZxVbT7ASd5r2K
 9OPsov/G3kVtJSXoxJcnNflZNFNkH5Ek2z5fEZAR/HFYvypNksT6GY2Y9GbwPoGe
 TqXTUXy3VwZ4+7498y50P0Y3UikOQWDUSCHyrU96e5JN1/fRDPvpz7C52EXFVUfC
 eCNhnIeTL1qVIK6cn1JQO++Odn8Suyt92gq1T8K8yRjaWWoZa/ElY2PxgjpqIbqo
 A01EDUrPu4O79XLfXjOWp6TaM/pYSk4mHtPhso+GNKsM2rMPuYtb5RbdA1dYwFAM
 aP5bOALzQUygNN6a0G+wQoclQRKbDHFaCzByh1L3cIJ6+5Pvk4mP+xPtbgt06jhG
 9tmA8hwWdqP5AI5xf27wYrn0AS2i7NsunVjKC12851JLsn1Y0dm6KQ/dhTys+Bxc
 VCbw3Y3Yanqhbyx6XfoyfcQ5Ctnwvz4dNYTI2YeVG6FDYCYrwWk=
 =MKqT
 -----END PGP SIGNATURE-----

Merge mariadb-10.10.5 into 10.10
2023-06-08 11:22:20 +03:00
Marko Mäkelä
e704a13b32 Merge 10.9 into 10.10 2023-06-08 11:22:12 +03:00
Sergei Petrunia
b3074128a6 MDEV-31380 post-fix: fix group_min_max.test with embedded and view-protocol
embedded doesn't have optimizer trace,
view-protocol doesn't work with long column names.
2023-06-08 11:14:50 +03:00