Commit graph

194218 commits

Author SHA1 Message Date
Sergei Golubchik
1421d1f296 columnstore-5.6.5-2 2022-04-29 21:08:03 +02:00
Igor Babaev
c8228369f6 MDEV-28080 Crash when using HAVING with NOT EXIST predicate in an equality
MDEV-28082 Crash when using HAVING with IS NULL predicate in an equality

These bugs have been fixed by the patch for MDEV-26402.
Only test cases are added.
2022-04-29 10:37:36 -07:00
Sergei Golubchik
0beed9b5e9 MDEV-28097 use-after-free when WHERE has subquery with an outer reference in HAVING
when resolving WHERE and ON clauses, do not look in
SELECT list/aliases.
2022-04-29 17:05:19 +02:00
Sergei Golubchik
8c34eab968 MDEV-28094 Window function in expression in ORDER BY
call item->split_sum_func() in setup_order() just as
it's done in setup_fields()
2022-04-29 17:05:19 +02:00
Sergei Golubchik
bc9102eb81 cleanup: (*order->item) -> item
and minor style fixes
2022-04-29 17:05:12 +02:00
Aleksey Midenkov
182b8a29e7 MDEV-20077 compilation fix 2022-04-29 17:36:48 +03:00
Aleksey Midenkov
ddc416c606 MDEV-20077 Warning on full history partition is delayed until next DML statement
Moved LIMIT warning from vers_set_hist_part() to new call
vers_check_limit() at table unlock phase. At that point
read_partitions bitmap is already pruned by DML code (see
prune_partitions(), find_used_partitions()) so we have to set
corresponding bits for working history partition.

Also we don't do my_error(ME_WARNING|ME_ERROR_LOG), because at that
point it doesn't update warnings number, so command reports 0 warnings
(but warning list is still updated). Instead we do
push_warning_printf() and sql_print_warning() separately.

Under LOCK TABLES external_lock(F_UNLCK) is not executed. There is
start_stmt(), but no corresponding "stop_stmt()". So for that mode we
call vers_check_limit() directly from close_thread_tables().

Test result has been changed according to new LIMIT and warning
printing algorithm. For convenience all LIMIT warnings are marked with
"You see warning above ^".

TODO MDEV-20345 fixed. Now vers_history_generating() contains
fine-grained list of DML-commands that can generate history (and TODO
mechanism worked well).
2022-04-29 13:31:42 +03:00
Aleksey Midenkov
ea2f09979f MDEV-28271 Assertion on TRUNCATE PARTITION for PARTITION BY SYSTEM_TIME
Like in MDEV-27217 vers_set_hist_part() for LIMIT depends on all
partitions selected in read_partitions. That bugfix just disabled
partition selection for DELETE with this check:

  if (table->pos_in_table_list &&
      table->pos_in_table_list->partition_names)
  {
    return HA_ERR_PARTITION_LIST;
  }

ALTER TABLE TRUNCATE PARTITION is a different story. First, it doesn't
update pos_in_table_list->partition_names, but
thd->lex->alter_info.partition_names. But we cannot depend on that
since alter_info will be stale for DML. Second, we should not disable
TRUNCATE PARTITION for that to be consistent with TRUNCATE TABLE
behavior.

Now we don't do vers_set_hist_part() for ALTER TABLE as this command
is not DML, so it does not produce history.
2022-04-29 13:31:41 +03:00
Alexey Botchkov
7215b00354 MDEV-28431 auth_pam tool left zombie processes.
The faulure in username packet reading can lead to the
auth_plugin_tool zombie. So check and close the application.
2022-04-28 15:40:08 +04:00
Sergei Golubchik
f354e457e1 Bug#33578113: DROP privilege on performance_schema.* can't be revoked
test case only
2022-04-28 13:21:04 +02:00
Sergei Golubchik
1430cf7873 MDEV-28428 Master_SSL_Crl shows Master_SSL_CA value in SHOW SLAVE STATUS output
it was showing ca and capath instead of crl and crl_path
2022-04-28 13:21:04 +02:00
Sergei Golubchik
af810407f7 MDEV-28098 incorrect key in "dup value" error after long unique
reset errkey after using it, so that it wouldn't affect
the next error message in the next statement
2022-04-28 13:17:13 +02:00
Sergei Petrunia
eea15803ec MDEV-28268: Server crashes in Expression_cache_tracker::fetch_current_stats
Expression_cache_tmptable object uses an Expression_cache_tracker object
to report the statistics.

