Commit graph

201,571 commits

Author SHA1 Message Date
Raghunandan Bhat
2c7cea28da MDEV-31721: Cursor protocol increases the counter of "Empty_queries" for select
Problem:
  Empty queries are incremented if no rows are sent to the client in the
  EXECUTE phase of select query. With cursor protocol, rows are not sent
  during EXECUTE phase; they are sent later in FETCH phase. Hence,
  queries executed with cursor protocol are always falsely treated as
  empty in EXECUTE phase.

Fix:
  For cursor protocol, empty queries are now counted during the FETCH
  phase. This ensures counter correctly reflects whether any rows were
  actually sent to the client.

Tests included in `mysql-test/main/show.test`.
2025-06-27 22:04:14 +05:30
Aleksey Midenkov
7ab205b009 MDEV-34928 CREATE TABLE does not check valid engine for log tables
Log tables cannot work with transactional InnoDB or Aria, that is
checked by ALTER TABLE for ER_UNSUPORTED_LOG_ENGINE. But it was
possible to circumvent this check with CREATE TABLE. The patch makes
the check of supported engine common for ALTER TABLE and CREATE TABLE.
2025-06-25 14:14:50 +03:00
Aleksey Midenkov
1dedd2a3b9 Refactoring: check_log_table() split 2025-06-25 14:14:50 +03:00
Aleksey Midenkov
6a6709dbea check_if_log_table() cleanup
Use constant global variables instead of string literals.
2025-06-25 14:14:50 +03:00
Daniel Black
773d2d1960 MDEV-36738: mariadb@.service incorrectly changing pam ownership in mariadb-install-db
It was mysql_install_db, and this is changed to mariadb-install-db.
likewise changed all of the support-files references to
mysql_install_db.

This install script is part of the service as a useful instigation
step, and a no-op in subseqeuent runs.

This script does however change the auth_pam_tool_dir ownership.
When running a multi-instance based on username, changing the
auth_pam_tool_dir will only cause troubles for the other users.

If you are running multiple instances on username is seems you
are unlikely do be having pam access for all users. Even
if you where the solution on auth_pam_tool_dir would be a group
permission and group access based on the users.

As such skip the changing of ownership.
2025-06-25 20:54:22 +10:00
mariadb-DebarunBanerjee
0680e31737 MDEV-36959 Deadlock does not rollback transaction fully
A deadlock forces the on going transaction to rollback implicitly.
Within a transaction block, started with START TRANSACTION / BEGIN,
implicit rollback doesn't reset OPTION_BEGIN flag. It results in a
new implicit transaction to start when the next statement is executed.
This behaviour is unexpected and should be fixed. However, we should
note that there is no issue with rollback.

We fix the issue to keep the behaviour of implicit rollback (deadlock)
similar to explicit COMMIT and ROLLBACK i.e. the next statement after
deadlock error is not going to start a transaction block implicitly
unless autocommit is set to zero.
2025-06-24 13:34:27 +05:30
Marko Mäkelä
a87bb96ecb MDEV-36234: Add innodb_linux_aio
This controls which linux implementation to use for
innodb_use_native_aio=ON.

innodb_linux_aio=auto is equivalent to innodb_linux_aio=io_uring when
it is available, and falling back to innodb_linux_aio=aio when not.

Debian packaging is no longer aio exclusive or uring, so
for those older Debian or Ubuntu releases, its a remove_uring directive.
For more recent releases, add mandatory liburing for consistent packaging.

WITH_LIBAIO is now an independent option from WITH_URING.

LINUX_NATIVE_AIO preprocessor constant is renamed to HAVE_LIBAIO,
analogous to existing HAVE_URING.

tpool::is_aio_supported(): A common feature check.

is_linux_native_aio_supported(): Remove. This had originally been added in
mysql/mysql-server@0da310b69d in 2012
to fix an issue where io_submit() on CentOS 5.5 would return EINVAL
for a /tmp/#sql*.ibd file associated with CREATE TEMPORARY TABLE.
But, starting with commit 2e814d4702 InnoDB
temporary tables will be written to innodb_temp_data_file_path.
The 2012 commit said that the error could occur on "old kernels".
Any GNU/Linux distribution that we currently support should be based
on a newer Linux kernel; for example, Red Hat Enterprise Linux 7
was released in 2014.

