Commit graph

195486 commits

Author SHA1 Message Date
Oleksandr Byelkin
d2f1c3ed6c Merge branch '10.5' into bb-10.6-release 2022-08-03 12:19:59 +02:00
Oleksandr Byelkin
af143474d8 Merge branch '10.4' into 10.5 2022-08-03 07:12:27 +02:00
Sergei Golubchik
7b500f04fb MDEV-29078 For old binary logs explicit_defaults_for_timestamp presumed to be OFF, server value ignored
don't assume anymore that OPTIONS_WRITTEN_TO_BIN_LOG is fixed once
and forever. Instead, deduct master's OPTIONS_WRITTEN_TO_BIN_LOG
from the master's version in binlog.
2022-08-02 18:08:42 +02:00
Sergei Golubchik
56c7d14217 MDEV-29075 Changing explicit_defaults_for_timestamp within stored procedure works inconsistently 2022-08-02 18:08:40 +02:00
Sergei Golubchik
b174ec169d MDEV-29225 make explicit_defaults_for_timestamps SESSION variable
save it in binlog, so that CREATE TABLE could be replayed correctly
on the slave
2022-08-02 18:08:38 +02:00
Sergei Golubchik
4e3728f038 MDEV-29225 make explicit_defaults_for_timestamps SESSION variable
make @@explicit_defaults_for_timestamp session variable
2022-08-02 18:05:32 +02:00
Sergei Golubchik
086eb8e23c my_getopt --help for "bit" options
print "Defaults to on" not only for GET_BOOL, but also for GET_BIT
2022-08-02 17:49:21 +02:00
Sergei Golubchik
28d44abd99 MDEV-27540 Different OpenSSL versions mix up in build depending on cmake options
list ${OPENSSL_ROOT_DIR}/lib64 explicitly, because
cmake below version 3.23.0 won't search there.
2022-08-02 17:49:21 +02:00
Oleksandr Byelkin
48e35b8cf6 Merge branch '10.3' into 10.4 2022-08-02 14:15:39 +02:00
Oleksandr Byelkin
5ac528a91f Merge remote-tracking branch 'connect/10.3' into 10.3 2022-08-02 10:23:53 +02:00
Oleksandr Byelkin
b043e1098e Merge branch 'merge-perfschema-5.7' into 10.5 2022-08-02 09:34:15 +02:00
Ian Gilfillan
4d0c53a327 MDEV-28701 Update Server HELP
Bootstrap size increase and error fix by Daniel Black.
2022-08-02 16:35:15 +10:00
Daniel Black
182a6383cd MDEV-16605 Always include buf_madvise_do_dump in binaries
The "used" attribute seems to do this

ref: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
2022-08-02 12:29:11 +10:00
Aleksey Midenkov
1ea5e402a8 MDEV-28727 ALTER TABLE ALGORITHM=NOCOPY does not work after upgrade
MDEV-20704 changed the rules of how (HA_BINARY_PACK_KEY |
HA_VAR_LENGTH_KEY) flags are added. Older FRMs before that fix had
these flags for DOUBLE index. After that fix when ALTER sees such old
FRM it thinks it cannot do instant alter because of failed
compare_keys_but_name(): it compares flags against tmp table created
by ALTER.

MDEV-20704 fix was actually not about DOUBLE type but about
FIELDFLAG_BLOB which affected DOUBLE. So there is no direct knowledge
that any other types were not affected.

The proposed fix under CHECK TABLE checks if FRM has
(HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY) flags and was created prior
MDEV-20704 and if so issues "needs upgrade". When mysqlcheck and
mysql_upgrade see such status they issue ALTER TABLE FORCE and upgrade
the table to the version of server.
2022-08-01 19:14:46 +03:00
Aleksey Midenkov
231feabd2b MDEV-21540 Initialization of already inited long unique index on reorganize partition
Handler for existing partition was already index-inited at the
beginning of copy_partitions().

In the case of REORGANIZE PARTITION we fill new partition by calling
its ha_write_row() (handler is storage engine of new partition). From
that we go through the below conditions:

    if (this->inited == RND)
      table->clone_handler_for_update();
    handler *h= table->update_handler ? table->update_handler : table->file;

First, the above misses the meaning of this->inited check. Now it is
new partition and this handler is not inited. So, we assign
table->file which is ha_partition and is really not known to be inited
or not. It is supposed (this == table->file), otherwise we are
out of the logic for using update_handler. This patch adds DBUG_ASSERT
for that.

Second, we call check_duplicate_long_entries() for table->file and
that calls ha_partition::index_init() which calls index_init() for
each partition's handler. But the existing parititions' handlers was
already inited in copy_partitions() and we fail on assertion.