In the common scenario, Expression_cache_tmptable destructor sets
tracker->cache=NULL. The tracker object survives after the expression
cache is deleted and one may call cache_tracker->fetch_current_stats()
for it with no harm.

However a degenerate cache with no parameters does not set
tracker->cache=NULL in Expression_cache_tmptable destructor which
results in an attempt to use freed data in the
cache_tracker->fetch_current_stats() call.

Fixed by setting tracker->cache to NULL and wrapping the assignment into
a function.
2022-04-28 11:20:12 +03:00
Alexander Barkov
821808c45d A clean-up for "MDEV-19772 Add helper classes for ST_FIELD_INFO"
As agreed with Serg, renaming class Yesno to Yes_or_empty,
to reflect better its behavior.

This helper class is used to define INFORMATION_SCHEMA columns
that return either "Yes" or an empty string.
2022-04-28 12:12:16 +04:00
Alexey Botchkov
add5137d84 MDEV-28429 audit plugin report OOOOO.
Few initializations to the connection_info structure added.
I think they can be removed if we are sure the bug was fixed.
2022-04-28 11:28:49 +04:00
Alexander Barkov
0e4bc67eab 10.4 specific changes for "MDEV-27494 Rename .ic files to .inl"
Renaming ctype-uca.ic to ctype-uca.inl

This file was introduced in 10.4,
so it did not get to the main 10.2 patch for MDEV-27494
2022-04-28 10:52:11 +04:00
Igor Babaev
39feab3cd3 MDEV-26412 Server crash in Item_field::fix_outer_field for INSERT SELECT
IF an INSERT/REPLACE SELECT statement contained an ON expression in the top
level select and this expression used a subquery with a column reference
that could not be resolved then an attempt to resolve this reference as
an outer reference caused a crash of the server. This happened because the
outer context field in the Name_resolution_context structure was not set
to NULL for such references. Rather it pointed to the first element in
the select_stack.

Note that starting from 10.4 we cannot use the SELECT_LEX::outer_select()
method when parsing a SELECT construct.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
2022-04-27 08:23:01 -07:00
Oleksandr Byelkin
34b002d0dc New PCRE2 (10.40) 2022-04-27 13:23:42 +02:00
Marko Mäkelä
0806592ac8 MDEV-28422 Page split breaks a gap lock
btr_insert_into_right_sibling(): Inherit any gap lock from the
left sibling to the right sibling before inserting the record
to the right sibling and updating the node pointer(s).

lock_update_node_pointer(): Update locks in case a node pointer
will move.

Based on mysql/mysql-server@c7d93c274f
2022-04-27 13:38:08 +03:00
Marko Mäkelä
c711abd182 MDEV-28417 Merge new release of InnoDB 5.7.38 to 10.2 2022-04-27 08:08:52 +03:00
Marko Mäkelä
44a27a26e9 MDEV-28416 Incorrect AUTO_INCREMENT may be issued when close to UINT64_MAX
ha_innobase::get_auto_increment(): In the overflow check, account
for 64-bit unsigned integer wrap-around.

Based on mysql/mysql-server@25ecfe7f49
2022-04-27 08:08:06 +03:00
Marko Mäkelä
f21a875600 MDEV-28415 ALTER TABLE on a large table hangs InnoDB
buf_flush_page(): Never wait for a page latch, even in checkpoint
flushing (flush_type == BUF_FLUSH_LIST), to prevent a hang of the
page cleaner threads when a large number of pages is latched.