tpool::create_linux_aio(): Wraps the Linux implementations:
create_libaio() and create_liburing(), each defined in separate
compilation units (aio_linux.cc, aio_libaio.cc, aio_liburing.cc).

The CMake definitions are simplified using target_sources() and
target_compile_definitions(), all available since CMake 2.8.12.
With this change, there is no need to include ${CMAKE_SOURCE_DIR}/tpool
or add TPOOL_DEFINES flags anymore, target_link_libraries(lib tpool)
does all that.

This is joint work with Daniel Black and Vladislav Vaintroub.
2025-06-23 13:51:52 +03:00
Daniel Black
107d1ef2c0 MDEV-37033 UBSAN: row_log_table_apply_ops runtime error: applying non-zero offset 1048576 to null pointer
In a UBSAN debug build, the comparisons with next_mrec_end are made
with index->online_log's head/tail members' block ptr with a sort buffer
size offset (1048576).

The logic that flows though to this point means that even srv_sort_buf_size
above a null pointer wouldn't contain the value of next_mrec_end.

As such this is a UBSAN type fix where we first check if the
head.block / tail.block is null before doing the asserts around
this debug condition. This would be required for the assertions
conditions not to segfault anyway.
2025-06-23 17:25:45 +10:00
Marko Mäkelä
32128ab656 MDEV-37049 my_assume_aligned assertion in mariabackup
log_hdr_buf: Align to an 8-byte boundary, because we will actually
assume at least 4-byte alignment in log_crypt_write_header().

This fixes a regression that had been introduced in
commit 685d958e38 (MDEV-14425)
where a 512-byte alignment requirement was relaxed too much.
2025-06-23 08:38:56 +03:00
Thirunarayanan Balathandayuthapani
2d1e019f4f MDEV-36871 mariadb-backup incremental segfault querying mariadb_backup_history
Problem:
=========
(1) Mariabackup tries to read the history data from
mysql.mariadb_backup_history and fails with segfault. Reason is that
mariabackup does force innodb_log_checkpoint_now from commit 652f33e0a44661d6093993d49d3e83d770904413(MDEV-30000).
Mariabackup sends the "innodb_log_checkpoint_now=1" query to server and
reads the result set for the query later in the code because the query
may trigger the page thread to flush the pages. But before reading the
query result for innodb_log_checkpoint_now=1, mariabackup does execute
the select query for the history table (mysql.mariadb_backup_history)
and wrongly reads the query result of innodb_log_checkpoint_now. This leads
to assertion in mariabackup.

(2) The recording of incremental backups has the format as "tar"
when mbstream was used. The xb_stream_fmt_t only had XB_STREAM_FMT_NONE
and XB_STREAM_FMT_XBSTREAM and hence in the mysql.mariadb_backup_history
table the format was recorded as "tar" for the "mbstream" due to the
offset in the xb_stream_name array within mariadb-backup.

(3) Also under Windows the full path of mariabackup was recorded in the the
history.

(4) select_incremental_lsn_from_history(): Name of the backup and UUID
of the history record variable could lead to buffer overflow while
copying the variable value from global variable.

Solution:
=========
(1) Move the reading of history data from mysql.mariadb_backup_history
after reading the result of innodb_log_checkpoint_now=1 query

(2) We've removed the "tar" element from the xb_stream_name. As the
"xbstream" was never used, the format name is changed to mbstream.
As the table needs alteration the "mbstream" appended instead of
the unused xbstream in the table. "tar" is left in the enum as
the previous recordings are still possible.

(3) The Windows path separator is used to store just the executable
name as the tool in the mariadb_backup_history table.

(4) select_incremental_lsn_from_history(): Check and validate
the length of incremental history name and incremental history uuid
before copying into temporary buffer

Thanks to Daniel black for contributing the code for solution (2) and (3)
2025-06-23 10:26:43 +10:00
Brad Smith
0931617244 Enable CMake CRC32 / CRYPTO tests for aarch64 with Clang 2025-06-23 09:32:31 +10:00
bsrikanth-mariadb
ec495bffe9 MDEV-36215: Avoid wrong result due to table elimination
There was a Wrong result due to Table Elimination
when 'unique_col IS NULL' condition is supplied in the left-join query.

