Commit graph

196226 commits

Author SHA1 Message Date
mariadb-DebarunBanerjee
b2944adb76 MDEV-34166 Server could hang with BP < 80M under stress
BUF_LRU_MIN_LEN (256) is too high value for low buffer pool(BP) size.
For example, for BP size lower than 80M and 16 K page size, the limit is
more than 5% of total BP and for lowest BP 5M, it is 80% of the BP.
Non-data objects like explicit locks could occupy part of the BP pool
reducing the pages available for LRU. If LRU reaches minimum limit and
if no free pages are available, server would hang with page cleaner not
able to free any more pages.

Fix: To avoid such hang, we adjust the LRU limit lower than the limit
for data objects as checked in buf_LRU_check_size_of_non_data_objects()
i.e. one page less than 5% of BP.
2024-05-21 14:13:29 +05:30
Marko Mäkelä
0907df3d89 MDEV-34204 Assertion `!*detailed_error' failed on shutdown after XA PREPARE
trx_free_at_shutdown(): Similar to trx_t::commit_in_memory(),
clear the detailed_error (FOREIGN KEY constraint error) before
invoking trx_t::free(). We only do this on debug instrumented
builds in order to avoid a debug assertion failure on shutdown.
2024-05-21 09:52:35 +03:00
Yuchen Pei
698dae54ef
MDEV-31475 Spider: only reset wide_handler when owning it
A wide_handler is shared among ha_spider of partitions of the same
spider table, where the last partition is designated the owner of the
wide_handler, and is responsible for its deallocation. Therefore in
case of failure, we only reset wide_handler in error handling if the
current ha_spider is the owner of the wide_handler, otherwise it will
result in segv in the destructor of ha_spider, or during
ha_spider::close().
2024-05-21 09:17:12 +10:00
Yuchen Pei
86adee3806
MDEV-31475 remove unnecessary assignment to spider share init_error
The init, init_error, and init_error_time fields of a SPIDER_SHARE
should only be assigned when actually doing the initialisation of a
SPIDER_SHARE, otherwise they could result in spurious failures from
spider_get_share() in a subsequent statement.
2024-05-21 09:17:12 +10:00
Thirunarayanan Balathandayuthapani
ac2e02e961 MDEV-34175 mtr_t::log_close() warning should change the shutdown condition
- InnoDB should print the warning message saying
"Shutdown is in progress" only when shutdown state
is greater than SRV_SHUTDOWN_INITIATED.
2024-05-20 18:18:41 +05:30
Alexander Barkov
28073a979f MDEV-34187 On startup: UBSAN: runtime error: applying zero offset to null pointer in skip_trailing_space and my_hash_sort_utf8mb3_general1400_nopad_as_ci
The last element in func_array_oracle_overrides[] equal to {0,0}
was erroneously passed to Native_functions_hash::replace().
Removing this element.
2024-05-20 13:29:59 +04:00
Robin Newhouse
dc38d8ea80 Minimize unsafe C functions with safe_strcpy()
Similar to #2480.
567b681 introduced safe_strcpy() to minimize the use of C with
potentially unsafe memory overflow with strcpy() whose use is
discouraged.
Replace instances of strcpy() with safe_strcpy() where possible, limited
here to files in the `sql/` directory.

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.
2024-05-17 13:33:16 +01:00
Dave Gosselin
4911ec1a5b mtr on FreeBSD detects core count for --parallel=auto 2024-05-16 10:07:03 +10:00
Daniel Bartholomew
32ee6670a5
bump the VERSION 2024-05-15 10:52:16 -04:00
Sergei Golubchik
7e65512ecc cleanup: compile with -fno-operator-names in maintainer mode 2024-05-14 13:37:59 +02:00
Yuchen Pei
fd76746234
MDEV-28105 Return error in ha_spider::write_row() if info(HA_STATUS_AUTO) fails
Spider calls info with HA_STATUS_AUTO to update auto increment info,
which may attempt to connect the data node. If the connection fails,
it may emit an error and return the same error. This error should not
be of lower priority than any possible error from the later call to
handler::update_auto_increment().

Without this change, certain errors from update_auto_increment() such
as HA_ERR_AUTOINC_ERANGE may get ignored, causing my_insert() to call
my_ok(), which fails the assertion because the error was emitted in
the info() call (Diagnostics_area::is_set() returns true).
2024-05-14 15:50:29 +10:00
Yuchen Pei
a6ae1c2dfb
MDEV-32487 Check plugin is ready when resolving storage engine
This handles the situation when one thread is still initiating a
storage engine plugin, while another is creating a table using it.
2024-05-13 09:15:14 +10:00
Sergei Golubchik
1e5b0ff977 mtr: don't store galera sst logs in /tmp/ 2024-05-12 10:13:39 +02:00
Marko Mäkelä
9ea1f67214 MDEV-33817: Proper intrinsics for vextracti32x4 2024-05-12 08:04:06 +03:00
Daniel Black
d7d8c2c287 MDEV-31566: Fix buffer overrun of column_json function (postfix)
Test case failed --view protocol. Revert to using table for data
in the test.
2024-05-10 13:39:10 +10:00
He Guohua
867747204a MDEV-31566 Fix buffer overrun of column_json function
The accounting of the limit variable that represents the
amount of space left it the buffer was incorrect.

Also there was 1 or 2 bytes left to write that occured without
the buffer length being checked.

Review: Sanja Byelkin
2024-05-09 10:45:15 +10:00
Daniel Black
034ababa50 MDEV-34053 mariadbbackup privilege REPLICA MONITOR issue
MariaDB-backup needs to check for SLAVE MONITOR as that is
what is returned by SHOW GRANTS.

Update test to ensure that warnings about missing privileges
do not occur when the backup is successful.

Reviewer: Andrew Hutchings
Thanks Eugene for reporting the issue.
2024-05-09 09:53:44 +10:00
Sergei Golubchik
29c185bd77 test needs to cleanup after itself 2024-05-08 20:01:17 +02:00
Sergei Golubchik
938b929372 don't wait indefinitely for signal handler in --bootstrap
FreeBSD doesn't like it and hangs.

As we don't wait for signal handler, let's disable SIGHUP in bootstrap
too
2024-05-08 20:01:17 +02:00
Sergei Golubchik
360a7ff760 fix tests after 349ca2be74
.opt files, unlike combinations, accumulate, let's not overuse them
2024-05-08 20:01:17 +02:00
Sergei Golubchik
1c425a8d85 MDEV-33727 update test results
followup for 13663cb5c4
2024-05-08 20:01:17 +02:00
Vladislav Vaintroub
6f003b5d07 MDEV-29955 post-fix - add CMake policy CMP0074, so ZLIB_ROOT is not ignored 2024-05-08 11:20:23 +02:00
Vladislav Vaintroub
22d4fbeb62 Define CMake policy list, like it is done in 10.6+
Makes easier to add new policy to the list, and merge to newer versions-
2024-05-08 11:20:23 +02:00
Sergei Petrunia
40b3525fcc MDEV-28621: group by optimization incorrectly removing subquery where subject buried in a function
Workaround patch: Do not remove GROUP BY clause when it has
subquer(ies) in it.

remove_redundant_subquery_clauses() removes redundant GROUP BY clause
from queries in form:
  expr IN (SELECT no_aggregates GROUP BY ...)
  expr {CMP} {ALL|ANY|SOME} (SELECT no_aggregates GROUP BY ...)
This hits problems when the GROUP BY clause itself has subquer(y/ies).

This patch is just a workaround: it disables removal of GROUP BY clause
if the clause has one or more subqueries in it.

Tests:
- subselect_elimination.test has all known crashing cases.
- subselect4.result, insert_select.result are updated.
Note that in some cases results of SELECT are changed too (not just
EXPLAINs). These are caused by non-deterministic SQL: when running a
query like:

  x > ANY( SELECT col1 FROM t1 GROUP BY constant_expression)

without removing the GROUP BY, the executor is free to pick the value
of t1.col1 from any row in the GROUP BY group (denote it $COL1_VAL).
Then, it computes x > ANY(SELECT $COL1_VAL).

When running the same query and removing the GROUP BY:

   x > ANY( SELECT col1 FROM t1)

the executor will actually check all rows of t1.
2024-05-07 21:25:22 +02:00
Monty
ec6aa9ac42 MDEV-34055 Assertion '...' failure or corruption errors upon REPAIR on Aria tables
The problem was two fold:
- REPAIR TABLE t1 USE_FRM did not work for transactional
  Aria tables (Table was thought to be repaired, which it was not) which
  caused issues in later usage of the table.
- When swapping tmp_data file to data file, sort_info files where not
  updated. This caused problems if there was several unique keys and
  there was a duplicate for the second key.
2024-05-07 19:24:02 +03:00
Galina Shalygina
4bc1860eb4 MDEV-23878 Wrong result with semi-join and splittable derived table
Due to this bug a wrong result might be expected from queries with
an IN subquery predicate in the WHERE clause and a derived table in the
FROM clause to which split optimization could be applied.

The function JOIN::fix_all_splittings_in_plan() used the value of the
bitmap JOIN::sjm_lookup_tables() such as it had been left after the
search for the best plan for the select containing the splittable
derived table. That value could not be guaranteed to be correct. So the
recalculation of this bitmap is needed to exclude the plans with key
accesses from SJM lookup tables.

Approved by Igor Babaev <igor@maridb.com>
2024-05-07 12:21:35 +02:00
Yuchen Pei
10a7599286 MDEV-34036 Reset spider_hton_ptr in spider_db_done()
Otherwise spider_direct_sql may still think the spider plugin is
available even after spider_db_done() was called.
2024-05-07 10:56:02 +02:00
Sergei Golubchik
42c99ef0d4 MDEV-19949 mariadb-backup --password test 2024-05-07 09:48:53 +02:00
Sergei Golubchik
421eeb18b8 Revert "MDEV-19949 mariabackup option of '--password' or '-p' without specifying password in commandline"
This reverts commit 91fb8b7fd3.

Incompatible change, see tests in the next commit
2024-05-07 09:48:53 +02:00
Jan Lindström
33e4fbf045 MDEV-33898 : Galera test failure on galera.MW-369
Additional changes for the galera_vote_rejoin_ddl test (for 10.5+).

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-05-07 03:28:04 +02:00
Yuchen Pei
bca366e4a1
MDEV-34098 source start_slave.inc in spider suites
The spider suite should --source include/start_slave.inc to make sure
the slave is up before proceeding.
2024-05-07 10:16:38 +10:00
Dave Gosselin
89084c2ea4 MDEV-33078 SysInfo.pm reports incorrect CPU count on macOS
When running on macOS, MTR will ask the operating system for the core count when --parallel=auto
2024-05-07 09:08:57 +10:00
Sergei Golubchik
7ed9d2ac00 MDEV-9179 When binlog_annotate_row_events on , event of binlog file is truncated
cnt counter was incremented one extra time per line
2024-05-06 20:14:37 +02:00
Sergei Golubchik
7eeba92520 Merge branch '10.4' into 10.5 2024-05-06 17:17:18 +02:00
Sergei Golubchik
13663cb5c4 MDEV-33727 mariadb-dump trusts the server and does not validate the data
safety first - tell mariadb client not to execute dangerous
cli commands, they cannot be present in the dump anyway.

wrapping the command in /*!999999 ..... */ guarantees that
if a non-mariadb-cli client loads the dump and sends it to the
server - the server will ignore the command it doesn't understand
2024-05-06 17:16:10 +02:00
Sergei Golubchik
2025597c0b MDEV-21778 Disable system commands in mysql/mariadb client
mysql --sandbox

disables system (\!), tee (\T), pager with an argument(\P foo), source (\.)

does *not* disable edit (\e). Use EDITOR=/bin/false to disable
or, for example, EDITOR=rnano for something more useful

does *not* disable pager (\P) without an argument. Use
PAGER=cat or, for example PAGER=less LESSSECURE=1 for something
more useful

using a disabled command is an error, which can be ignored with --force

Also, a "sandbox" command (\-) - enables the sandbox mode until EOF
(current file or the session, if interactive)
2024-05-06 17:16:10 +02:00
Sergei Golubchik
83aedeacc4 cleanup: remove __attribute__((unused)) from mysql.cc
the client is C++, use a much more concise C++ syntax

as a bonus, arguments that are used, are no longer marked "unused"
2024-05-06 17:16:10 +02:00
Sergei Golubchik
994a0de96b cleanup: reorder mysql help output 2024-05-06 17:16:10 +02:00
Sergei Golubchik
98b157fdee cleanup: unused OPT_xxx and client_priv.h 2024-05-06 17:16:10 +02:00
Sergei Golubchik
22b3ba9312 MDEV-25102 UNIQUE USING HASH error after ALTER ... DISABLE KEYS
on disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE) the engine does
not know that the long unique is logically unique, because on the
engine level it is not. And the engine disables it,

Change the disable_indexes/enable_indexes API. Instead of the enum
mode, send a key_map of indexes that should be enabled. This way the
server will decide what is unique, not the engine.
2024-05-06 17:16:10 +02:00
Thirunarayanan Balathandayuthapani
9b2bf09b95 MDEV-33980 mariadb-backup --backup is missing retry logic for undo tablespaces
- This is a merge of commit f378e76434
from 10.4 to 10.5.
2024-05-06 19:50:20 +05:30
Sergei Golubchik
16394f1aa1 update C/C 3.1 2024-05-06 16:14:11 +02:00
Julius Goryavsky
b88c20ce1b Merge branch 10.4 into 10.5 2024-05-06 13:55:42 +02:00
Sergei Petrunia
55754be20c MDEV-33781: rocksdb.locking_issues_case5_rc fails windows ... : Disable it 2024-05-06 13:34:39 +03:00
Sergei Petrunia
f90fcefdb2 MDEV-33866: rocksdb.write_sync fails on windows ... : Disable it 2024-05-06 13:31:31 +03:00
Sergei Petrunia
be60782103 MDEV-33789: rocksdb.bloomfilter2 failed on ... : Disable it. 2024-05-06 13:06:14 +03:00
Julius Goryavsky
52c45332a8 MDEV-34071: Failure during the galera_3nodes_sr.GCF-336 test
This commit fixes sporadic failures in galera_3nodes_sr.GCF-336
test. The following changes have been made here:

1) A small addition to the test itself which should make
   it more deterministic by waiting for non-primary state
   before COMMIT;
2) More careful handling of the wsrep_ready variable in
   the server code (it should always be protected with mutex).

No additional tests are required.
2024-05-06 03:16:59 +02:00
Sergei Golubchik
4045a87bcb test for Bug #16051817 GOT ERROR 124 FROM STORAGE ENGINE ON DELETE FROM A PARTITIONED TABLE
followup for c5896384bd
2024-05-05 21:37:08 +02:00
Sergei Golubchik
3d75cffa91 bugfix: INFORMATION_SCHEMA.STATISTICS doesn't show whether the index is disabled 2024-05-05 21:37:08 +02:00
Sergei Golubchik
179515a68c bugfix: dgcov.pl shows wrong line numbers
dgcov.pl was putting gcov execution counters on wrong lines
in the report (*.dgcov files were correct), because it was
incrementing the new line number for diff lines starting from '-'
(lines from the old file, not present in the new)
2024-05-05 21:37:08 +02:00