Commit graph

192070 commits

Author SHA1 Message Date
Marko Mäkelä
4a8da624b5 Groonga: GCC 12.2.0 -Og -Wuse-after-free
This message would always have been invoked on ptr=NULL.
2022-10-07 12:48:38 +03:00
Marko Mäkelä
9fd91863e6 MDEV-29613 fixup: Mroonga -Wunused-function 2022-10-07 12:46:06 +03:00
Aleksey Midenkov
37a86b933e Merge 10.3 into 10.4 2022-10-06 23:37:42 +03:00
Jan Lindström
d099bcadc3 Test results updated. 2022-10-06 13:08:20 +03:00
Jan Lindström
09f7889b5c MDEV-29706 : SIGSEGV in wsrep_TOI_begin on non-Galera builds
Do not allow setting wsrep_on=ON if no provider is set.
2022-10-06 13:08:20 +03:00
Marko Mäkelä
3708bef606 MDEV-27682: Temporarily disable a failing test 2022-10-06 07:40:00 +03:00
Marko Mäkelä
ba9ade47e3 MDEV-29710: Skip main.update_use_source on Valgrind
This test is not slow, but it reliably produces an EXPLAIN difference
(number of rows) on the Valgrind builder. A possible explanation could be
that the purge threads are not being scheduled. Valgrind runs all threads
in a single thread.
2022-10-06 07:38:46 +03:00
Marko Mäkelä
f600690c6b MDEV-29710: Skip some more tests on Valgrind 2022-10-05 20:37:54 +03:00
Marko Mäkelä
65d0c57c1a Merge 10.3 into 10.4 2022-10-05 20:30:57 +03:00
Aleksey Midenkov
074e358213 MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status
upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED

Missed set return status to 1.
2022-10-05 19:53:13 +03:00
Aleksey Midenkov
0779e2cb10 MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
When f.ex. table is partitioned by HASH(a) and we rename column `a' to
`b' partitioning filter stays unchanged: HASH(a). That's the wrong
behavior.

The patch updates partitioning filter in accordance to the new columns
names. That includes partition/subpartition expression and
partition/subpartition field list.
2022-10-05 19:53:13 +03:00
Aleksey Midenkov
4eb8c35b36 MDEV-28576 Ability to manipulate List<const char *>
For "const char *" replace() and after() accepted const as "T *" and
passed forward "void *". This cannot be cast implicitly, so we better
use "const void *" instead of "void *" in the input interface. This
way we avoid problems with using List for any const type.
2022-10-05 19:53:13 +03:00
Vlad Lesin
c0eda62aec MDEV-27927 row_sel_try_search_shortcut_for_mysql() does not latch a page, violating read view isolation
btr_search_guess_on_hash() would only acquire an index page latch if it
is invoked with ahi_latch=NULL. If it's invoked from
row_sel_try_search_shortcut_for_mysql() with ahi_latch!=NULL, a page
will not be latched, and row_search_mvcc() will get a pointer to the
record, which can be changed by some other transaction before the record
was stored in result buffer with row_sel_store_mysql_rec() call.

ahi_latch argument of btr_cur_search_to_nth_level_func() and
btr_pcur_open_with_no_init_func() is used only for
row_sel_try_search_shortcut_for_mysql().
btr_cur_search_to_nth_level_func(..., ahi_latch !=0, ...) is invoked
only from btr_pcur_open_with_no_init_func(..., ahi_latch !=0, ...),
which, in turns, is invoked only from
row_sel_try_search_shortcut_for_mysql().

I suppose that separate case with ahi_latch!=0 was intentionally
implemented to protect row_sel_store_mysql_rec() call in
row_search_mvcc() just after row_sel_try_search_shortcut_for_mysql()
call. After the ahi_latch was moved from row_seach_mvcc() to
row_sel_try_search_shortcut_for_mysql(), there is no need in it at all
if btr_search_guess_on_hash() latches a page unconditionally. And if
btr_search_guess_on_hash() latched the page, any access to the record in
row_sel_try_search_shortcut_for_mysql() after btr_pcur_open_with_no_init()
call will be protected with the page latch.

The fix is to remove ahi_latch argument from
btr_pcur_open_with_no_init_func(), btr_cur_search_to_nth_level_func()
and btr_search_guess_on_hash().