An index on an unique_col was created for the table, and it
is being used in the plan.
As the query was a left join, no fields from the right table were
projected. The right table was getting wrongly eliminated although
multiple rows from the right could be matched to a single row from the
left with the condition `unique_col IS NULL'.

This PR addresses the problem by including an additional check before
eliminating a table in check_equality() function of opt_table_elimination.cc
2025-06-13 22:54:09 -04:00
Thirunarayanan Balathandayuthapani
4f7faa4bc8 MDEV-36650 Unexpected checkpoint in the test innodb.doublewrite
innodb.doublewrite: Skip the test case if we get an unexpected
checkpoint. This could happen because page cleaner thread
could be active after reading the initial checkpoint information.
2025-06-18 18:36:45 +05:30
Daniel Black
3944655357 MDEV-37019 MSAN_STAT_WORKAROUND macro remove
MSAN has been updated since 2022 when this macro was added
and as such the working around MSAN's deficient understanding
of the fstat/stat syscall behaviour at the time is no longer
required.

As an effective no-op a straight removal is sufficient.
2025-06-18 16:46:21 +10:00
Thirunarayanan Balathandayuthapani
4be442ec35 MDEV-36962 innodb.log_file_overwrite fails with ASAN
Problem:
=======
- InnoDB unpoisons the freed page memory to make sure that
no other thread uses this freed page. In buf_pool_t::close(),
InnoDB unmap() the buffer pool memory during shutdown or it
encountered during startup. Later at some point, server
re-uses the same virtual address using mmap() and writes into
memory region. This leads to use_after_poison error.

This issue doesn't happen in latest clang and gcc version.
Older version of clang and gcc can still fail with this error.
ASAN should unpoison the memory while reusing the same virtual
address. This issue was already raised in
https://github.com/google/sanitizers/issues/1705

Fix:
===
In order to avoid this failure, let's unpoison the buffer
pool memory explictly during buf_pool_t::close() for
lesser than gcc-14 and clang-18 version.
2025-06-18 15:31:28 +10:00
Kazuhiko Shiozaki
39ef6c0dc8 MDEV-34425 mroonga files are not copied by mariabackup
Backing up with mariabackup a datadir containing
ENGINE=Mroonga tables leaves behind the corresponding
*.mrn* files. Those tables are therefore broken once
such backup is restored.

minor style/mtr changes by Daniel Black
2025-06-18 10:23:47 +10:00
Svante Signell
72d2b7697d MDEV-12305 FTBFS on hurd-i386 due to PATH_MAX
Hurd doesn't create PATH_MAX due its dogmatic standard
approach.

ref: https://www.gnu.org/software/hurd/hurd/porting/guidelines.html#PATH_MAX_tt_MAX_PATH_tt_MAXPATHL

Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1069094
2025-06-18 09:11:28 +10:00
Daniel Black
22afd13e7a Debian/Hurd doesn't support auth_socket
Hurd doesn't have the mechanism to identify the user connecting to
a socket via a system call as MDEV-8535 highlighted. As such it
can't be supported so we disable it in Debian's mysql_release profile.

Hurd string from uname -m, "SYSTEM processor: i686-AT386" in mariadb
output. And wiki reference https://en.wikipedia.org/wiki/Uname

Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1006531
2025-06-18 09:11:28 +10:00
Svante Signell
b490240263 Bug#1069094: mariadb: FTBFS on hurd-i386
Add Hurd to define __USE_FILE_OFFSET64 et al.

Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1069094
Forwarded: no
2025-06-18 09:11:28 +10:00
Aleksey Midenkov
629b8d782c MDEV-36662 CHECK constraint does not repeat in case of error
CHECK constraint uses caching items and the value is cached even in
case of error. At the second execution the cached value is taken and
the error is not thrown. The fix does not cache value in case error
was thrown during value retrieval.
2025-06-16 17:42:29 +03:00
Brad Smith
f66cd044d5 Enable use of elf_aux_info() to detect CPU features on aarch64 and powerpc64 2025-06-14 17:39:01 +10:00
Rex Johnston
729b27d390 MDEV-29300 Assertion `*ref && (*ref)->fixed()' failed in Item_field::fix_outer_field on SELECT
This issue arises when we have an outer reference resolved in another outer reference
where that outer reference is resolved in a outer select that is a grouping select.
Under these circumstances, the intermediate item is wrapped in an Item_outer_ref and
fixing is deferred later until fix_inner_refs.  As this item wrapper isn't fixed
we fail this assertion.  The fix here is to resolve the item at the lowest level
to the item inside the wrapper, which is fixed.  This item can then get it's
own wrapper pointing to the ultimate resolution of this item.