The fix implies that we don't need check_duplicate_long_entries()
per-partition as we've already done check_duplicate_long_entries() for
ha_partition. For REORGANIZE PARTITION that means existing row was
already checked at previous INSERT/UPDATE commands, so no need to
check it again (see NOTE in handler::ha_write_row()).

The fix also optimizes ha_update_row() so
check_duplicate_long_entries_update() is not called per-partition
considering it was already called for ha_partition. Besides,
per-partition duplicate check is not really usable.
2022-08-01 19:14:46 +03:00
Julius Goryavsky
7fb1f919d0 MDEV-28758: Mariabackup copies binary logs to backup directory
This commit restores defaults and functionality regarding binlogs
to the way it was prior to MDEV-27524. The mariabackup utility no
longer saves binlogs files as part of a backup without the --galera-info
option. However, since we use --galera-info during SST, the behavior
of mariabackup changes and, in combination with GTIDs support enabled,
mariabackup transfers one (most recent) binlog file obtained after
FLUSH BINARY LOGS. In other cases, binlogs are not transferred during
SST in mariabackup mode. As for SST in the rsync mode, it works the
same way as before MDEV-27524 - by default it transfers one last
binlog file.

The --sst-max-binlogs option for mariabackup and the sst_max_binlogs
parameter in the [sst] / server sections are no longer supported for
SST via mariabackup.
2022-08-01 15:53:14 +02:00
Sergei Golubchik
5b4154373a only copy buffer pool dump in SST galera mode
and then only into the default name, so that the joiner could find it
2022-08-01 15:53:14 +02:00
Sergei Golubchik
5197519f4f revert mariabackup part of MDEV-27524, fix the test 2022-08-01 15:53:13 +02:00
Marko Mäkelä
212994f704 MDEV-28974: mariadb-backup --prepare fails
fil_name_process(): Upon processing a new file name for FILE_RENAME, rename
the tablespace in deferred_spaces.

recv_sys_t::parse(): Rearrange some code to slightly improve the locality
of reference. Invoke fil_name_process() with FILE_MODIFY, FILE_DELETE
or the new case FILE_RENAME, for the new file name of the file.

This should be a regression due to
commit 86dc7b4d4c (MDEV-24626)
and it might also affect the crash recovery of DDL operations.
2022-08-01 16:40:14 +03:00
Marko Mäkelä
34cdc00628 MDEV-13542 fixup: Improve page reorganize
btr_page_reorganize_low(): Restore mtr->set_log_mode() before returning.

innobase_instant_try(): Do not invoke rec_get_offsets() if
btr_cur_pessimistic_update() failed. The cursor position may be
invalid.
2022-08-01 16:39:44 +03:00
Marko Mäkelä
6a3fbfdb2d MDEV-14804 innodb.update_time occasionally fails
Let simplify the test.
The update_time is stored in the table metadata (dict_table_t);
it has nothing to do with buffer pool page eviction or replacement.
2022-08-01 15:15:06 +03:00
Sergei Petrunia
90ba999e80 MDEV-25020: Range optimizer regression for key IN (const, ....)
(addressed review input)
The issue was introduced by @@optimizer_max_sel_arg_weight code.
key_or() calls SEL_ARG::update_weight_locally().  That function
takes O(tree->elements) time.
Without that call, key_or(big_tree, one_element_tree) would take
O(log(big_tree)) when one_element_tree doesn't overlap with elements
of big_tree.
This means, update_weight_locally() can cause a big slowdown.

The fix:
1. key_or() actually doesn't need to call update_weight_locally().
  It calls SEL_ARG::tree_delete() and SEL_ARG::insert(). These functions
  update SEL_ARG::weight.
  It also manipulates the SEL_ARG objects directly, but these
  modifications do not change the weight of the tree.
  I've just removed the update_weight_locally() call.
2. and_all_keys() also calls update_weight_locally(). It manipulates the
  SEL_ARG graph directly.
  Removed that call and added the code to update the SEL_ARG graph weight.

Tests main.range and main.range_not_embedded already contain the queries
that have test coverage for the affected code.
2022-08-01 14:29:02 +03:00
Norio Akagi
84d26f98c7
MDEV-28315 Fix ASAN stack-buffer-overflow in String::copy_aligned
Starting since this commit 36cdd5c3cd
there is an ASAN stack-buffer-overflow error because we append a NULL
terminator beyond the length of memory allocated.