There will not be test, as to test it we need to freeze some SELECT
execution in the point between row_sel_try_search_shortcut_for_mysql()
and row_sel_store_mysql_rec() calls in row_search_mvcc(), and to change
the record in some other transaction to let row_sel_store_mysql_rec() to
store changed record in result buffer. Buf we can't do this with the
fix, as the page will be latched in btr_search_guess_on_hash() call.
2022-10-05 17:35:21 +03:00
Marko Mäkelä
111cbdf3da MDEV-29710: Valgrind tests massively fail due to silently killing server on shutdown timeout
Let us disable Valgrind on tests that would fail because a
server shutdown or a STOP SLAVE command would take longer,
causing the test harness to forcibly and silently kill the server
due to an exceeded timeout.
2022-10-05 15:18:58 +03:00
Marko Mäkelä
e0bcff10ef MDEV-29710: Disable main.log_slow under Valgrind
Under Valgrind, this test may occasionally fail because the sleep-based
timeouts of less than 1 second could be exceeded.
2022-10-05 15:18:44 +03:00
Marko Mäkelä
380e06f84b MDEV-29710: Disable sys_vars.innodb_flush_method_func under Valgrind
The test could emit some I/O error when run under Valgrind.
2022-10-05 15:16:03 +03:00
Marko Mäkelä
c64e2d60a3 MDEV-29710: Disable innodb.table_flags under Valgrind 2022-10-05 15:15:28 +03:00
Marko Mäkelä
df97eb1432 Remove HAVE_SNPRINTF
This fixes up commit 77c184df7c
which explicitly specifies that we use ISO/IEC 9899:1999 (C99),
which includes the snprintf() function.
2022-10-05 10:09:49 +03:00
Marko Mäkelä
1562b2c20b MDEV-29666 InnoDB fails to purge secondary index records when indexed virtual columns exist
row_purge_get_partial(): Replaces trx_undo_rec_get_partial_row().
Also copy the purge_node_t::ref to the purge_node_t::row.
In this way, the clustered index key fields will always be
available, even if thanks to
commit d384ead0f0 (MDEV-14799)
they would no longer be repeated in the remaining part of the
undo log record.
2022-10-05 09:30:33 +03:00
Julius Goryavsky
19f0b96d53 MDEV-27682: bundled wsrep_notify.sh causes mariadbd to freeze during start
This commit adds automation that will reduce the possibility
of user errors when customizing wsrep_notify.sh (in particular
caused by user-specified parameters). Now all leading and trailing
spaces are removed from the user-specified parameters and automatic
port and host address substitution has been added to scripts, as
well as automatic password substitution to the client command line,
only if it is specified in the wsrep_notify.sh and not as empty
strings. Also added support for automatic substitution of the all
SSL-related parameters and improved parsing for ipv6 addresses
(to allow "[...]" notation for ipv6 addresses). Also added a
test to check if the wsrep notify script will works with SSL.
2022-10-04 13:16:17 +02:00
Monty
d1bc469dca Disable valgrind for test in main that takes > 200 seconds
One can run these with --valgrind --big
2022-10-04 11:59:01 +03:00
Vlad Lesin
c0817dac99 MDEV-29575 Access to innodb_trx, innodb_locks and innodb_lock_waits along with detached XA's can cause SIGSEGV
trx->mysql_thd can be zeroed-out between thd_get_thread_id() and
thd_query_safe() calls in fill_trx_row(). trx_disconnect_prepared() zeroes out
trx->mysql_thd. And this can cause null pointer dereferencing in
fill_trx_row().

fill_trx_row() is invoked from fetch_data_into_cache() under trx_sys.mutex.

Bug fix is in reseting trx_t::mysql_thd in trx_disconnect_prepared() under
trx_sys.mutex lock too.

MTR test case can't be created for the fix, as we need to wait for
trx_t::mysql_thd reseting in fill_trx_row() after trx_t::mysql_thd was
checked for null while trx_sys.mutex is held. But trx_t::mysql_thd must be
reset in trx_disconnect_prepared() under trx_sys.mutex. There will be deadlock.
2022-10-03 14:41:06 +03:00
Sergei Golubchik
d4f6d2f08f Merge branch '10.3' into 10.4 2022-10-01 23:07:26 +02:00
Sergei Golubchik
dd8833bff0 cleanup: suppress rocksdb compilation warning, fix a comment 2022-10-01 17:45:23 +02:00
Sergei Golubchik
fa6d7e4e98 compilation error
extended initializers are only allowed since c++11
2022-10-01 17:45:23 +02:00
Alexander Barkov
3744b8ae31 MDEV-20760 Add Type_handler::KEY_pack_flags()
Backporting from 10.5 to 10.4

