Commit graph

195886 commits

Author SHA1 Message Date
Sergei Golubchik
fa6d7e4e98 compilation error
extended initializers are only allowed since c++11
2022-10-01 17:45:23 +02:00
Sergei Golubchik
2ab52cc0e5 update the test after merge
after d7d3ad698a debug_sync waits are no longer interrupted by
soft kills that server shutdown is using. Luckily in this test
there's no need to wait, it wants the commit to be properly completed,
fully committed in both engines.
2022-09-30 17:27:38 +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
Sergei Golubchik
194cc36805 Merge branch '10.5' into 10.6 2022-09-30 12:29:24 +02: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
Marko Mäkelä
e29fb95614 Cleanup: Remove innobase_destroy_background_thd()
We do not need a non-inline wrapper for the function
destroy_background_thd().
2022-09-30 08:25:00 +03:00
Sergei Golubchik
6b685ea7b0 correctness assert
thd_get_ha_data() can be used without a lock, but only from the
current thd thread, when calling from anoher thread it *must*
be protected by thd->LOCK_thd_data

* fix group commit code to take thd->LOCK_thd_data
* remove innobase_close_connection() from the innodb background thread,
  it's not needed after 87775402cd and was failing the assert with
  current_thd==0
2022-09-29 10:44:39 +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
Sergei Golubchik
de130323b4 MDEV-29368 Assertion `trx->mysql_thd == thd' failed in innobase_kill_query from process_timers/timer_handler and use-after-poison in innobase_kill_query
This is a 10.5 version of 9b750dcbd8, fix for
MDEV-23536 Race condition between KILL and transaction commit

InnoDB needs to remove trx from thd before destroying it (trx), otherwise
a concurrent KILL might get a pointer from thd to a destroyed trx.

ha_close_connection() should allow engines to clear ha_data in
hton->on close_connection(). To prevent the engine from being unloaded
while hton->close_connection() is running, we remove the lock from
ha_data and unlock the plugin manually.
2022-09-29 00:11:02 +02:00
Sergei Golubchik
74ac683a7e cleanup: kill test
split it into debug and non-debug tests
2022-09-29 00:11:02 +02:00
Sergei Golubchik
d7d3ad698a debug_sync: ignore "sort" kills and disconnects
only "hard" kills will now interrupt debug_sync waits.
this is needed to have debug_sync points that work during disconnect
2022-09-29 00:11:02 +02: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
Daniel Black
620d520d68
MDEV-29614 mariadb-upgrade calls mysql and mysql-check (#2279)
rather than mariadb/mariadb-check
2022-09-28 15:20:23 +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
Marko Mäkelä
8833c24c61 Revert MDEV-29566
This reverts commit bdc5548cad
that introduced a work-around to ha_innobase::delete_table()
for avoiding failures when trying to remove table partitions.

This work-around (of not removing statistics in case of a locking
conflict) would occasionally cause a failure of the test
parts.part_supported_sql_func_innodb:

mysqltest: In included file "./suite/parts/inc/partition_supported_sql_funcs.inc":
included from ./suite/parts/inc/part_supported_sql_funcs_main.inc at line 91:
included from /buildbot/amd64-ubuntu-2004-msan/build/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test at line 44:
At line 234: query 'alter table t66
reorganize partition s1 into
(partition p0 values less than ($valsqlfunc),
partition p1 values less than maxvalue)' failed: ER_DUP_KEY (1022): Can't write; duplicate key in table 'mysql.innodb_table_stats'
2022-09-27 10:30:49 +03:00
Lena Startseva
a9962580ab MDEV-27691: make working view-protocol
Update tests for version 10.6
2022-09-27 13:18:28 +07:00
Lena Startseva
f8f25b472e Merge branch 'bb-10.5-all-builders' into bb-10.6-all-builders 2022-09-27 13:17:59 +07: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ä
bdc5548cad MDEV-29566 Failed to read from the .par file upon concurrent DDL/SELECT with partition pruning
ha_innobase::delete_table(): If locking the InnoDB persistent statistics
tables mysql.innodb_table_stats or mysql.innodb_index_stats fails for
a table partition, proceed to drop the partition. On DROP TABLE of a
partitioned table, each partition is being dropped in a separate
InnoDB DDL transaction. The only practical way to create an illusion of
atomicity is to avoid failures.
2022-09-26 15:23:29 +03:00
Marko Mäkelä
e3fdabd501 MDEV-29613 fixup: clang -Wunused-but-set-variable 2022-09-26 15:16:51 +03:00
Marko Mäkelä
829e8111c7 Merge 10.5 into 10.6 2022-09-26 14:34:43 +03:00
Marko Mäkelä
fe7c95ec78 Cleanup: Declare srv_shutdown_bg_undo_sources() static 2022-09-26 13:45:53 +03:00
Marko Mäkelä
6286a05d80 Merge 10.4 into 10.5 2022-09-26 13:34:38 +03:00
Sergei Golubchik
70701ee4b1 update C/C, fix srpm build failures on fedora
krb5-config (used by FindGSSAPI) returns `-lkrb5 -lk5crypto -lcom_err`
but only libkrb5 is actually used by the gssapi plugin. The other two
result in unneeded dependencies unless they're tagged optional when
linked with --as-needed.

Some distributions use --as-needed automatically, which causes our
builds to differ from srpm builds, introducing failures in buildbot.

Let's always use --as-needed for gssapi plugin
2022-09-26 11:17:53 +02:00
Sergei Golubchik
3dd03a2334 MDEV-29347 MariaDB 10.6.8 fails to start when ONLY_FULL_GROUP_BY gets provided 2022-09-26 11:17:53 +02:00
Anel
b3e06ce3fd
MDEV-28533: CONNECT engine does not quote columns involved in WHERE clause (#2263) 2022-09-26 07:53:43 +01:00
Lena Startseva
2abf499c76 MDEV-27691: make working view-protocol
Update tests for version 10.5
2022-09-26 10:25:41 +07:00
Lena Startseva
d444536e1d Merge branch 'bb-10.4-all-builders' into bb-10.5-all-builders 2022-09-26 10:24:59 +07: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
Thirunarayanan Balathandayuthapani
673243c893 MDEV-29277 On error, fts_sync_table() fails to release a table handle
fts_sync_commit() fails to release the auxiliary table handle
when it encounters error. This issue is caused by
commit 1fd7d3a9adac50de37e40e92188077e3515de505(MDEV-25581).
fts_cache_clear() releases the auxiliary table handles.
MDEV-25581's patch clear the cache only if fts_sync_commit was
successful.
2022-09-23 11:42:00 +05:30
Jan Lindström
db7e04ed3a MDEV-28868 : wsrep_incoming_address status variable prints 0 as port number if the port is not mentioned in wsrep_node_incoming_address system variable
Problem was that mysqld_port is not set on set_ports() because
it will be executed later. Fix is naturally fall back to
MYSQL_PORT.
2022-09-22 13:48:03 +03:00
Marko Mäkelä
ce23802c0e MDEV-29600 Memory leak in row_log_table_apply_update()
row_log_table_apply_update(): Free the pcur.old_rec_buf before returning.
It may be allocated by btr_pcur_store_position() inside
btr_blob_log_check_t::check() and btr_store_big_rec_extern_fields().

This memory leak was introduced in
commit 2e814d4702 (MariaDB Server 10.2.2)
via mysql/mysql-server@ce0a1e85e2
(MySQL 5.7.5).
2022-09-22 11:18:00 +03:00
Marko Mäkelä
2d5cfdc570 Cleanup: Remove redundant output from a test 2022-09-22 11:08:17 +03:00
Alexey Botchkov
f5e4e15403 Backport fix for MDEV-29352 to 10.3-10.5
The fix for MDEV-29352 was pushed to 10.6+ but the code causing the
bug is old and the bug is unlikely to be a recent regression in 10.6.
So, we apply the fix also to older versions, 10.3-10.5.

The original commit message:

MDEV-29352 SIGSEGV's in strlen and unknown location on optimized builds at SHUTDOWN

When the UDF creation frails to write the newly created UDF into
the related system table, the UDF is still created in memory.

However, as it is now, the related DLL is unloaded in this case right
in the mysql_create_function. And failure happens when the UDF handle
is freed and tries to unload the respective DLL which is still unloaded.
2022-09-21 22:02:21 +09:00