Reviewed by: Monty and Nayuta Yanagisawa
2022-08-01 20:27:33 +09:00
Sergei Golubchik
40c2460d8c in INFORMATION_SCHEMA.ALL_PLUGINS match installed plugins better
look for an installed plugin with the same name _and the same type_
(in case there are many plugins with the same name and different type,
which is, technically, possible for built-in plugins).
2022-08-01 11:11:45 +02:00
Marko Mäkelä
63478e72de MDEV-21098: Assertion failure in rec_get_offsets_func()
The function rec_get_offsets_func() used to hit ut_error
due to an invalid rec_get_status() value of a
ROW_FORMAT!=REDUNDANT record. This fix is twofold:
We will not only avoid a crash on corruption in this case,
but we will also make more effort to validate each record
every time we are iterating over index page records.

rec_get_offsets_func(): Do not crash on a corrupted record.

page_rec_get_nth(): Return nullptr on error.

page_dir_slot_get_rec_validate(): Like page_dir_slot_get_rec(),
but validate the pointer and return nullptr on error.

page_cur_search_with_match(), page_cur_search_with_match_bytes(),
page_dir_split_slot(), page_cur_move_to_next():
Indicate failure in a return value.

page_cur_search(): Replaced with page_cur_search_with_match().

rec_get_next_ptr_const(), rec_get_next_ptr(): Replaced with
page_rec_get_next_low().

TODO: rtr_page_split_initialize_nodes(), rtr_update_mbr_field(),
and possibly other SPATIAL INDEX functions fail to properly handle
errors.