This is needed to fix MDEV-28727 easier.
2022-09-30 14:56:33 +04:00
Oleksandr Byelkin
f65ba9aeb7 MDEV-17124: mariadb 10.1.34, views and prepared statements: ERROR 1615 (HY000): Prepared statement needs to be re-prepared
The problem is that if table definition cache (TDC) is full of real tables
which are in tables cache, view definition can not stay there so will be
removed by its own underlying tables.
In situation above old mechanism of detection matching definition in PS
and current version always require reprepare and so prevent executing
the PS.

One work around is to increase TDC, other - improve version check for
views/triggers (which is done here). Now in suspicious cases we check:
 - timestamp (microseconds) of the view to be sure that version really
   have changed;
 - time (microseconds) of creation of a trigger related to time
   (microseconds) of statement preparation.
2022-09-30 12:11:37 +02:00
Oleksandr Byelkin
98e62e6317 Better declaration of the buffer size 2022-09-30 12:11:37 +02:00
Alexander Barkov
1118e979c2 MDEV-29672 Add MTR tests covering key and key segment flags and types 2022-09-30 11:08:49 +04:00
Anel Husakovic
1f51d6c0f6 MDEV-28548: ER_TABLEACCESS_DENIED_ERROR is missing information about DB
- Added missing information about database of corresponding table for various types of commands
- Update some typos