In mysql/mysql-server@9542f3015b
it was claimed that such a hang only affects CREATE FULLTEXT INDEX.
Their fix was to retain buffer-fix but release exclusive latch
on non-leaf pages, and subsequently write to those pages while
they are not associated with the mini-transaction, which would
trip a debug assertion in the MariaDB version of
mtr_t::memo_modify_page() and cause potential corruption
when using the default MariaDB setting innodb_log_optimize_ddl=OFF.

This change essentially backports a small part of
commit 7cffb5f6e8 (MDEV-23399)
from MariaDB Server 10.5.7.
2022-04-27 07:57:04 +03:00
Julius Goryavsky
fccca49997 MDEV-28377: galera_as_slave_nonprim bind: Address already in use
This commit fixes a crash reported as MDEV-28377 and a number
of other crashes in automated tests with mtr that are related
to broken .cnf files in galera and galera_3nodes suites, which
happened when automatically migrating MDEV-26171 from 10.3 to
subsequent higher versions.
2022-04-26 20:44:20 +02:00
Sergei Golubchik
39990135e5 MDEV-28020 CHECKSUM TABLE calculates different checksums
Two bugs here:

1. CHECKSUM TABLE asserted that all fields in the table are arranged
   sequentially in the record, but virtual columns are always at the
   end, violating this assertion