Approved by Sanja Byelkin (sanja@mariadb.com) 2025-06-13
2025-06-14 06:32:34 +11:00
Raghunandan Bhat
7ba32f3ac8 MDEV-24588, 36851 followup: Fix derived, hybrid func test for --view-protocol 2025-06-13 14:36:10 +05:30
Brad Smith
fadfd9ea28 MDEV-37001 Enable building RocksDB on non-Linux aarch64 OSes
Now that RocksDB has been synced up to 6.29 which includes the changes
mentioned in the CMake comment support for building on non-Linux aarch64
OSes can be enabled.
2025-06-13 15:39:30 +10:00
Brad Smith
6d684b64d5 Rocksdb: Add missing getauxval() test for Linux 2025-06-13 14:08:22 +10:00
Aleksey Midenkov
f1f9284181 MDEV-34046 Parameterized PS converts error to warning, causes
replication problems

DELETE HISTORY did not process parameterized PS properly as the
history expression was checked on prepare stage when the parameters
was not yet substituted. In that case check_units() succeeded as there
is no invalid type: Item_param has type_handler_null which is
inherited from string type and this is valid type for history
expression. The warning was thrown when the expression was evaluated
for comparison on delete execution (when the parameter was already
substituted).

The fix postpones check_units() until the first PS execution. We have
to postpone where conditions processing until the first execution and
update select_lex.where on every execution as it is reset to the state
after prepare.
2025-06-12 14:52:00 +03:00
raghunandanbhat
bff9b1e472 MDEV-36851: COALESCE() returns nullable column while IFNULL() does not
Nullability is decided in two stages-

1. Based on argument NULL-ness

Problem:
- COALESCE currently uses a generic logic- "Result of a function
  is nullable if any of the arguments is nullable", which is wrong.
- IFNULL sets nullability using second argument alone, which incorrectly
  sets the result to NULL even when first argument is not null.

Fix:
- Result of COALESCE and IFNULL is set to NULL only if all arguments are
  NULL.

2. Based on type conversion safety of fallback value

Problem:
- The generic `Item_hybrid_func_fix_attributes` logic would mark the
  function's result as nullable if any argument involved a type
  conversion that could yield NULL.

Fix:
- For COALESCE and IFNULL, nullability is set to NOT NULL if the first
  non-null argument can be safely converted to function's target return
  type.
- For other functions, if any argument's conversion to target type could
  result in NULL, the function is marked nullable.

Tests included in `mysql-test/main/func_hybrid_type.test`
2025-06-12 16:58:52 +05:30
Lena Startseva
c427618462 MDEV-36977: Histogram code lacks coverage for non-latin characters
Added new testcases for histogram:
- 3-byte characters
- characters outside Basic Multilingual Plane
2025-06-11 15:28:37 +07:00
Vladislav Vaintroub
dd2982dc33 MDEV-30831 Cannot compile AWS KMS Plugin
Fix AWS SDK build, it has changed substantionally since the plugin was
introduced. There is now a bunch of intermediate C libraries, aws-cpp-crt
and others, and for static linking, the link dependency must be declared.

Also support AWS C++ SDK in vcpkg package manager.
2025-06-10 15:18:28 +02:00
Vladislav Vaintroub
5729d89cd5 MDEV-36938 Fix MSI install failure when ADDLOCAL omits required runtime
Since 10.11.12 (commit 8363d05f4d), executables are built with
the dynamic C runtime (/MD), introducing a dependency on
vcruntime140.dll.
VC++ runtime is typically installed via the VCCRT feature, which is
included by default as part of the hidden/default ALWAYSINSTALL feature
set. However, when users specify the ADDLOCAL property, it overrides the
default selection and may omit critical features like VCCRT. This leads to
installation failures.

Fix: Add a custom action that ensures mandatory features (e.g., VCCRT)
are appended to the ADDLOCAL property at install time. This guarantees
essential runtime components are always installed, even when a custom
feature set is selected.
2025-06-10 14:23:31 +02:00
Sergei Petrunia
5a6732983d MDEV-36461, followup: fix opt_trace.test for --view-protocol 2025-06-09 21:54:32 +03:00
Sergei Petrunia
cce76e7225 MDEV-36765: followup 4: Fixups to previous fixes
- Add a testcase showing JSON_HB histograms handle multi-byte characters
  correctly.