Reviewed by: Thirunarayanan Balathandayuthapani
Tested by: Matthias Leich
Performance tested by: Axel Schwenke
2022-08-01 11:25:50 +03:00
Sergei Golubchik
8ea529ecba MDEV-29131 Assertion `status == 0' failed when renaming user after deleting table roles_mapping
if mysql.roles_mapping table doesn't exist (it's optional, after all),
we still update in-memory structures to keep them consistent
2022-07-29 21:58:38 +02:00
Sergei Golubchik
6c7e3e5c13 bugfix: RAND is VCOL_SESSION_FUNC
it's not "non deterministic", it's completely defined
by @@rand_seed1 and @@rand_seed2. And as a session func it needs
to be re-fixed at the beginning of every statement.
2022-07-29 21:58:38 +02:00
Rucha Deodhar
25219920f5 MDEV-28762: recursive call of some json functions without stack control
Fixup to MDEV-28762. Fixes warnings about unused variable "stack_used_up"
during building with RelWithDebInfo
2022-07-29 22:09:45 +05:30
Oleksandr Byelkin
61d08f7427 mysql-5.7.39 2022-07-29 14:48:01 +02:00
Georg Richter
f9315b3321 CC 3.1 update
Test fixes:

Since fix for CONC-603 (wrong error handling in TLS read/write) in case
of a read/write error client doesn't return always error 2013 (server
has gone away), so in addition we need to check for error 2026
(TLS/SSL error) and 5014 (write error).
2022-07-29 13:39:12 +02:00
Rucha Deodhar
a6f7c8edc9 MDEV-28762: recursive call of some json functions without stack control
Fixup to MDEV-28762. Fixes warnings about unused variable "stack_used_up"
during building with RelWithDebInfo
2022-07-29 15:58:38 +05:30
Oleksandr Byelkin
cbcc0101ee MDEV-29188 Crash in JSON_EXTRACT
If we have null_value set then decimal/string value/result shoud be 0 pointer.
2022-07-29 09:03:54 +02:00
Daniel Lenski
05a407b239 MDEV-28782: modify mariadb-tzinfo-to-sql to set 'wsrep*' variables appropriately in cases where Galera is not compiled in
In 3b662c6ebd, it was discovered that the
values of the 'wsrep_is_on' and 'wsrep_cannot_replicate_tz' variables need
to be overridden for embedded builds to pass

However, there are other build configurations where these variables also
have NULL values.  The mariadb-tzinfo-to-sql script (implemented in
sql/tztime.cc) can be slightly modified to set its 'wsrep_is_on' and
'wsrep_cannot_replicate_tz' variables more predictably in all such cases,
thus allowing the mysql_tzinfo_to_sql_symlink.test test to pass without
any special-casing for particular build types.

See comments:

- 3b662c6ebd (r78994411)
- https://jira.mariadb.org/browse/MDEV-28782?focusedCommentId=230038&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230038

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.
2022-07-29 08:49:21 +10:00
Thirunarayanan Balathandayuthapani
38d0256b14 - Fixed the change_column_collation test case to avoid the
loss of debug sync signal
2022-07-28 21:06:57 +05:30
Daniel Black
2658410afc MDEV-29187: Deadlock output in InnoDB status always shows transaction (0)
At some point the incrementing of the transaction counter got dropped.

Thanks Agustin for the bug report.
2022-07-28 16:22:43 +10:00
Marko Mäkelä
4b77d38c26 Fix GCC -Og -Wmaybe-uninitialized 2022-07-28 08:51:19 +03:00
Marko Mäkelä
30914389fe Merge 10.5 into 10.6 2022-07-27 17:52:37 +03:00
Oleksandr Byelkin
f0107c90a0 wolfssl v5.4.0-stable 2022-07-27 16:21:28 +02:00
Vladislav Vaintroub
4329720b79 Fixes for WolfSSL 5.4.0 2022-07-27 16:18:18 +02:00
Marko Mäkelä
098c0f2634 Merge 10.4 into 10.5 2022-07-27 17:17:24 +03:00
Oleksandr Byelkin
15a2ff1231 MDEV-26647 (simple_password_check) Include password validation plugin information in the error message if the SQL statement is not satisfied password policy
Make the plugin reporting cause of the error.
2022-07-27 16:04:20 +02:00
Oleksandr Byelkin
cc6bba008d MDEV-26647 (plugin name) Include password validation plugin information in the error message if the SQL statement is not satisfied password policy
Add plugin name to the error message.
2022-07-27 15:23:39 +02:00
Marko Mäkelä
e5c4f4e590 Merge 10.3 into 10.4 2022-07-27 14:25:36 +03:00
Marko Mäkelä
0ee1082bd2 MDEV-28495 InnoDB corruption due to lack of file locking
Starting with commit da094188f6 (MDEV-24393),
MariaDB will no longer acquire advisory file locks on InnoDB data
files by default, because it would create a large number of
entries in Linux /proc/locks.

The motivation for acquiring the file locks is to prevent accidental
concurrent startup of multiple server processes on the same data files.
Such mistake still turns out to be relatively common, based on
corruption bug reports from the community.

To prevent corruption due to concurrent startup attempts, the
Aria storage engine would unconditionally acquire an advisory lock
on one of its log files.

Solution: InnoDB will always lock its system tablespace files.
(Ever since commit 685d958e38
the InnoDB log file will not necessarily be open while the
server is running, because it can be accessed via memory-mapped I/O.)

If more protection is desired, then the option --external-locking
can be used.

The mandatory advisory lock also fixes intermittent failures of
some crash recovery tests. It turns out that when the mtr test harness
kills and restarts the server, it will not actually ensure that the
old process has terminated before starting the new one.
2022-07-27 14:15:14 +03:00
Oleksandr Byelkin
3bb36e9495 Merge branch '10.3' into 10.4 2022-07-27 11:02:57 +02:00
Marko Mäkelä
772e3f61eb MDEV-28950: Add a test case
After reverting commit commit 39f45f6f89
all combinations of this test would crash the server.
2022-07-27 08:25:13 +03:00
Igor Babaev
bd935a4106 MDEV-29139 Crash when using ANY predicand with redundant subquery in GROUP BY clause
This bug could cause a crash of the server when executing queries containing
ANY/ALL predicands with redundant subqueries in GROUP BY clauses.
These subqueries are eliminated by remove_redundant_subquery_clause()
together with elimination of GROUP BY list containing these subqueries.
However the references to the elements of the GROUP BY remained in the
JOIN::all_fields list of the right operand of of the ALL/ANY predicand.
Later these references confused make_aggr_tables_info() when forming
proper execution structures after ALL/ANY predicands had been replaced
with expressions containing MIN/MAX set functions.
The patch just removes these references from JOIN::all_fields list used
by the subquery of the ALL/ANY predicand when its GROUP BY clause is
eliminated.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
2022-07-26 18:03:34 -07:00
Sergei Golubchik
e8eb6d9c93 zlib: remove redundant and generated files
followup for 4bc34ef36f
2022-07-26 16:46:27 +02:00
Marko Mäkelä
9a897335eb MDEV-26420 Buffer overflow on instant ADD/DROP of generated column
prepare_inplace_add_virtual(): Over-estimate the size of the arrays
by not subtracting table->s->virtual_fields (which may refer to
stored, not virtual generated columns). InnoDB only distinguishes
virtual columns.
2022-07-26 16:45:10 +03:00
Andrei
8d238d4726 MDEV-28609 refine gtid-strict-mode to ignore same server-id gtid from the past
... on semisync slave

To provide semisync master crash-recovery the same server-id transactions
were made to accept for execution on the semisync slave when the strict gtid
mode (see MDEV-27760).
That however caused out-of-order error on a master's transaction
server of the circular setup.
The error was fair in the sense of the gtid strict mode rule as indeed
under the condition of the circular setup the replicated transaction
already exists in the local binlog.

This is fixed by the commit to ignore on the gtid strict mode semisync
slave those gtids that exist in the slave's binlog that effectively restores
the default same-server-id ignore policy.
At the same time the fixes complies with MDEV-21117 semisync slave recovery
to accept the same server-id transactions that do not exist in local binlog.
2022-07-26 16:01:14 +03:00