2. virtual columns were not calculated for CHECKSUM, so CHECKSUM
   was using, essentially, garbage left from the previous statement.
   (that's why the test must use INSERT IGNORE to have this "previous
   statement" mark vcols not null)

Fix: don't include virtual columns into the table CHECKSUM. Indeed,
they cannot be included as the engine does not see virtual columns,
so in-engine checksum cannot include them, meaning in-server checksum
should not either
2022-04-26 19:18:06 +02:00
Oleksandr Byelkin
44e7c312ba New C/C version
*again* after 388032e990 has reverted 25ccf8f6dc by mistake
2022-04-26 19:17:27 +02:00
Andrei
388032e990 MDEV-27697. Removed a false assert. 2022-04-26 19:47:59 +03:00
Alexey Botchkov
eca207c462 MDEV-25317 Assertion scale <= precision' failed in decimal_bin_size And Assertion scale >= 0 && precision > 0 && scale <= precision' failed in decimal_bin_size_inline/decimal_bin_size.
Precision should be kept below DECIMAL_MAX_SCALE for computations.
It can be bigger in Item_decimal. I'd fix this too but it changes the
existing behaviour so problemmatic to ix.
2022-04-26 18:36:36 +04:00
Andrei
945245aea4 MDEV-27697. Two affected tests fixed.
A result file is updated in one case and former error simulation got
refined.
2022-04-26 17:05:40 +03:00
Sergei Petrunia
5100b20b15 MDEV-26047: MariaDB server crash at Item_subselect::init_expr_cache_tracker
The cause of crash:
remove_redundant_subquery_clauses() removes redundant item expressions.
The primary goal of this is to remove the subquery items.
The removal process unlinks the subquery from SELECT_LEX tree, but does
not remove it from SELECT_LEX:::ref_pointer_array or from JOIN::all_fields.
Then, setup_subquery_caches() tries to wrap the subquery item in an
expression cache, which fails, the first reason for failure being that
the item doesn't have a query plan.

Solution: do not wrap eliminated items with expression cache.
(also added an assert to check that we do not attempt to execute them).

This may look like an incomplete fix: why don't we remove any mention
of eliminated item everywhere? The difficulties here are:
* items can be "un-removed" (see set_fake_select_as_master_processor)
* it's difficult to remove an element from ref_pointer_array: Item_ref
objects refer to elements of that array, so one can't shift elements in
it. Replacing eliminated subselect with a dummy Item doesn't look like a
good idea, either.
2022-04-26 15:21:21 +03:00
Sergei Golubchik
e6bbc83d5e MDEV-26212 PAM authentication fails with ENOMEM
use posix_spawn(), not fork() - it's better for systems that don't
overcommit memory
2022-04-26 11:21:04 +02:00
Rucha Deodhar
d45841b9be MDEV-26695: Number of an invalid row is not calculated for table value
constructor

Analysis: counter does not increment while sending rows for table value
constructor and so row_number assumes the default value (0 in this case).
Fix: Increment the counter to avoid counter using default value.
2022-04-26 13:02:15 +05:30
Rucha Deodhar
9b2d36660b MDEV-20207: Assertion ! is_set() failed in Diagnostics_area::set_eof_status
upon HANDLER READ

Analysis: The error state is not stored while checking condition and key
name.
Fix: Return true while checking condition and key name if error is reported
because geometry object can't be created from the data in the index value
for HANDLER READ.
2022-04-26 12:40:11 +05:30
Oleksandr Byelkin
25ccf8f6dc New CC version 2022-04-26 08:07:31 +02:00
Daniel Black
551e7814ed MDEV-28227 Chinese translation postfix
Add chinese language to missing sql/share/CMakeLists.txt that
results in installed files.

Also add bulgarian=bgn which has existing for a long time.

Sort both lists properly.

Append both to debian/mariadb-server-core-10.4 too.
2022-04-26 13:31:41 +10:00
Sergei Golubchik
3988dfff62 MDEV-6899 extra semicolon in show create event syntax
to detect the end of SP definition correctly we need to know where
the parser stopped parsing the SP. lip->get_cpp_ptr() shows the
current parsing position, lip->get_cpp_tok_start() shows the start of
the last parsed token. The actual value depends on whether
the parser has performed a look-ahead. For example, in

  CREATE PROCEDURE ... BEGIN ... END ;

the parser reads 'END' and knows that this ends the procedure definition,
it does not need to read the next token for this. But in

  CREATE PROCEDURE ... SELECT 1 ;

the parser cannot know that the procedure ends at '1'. It has to read
the semicolon first (it could be '1 + 2' for example).

In the first case, the "current parsing position" is after END, before
the semicolon, in the second case it's *after* the semicolon. Note that
SP definition in both cases ends before the semicolon.

To be able to detect the end of SP deterministically, we need the parser
to do the look-ahead always or never.

The bug fix introduces a new parser token FORCE_LOOKAHEAD. Lexer never
returns it, so this token can never match. But the parser cannot know
it so it will have to perform a look-ahead to determine that the next
token is not FORCE_LOOKAHEAD. This way we deterministically end
SP parsing with a look-ahead.
2022-04-25 21:23:00 +02:00
Sergei Golubchik
7753eae1c0 MDEV-28393 Server crashes in TABLE::mark_default_fields_for_write
test only
2022-04-25 21:22:59 +02:00
Sergei Golubchik
1a94d2fdb1 cleanup: main.create_select test 2022-04-25 21:22:59 +02:00
Sergei Golubchik
9b7886bbf1 MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value
This reverts commit 5ba77222e9
but keeps the test. A different fix for

MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view

internal temporary tables should use THD as expr_area
2022-04-25 21:22:59 +02:00
Igor Babaev
c5e68b6dcd MDEV-27212 Crash in Item_equal::sort on second execution of stored procedure
This bug could cause a crash of the server at the second call of a stored
procedure when it executed a query containing a mergeable derived table /
view whose specification used another mergeable derived_table or view and a
subquery with outer reference in the select list of the specification.
Such queries could cause the same problem when they were executed for the
second time in a prepared mode.
The problem appeared due to a typo mistake in the legacy code of the function
create_view_field() that prevented building Item_direct_view_ref wrapper
for the mentioned outer reference at the second execution of the query and
setting the depended_from field for the outer reference.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
2022-04-25 09:30:42 -07:00
Brandon Nesterenko
d16c3aca3c MDEV-26473: mysqld got exception 0xc0000005 (rpl_slave_state/rpl_load_gtid_slave_state)
Problem:
========
During mysqld initialization, if the number of GTIDs added since
that last purge of the mysql.gtid_slave_pos tables is greater than
or equal to the –-gtid-cleanup-batch-size value, a race condition
can occur. Specifically, the binlog background thread will submit
the bg_gtid_delete_pending job to the mysql handle manager; however,
the mysql handle manager may not be initialized, leading to crashes.

Solution:
========
Force the mysql handle manager to initialize/start before the binlog
background thread is created.

Reviewed By:
============
Andrei Elkin <andrei.elkin@mariadb.com>
2022-04-25 08:07:17 -06:00
Andrei
1bcdc3e9eb MDEV-27697 slave must recognize incomplete replication event group
In cases of a faulty master or an incorrect binlog event producer, that slave is working with,
sends an incomplete group of events slave must react with an error to not to log
into the relay-log any new events that do not belong to the incomplete group.

Fixed with extending received event properties check when slave connects to master
in gtid mode.
Specifically for the event that can be a part of a group its relay-logging is
permitted only when its position within the group is validated.
Otherwise slave IO thread stops with ER_SLAVE_RELAY_LOG_WRITE_FAILURE.
2022-04-25 16:00:35 +03:00
Marko Mäkelä
1a66e3f861 Skip main.sp-no-valgrind WITH_MSAN due to result diff 2022-04-25 14:36:00 +03:00
Marko Mäkelä
b208030ef5 MDEV-11415 merge fixup: Remove a redundant call
In merge commit 921c5e9314 the call
log_free_check() was accidentally duplicated, causing a small
performance regression on INSERT.
2022-04-25 14:14:02 +03:00
Alexander Barkov
907e4c62ce MDEV-21037 mariabackup does not detect multi-source replication slave 2022-04-25 15:00:09 +04:00
Marko Mäkelä
cba13079da Remove redundant innodb-page_compression_ tests
These were replaced with innodb.innodb_page_compressed
in commit 35095c458b
2022-04-25 10:42:57 +03:00
Marko Mäkelä
35095c458b Clean up the page_compressed tests
It suffices to test compression with one record. Restarting the
server is not really needed; we are exercising the log based recovery
in other tests, such as mariabackup.page_compression_level.
2022-04-25 10:19:12 +03:00
Marko Mäkelä
4faef6e240 Cleanup: Remove IF_VALGRIND
The purpose of the compress() wrapper my_compress_buffer() was twofold:
silence Valgrind warnings about uninitialized memory access before
zlib 1.2.4, and have PERFORMANCE_SCHEMA instrumentation of some zlib
related memory allocation. Because of PERFORMANCE_SCHEMA, we cannot
trivially replace my_compress_buffer() with compress().

az_open(): Remove a crc32() call. Any CRC of the empty string is 0.
2022-04-25 09:40:40 +03:00
Marko Mäkelä
232af0c7bf Do not disable --symbolic-links on Valgrind (or MSAN)
The option --symbolic-links was originally disabled by default under
Purify (and later Valgrind) in 51156c5af2
without any explanation.
2022-04-25 09:36:30 +03:00
Alexander Barkov
3fec38d91d MDEV-28405 main.information_schema_tables fails sporadically with ER_NEED_REPREPARE or extra warning 2022-04-25 09:08:09 +04:00
Nayuta Yanagisawa
3b6c04f44c MDEV-27065 fixup: disable tests under valgrind
The server behaves differently on the DATA/INDEX DIRECTORY clause
under valgrind because symlink is disabled under valgrind.
2022-04-24 16:19:52 +09:00