- Make Item_func_json_unquote::val_str() handle situation where
  it is reading non-UTF8 "JSON" and transcoding it into UTF-8.
  (the JSON spec only allows UTF8 but MariaDB's implementation
   supports non-UTF8 as well)
- Make Item_func_json_search::compare_json_value_wild() handle
  json_unescape()'s return values in the same way its done in other
  places.
- Coding style fixes.
2025-06-09 21:15:30 +03:00
Daniel Black
12c10712a7 MDEV-36765: followup 3: json_unquote/compare_json_str_basic handle errors from json_unescape
Using report_json_error was incorrect as errors
in the je have already been handled earlier in the
json function.

The errors related to json_unescape are handled with
consistently with other functions.
2025-06-09 21:15:30 +03:00
Daniel Black
2b24ed87f0 MDEV-36765: followup 2: st_append_json: handle json_unescape error
Now pushes the OUTOFMEMORY error and ER_JSON_BAD_CHAR as a warning
if these resulted in those errors.

callers only expected a bool so the prototype was changed.

Json_engine_scan::check_and_get_value_scalar failed to handle the error
condition so set the *error if an error occured and return the correct
value.
2025-06-09 21:15:30 +03:00
Daniel Black
0dd758e5f9 MDEV-36765, followup 1: acl: handle json_unescape errors without crashing
json_unescape can return negative numbers, and with
so we should free the buffer allocated.

Also handle the NULL value in unsafe_str by not de-referencing
NULL.
2025-06-09 21:15:30 +03:00
Daniel Black
39bb34b9c5 MDEV-36765: JSON Histogram cannot handle >1 byte characters
When json_escape changed[1] to return a -1 in the case of
a character that didn't match the character set, json_unescape_to_string
assumed the -1 meant out of memory and just looped with more
memory.

Problem 1 - json_escape needs to return a different code
so that the different between charset incompatibility and out
of memory needs to occur. This enables json_escape_to_string
to handle the it correctly (ignore and fail seems the best
option).

Problem 2 - JSON histograms need to support character with
where the column json min/maximum value aren't a character
set represented by a single byte.

Problem 2 was previously hidden as ? was a result of the conversion.

As JSON histograms can relate to columns when have an explict
character set, use that and fall back to bin which was the
previous default for non-string columns.

Replaces -1/-2 constants and handling with JSON_ERROR_ILLEGAL_SYMBOL /
JSON_ERROR_OUT_OF_SPACE defines.

[1] regression from: f699010c0f
2025-06-09 21:15:30 +03:00
Yuchen Pei
11d1ac7285
MDEV-35856 Remove error code introduced to 10.11 in MDEV-36032
Two new error codes ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS and
ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS were introduced in MDEV-36032 in
both 10.11 and, as part of MDEV-22491, 12.0. Here we remove them from
10.11, but they should remain in 12.0.
2025-06-05 11:07:18 +10:00
Oleksandr Byelkin
28d6530571 Merge branch '10.6' into 10.11 2025-06-04 14:09:23 +02:00
Raghunandan Bhat
e7aaf29e00 MDEV-24588: Fix crash with unnamed column in derived table
MariaDB server crashes when a query includes a derived table
containing unnamed column (eg: `SELECT '' from t`). When `Item`
object representing such unnamed column was checked for valid,
non-empty name in `TABLE_LIST::create_field_translation`, the
server crahsed(assertion `item->name.str && item->name.str[0]`
failed).

This fix removes the redundant assertion. The assert was a strict
debug guard that's no longer needed because the code safely handles
empty strings without it.

Selecting `''` from a derived table caused `item->name.str`
to be an empty string. While the pointer itself wasn't `NULL`
(`item->name.str` is `true`), its first character (`item->name.str[0]`)
was null terminator, which evaluates to `false` and eventually made
the assert fail. The code immediately after the assert can safely
handle empty strings and the assert was guarding against something
which the code can already handle.