- Reviewed by: <vicentiu@mariadb.org>
2022-09-30 08:48:57 +02:00
Sergei Golubchik
f9605eb209 fix sporadic failures on main.kill
KILL QUERY ID 0 was sometimes finding con3 that was still in the process
of disconnecting and had query_id==0 (as it didn't run any queries)
2022-09-29 10:18:50 +02:00
Igor Babaev
28ae361857 MDEV-29361 Infinite recursive calls when detecting CTE dependencies
This patch resolves the problem of improper name resolution of table
references to embedded CTEs for some queries. This improper binding could
lead to
  - infinite sequence of calls of recursive functions
  - crashes due to resolution of null pointers
  - wrong result sets returned by queries
  - bogus error messages

If the definition of a CTE contains with clauses then such CTE is called
embedding CTE while CTEs from the with clauses are called embedded CTEs.
If a table reference used in the definition of an embedded CTE cannot be
resolved within the unit that contains this reference it still may be
resolved against a CTE definition from the with clause with one of the
embedding CTEs.
A table reference can be resolved against a CTE definition if it used in
the the scope of this definition and it refers to the name of the CTE.
Table reference t is in the scope of the CTE definition of CTE cte if
- the definition of cte is an element of a with clause declared as
  RECURSIVE and the reference t belongs either to the unit to which
  this with clause is attached or to one of the elements of this clause
- the definition of cte is an element of a with clause without RECURSIVE
  specifier and the reference t belongs either to the unit to which this
  with clause is attached or to one of the elements from this clause that
  are placed before the definition of cte.
If a table reference can be resolved against several CTE definitions then
it is bound to the most embedded.

The code before this patch not always resolved table references used in
embedded CTE according to the above rules.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
2022-09-28 22:33:05 -07:00
Mikhail Chalov
9de9f105b5
Use memory safe snprintf() in Connect Engine and elsewhere (#2210)
Continue with similar changes as done in 19af1890 to replace sprintf(buf, ...)
with snprintf(buf, sizeof(buf), ...), specifically in the "easy" cases where buf
is allocated with a size known at compile time.

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-09-28 15:45:25 +01:00
Alexey Botchkov
b2cfcf1d1f MDEV-21134 Crash with partitioned table, PARTITION syntax, and index_merge.
When the partition table is cloned, the handlers for the partitions that were not opened
should anyway be created (but not opened).
2022-09-27 15:27:34 +04:00
Oleksandr Byelkin
47e9678982 MDEV-29022 add_slave destroy child list and has dead code
Nowdays subquery in a UNION's ORDER BY placed correctly in fake select,
the only problem was incorrect Name_resolution_contect is fixed by this
patch in parsing, so we do not need scanning/reseting of ORDER BY of
a union.
2022-09-27 09:56:21 +02:00
Nayuta Yanagisawa
2b89598fe0 MDEV-26852 Spider: -Werror=maybe-uninitialized raises on spd_sys_table.cc and ha_spider.cc
The warning "maybe-uninitialized" raises on spd_sys_table.cc and
ha_spider.cc when the sever is compiled with CMAKE_CXX_FLAGS=-Og.
2022-09-26 23:23:13 +09:00
Sergei Golubchik
fa4e84b5d9 cleanup: main.mysqldump test
show error messages from mysqldump/mysqlimport
2022-09-26 15:01:36 +02:00
Sergei Golubchik
88db4e3ea4 wsrep suite isn't run by default, wsrep_info shouldn't either 2022-09-26 15:01:36 +02:00
Sergei Golubchik
4fd096df06 sporadic failures of main.bootstrap
give every bootstrap server its own tmpdir, by default it's var/tmp,
which is shared in --parallel
2022-09-26 15:01:36 +02:00
Andrew Hutchings
59c9e2f202
MDEV-29579 Fix CONNECT ASAN hits (#2277)
There are currently two things causing ASAN hits on CONNECT engine when
the plugin is used as a dynamic module. These are libxml2 and libodbc.

libxml2 has some quirks when not the first and last thing called in the
main thread of an application, some of the global memory isn't cleaned
up correctly. The same is assumed of libodbc but this does not have
explicit API for this.

This is being fixed in two ways.

First we are removing the libxml2 cleanup call. This is because the
current one is messy and whatever it fixed has gone away. But also
because if this is called and libxml2 is used again this can cause
issues. For example if two different plugins to MariaDB both happen to
use libxml2.

The second fix is a hack that exploits `STB_GNU_UNIQUE` so that when
compiled with ASAN the plugin will remain in memory after dlclose().
This allows libodbc to cleanup and has the added advatage that we will
get clean stacks from ASAN for CONNECT when the leak is detected at the
end of execution.

Details of the `STB_GNU_UNIQUE` method can be found here:

https://web.archive.org/web/20100730094324/http://www.redhat.com/archives/posix-c++-wg/2009-August/msg00002.html
2022-09-26 13:59:23 +01:00
Marko Mäkelä
e3fdabd501 MDEV-29613 fixup: clang -Wunused-but-set-variable 2022-09-26 15:16:51 +03:00
Anel
b3e06ce3fd
MDEV-28533: CONNECT engine does not quote columns involved in WHERE clause (#2263) 2022-09-26 07:53:43 +01:00
Marko Mäkelä
3c92050d1c Fix build without either ENABLED_DEBUG_SYNC or DBUG_OFF
There are separate flags DBUG_OFF for disabling the DBUG facility
and ENABLED_DEBUG_SYNC for enabling the DEBUG_SYNC facility.
Let us allow debug builds without DEBUG_SYNC.

Note: For CMAKE_BUILD_TYPE=Debug, CMakeLists.txt will continue to
define ENABLED_DEBUG_SYNC.
2022-09-23 17:37:52 +03:00
Andrew Hutchings
66cd1c33f7
MDEV-25767 Fix CONNECT ODBC WHERE condition crash (#2243)
When an UPDATE or DELETE was executed with a WHERE condition it would
crash the MariaDB server. This is because the code expects the WHERE
condition to have generated a query string but it hasn't.

Also updates the ODBC test results for current MariaDB version.
2022-09-23 14:02:41 +01:00
Lena Startseva
184e65954b MDEV-27691: make working view-protocol
Update tests for version 10.4
2022-09-23 19:47:30 +07:00
Lena Startseva
78dcf71e88 Merge branch 'bb-10.3-all-builders' into bb-10.4-all-builders 2022-09-23 19:47:13 +07:00
Marko Mäkelä
13eae1885e Merge 10.3 into 10.4 2022-09-23 13:47:15 +03:00
Marko Mäkelä
a69cf6f07e MDEV-29613 Improve WITH_DBUG_TRACE=OFF
In commit 28325b0863
a compile-time option was introduced to disable the macros
DBUG_ENTER and DBUG_RETURN or DBUG_VOID_RETURN.

The parameter name WITH_DBUG_TRACE would hint that it also
covers DBUG_PRINT statements. Let us do that: WITH_DBUG_TRACE=OFF
shall disable DBUG_PRINT() as well.

A few InnoDB recovery tests used to check that some output from
DBUG_PRINT("ib_log", ...) is present. We can live without those checks.

Reviewed by: Vladislav Vaintroub
2022-09-23 13:40:42 +03:00
Lena Startseva
72ba96a48e MDEV-27691: make working view-protocol
Tests with checking metadata or that cannot be run with
the view-protocol are excluded from --view-protocol.
For tests that do not allow the use of an additional connection,
the util connection is disabled with "--disable_service_connection".
Also cases with bugs for --view-protocol are disabled.
2022-09-23 17:36:20 +07:00
Oleksandr Byelkin
1dd6255ffe MDEV-27691: prequisite enable/disable service connection 2022-09-23 17:36:08 +07:00