Includes `mysql-test/main/derived.test` to verify the fix.
2025-06-03 23:03:39 +05:30
Aleksey Midenkov
5ff01ad7bb MDEV-33370 Assertion `!is_set() || (m_status == DA_OK_BULK &&
is_bulk_op())' failed after ALTER TABLE of versioned table

Missed error code resulted in my_ok() at higher frame which failed on
assertion for m_status in state of error.
2025-06-03 11:27:45 +03:00
Brad Smith
6409e43177 Replace deprecated CMAKE_COMPILER_IS_GNU(CC|CXX) with CMAKE_(C|CXX)_COMPILER_ID
As of CMake 3.24 CMAKE_COMPILER_IS_GNU(CC|CXX) are deprecated and should
be replaced with CMAKE_(C|CXX)_COMPILER_ID which were introduced with
CMake 2.6.
2025-06-03 18:16:35 +10:00
Daniel Black
5cd982c51b MDEV-34863 RAM Usage Changed Significantly Between 10.11 Releases (postfix)
Correct error message to use the correct system variable name
- innodb_buffer_pool_size_auto_min
2025-06-03 15:02:18 +10:00
Monty
643319a7fb MDEV-36465 MDEV-33813 Regression, Queries in 'Waiting for someone to free space' state will not automatically retry IO and hang forever
MDEV-33813 caused a regressing in that when a disk got full when
writing to a MyISAM or Aria table the MariaDB connection would, instead
of doing a retry after 60 seconds, hang until the query was killed.

Fixed by changing mysql_coind_wait() top mysql_cond_timedwait()

Author: Thomas Stangner
2025-06-02 14:02:53 +03:00
Monty
0a91bbdc41 Get debug version to compile with gcc 7.5.0 2025-06-02 14:02:53 +03:00
Monty
ce4f83e6b9 MDEV-29157 SELECT using ror_merged scan fails with s3 tables
handler::clone() call did not work with read only tables like S3.
It gave a wrong error message (out of memory instead of a permission
error) and aborted the query.

The issue was that the clone call had a wrong parameter to ha_open().
This now fixed. I also changed the clone call to provide the correct
error message if things fails.

This patch fixes an 'out of memory' error when using the S3 engine
for queries that could use multiple indexes together to find the matching
rows, like the following:
SELECT * FROM t1 WHERE key1 = 99 OR key2 = 2
2025-06-02 14:02:53 +03:00
Monty
5f83b219bb Fixed compiler warning from clang in connect/tabxcl.cpp 2025-06-02 14:02:53 +03:00
Monty
6878c14000 Updated storage/maria/ma_test_big.sh to use aria_ instead of maria_
I also improved the script to use 'tmp' for storing test files instead of
current directory
2025-06-02 14:02:53 +03:00
Monty
22024da64e MDEV-36143 Row event replication with Aria does not honour BLOCK_COMMIT
This commit fixes a bug where Aria tables are used in
(master->slave1->slave2) and a backup is taken on slave2. In this case
it is possible that the replication position in the backup, stored in
mysql.gtid_slave_pos, will be wrong. This will lead to replication
errors if one is trying to use the backup as a new slave.

Analyze:
Replicated row events are committed with trans_commit_stmt() and
thd->transaction->all.ha_list != 0.
This means that backup_commit_lock is not taken for Aria tables,
which means the rows are committed and binary logged on the slave
under BLOCK_COMMIT which should not happen.

This issue does not occur on the master as thd->transaction->all.ha_list
is == 0 under AUTO_COMMIT, which sets 'is_real_trans' and 'rw_trans'
which in turn causes backup_commit_lock to be taken.

Fixed by checking in ha_check_and_coalesce_trx_read_only() if all handlers
supports rollback and if not, then wait for BLOCK_COMMIT also for
statement commit.
2025-06-02 14:02:53 +03:00
Daniel Black
f533333f82 MDEV-34388: Stack overflow on Alpine Linux (postfix) - sanitizers
Remove stack limits for sanitizers. Other tests cover them.
2025-06-02 11:40:39 +02:00
Aleksey Midenkov
fe6a5c2200 MDEV-29155 CREATE OR REPLACE with self-referencing CHECK hangs
forever, cannot be killed

mysql_rm_table_no_locks() does TDC_RT_REMOVE_ALL which waits while
share is closed. The table normally is open only as OPEN_STUB, this is
what parser does for CREATE TABLE. But for SELECT the table is opened
not as a stub. If it is the same table name we anyway have two
TABLE_LIST objects: stub and not stub. So for "not stub"
TDC_RT_REMOVE_ALL sees open count and decides to wait until it is
closed. And it hangs because that was opened in the same thread.

The fix disables subqueries in CHECK expression at parser
level. Thanks to Sergei Golubchik <serg@mariadb.org> for the patch.
2025-05-29 12:34:07 +03:00