Commit graph

2319 commits

Author SHA1 Message Date
Sergei Golubchik
7b53672c63 Merge branch '10.5' into 10.6 2024-05-08 20:06:00 +02:00
Vladislav Vaintroub
029e2a5fd9 MDEV-33876 CMake, zlib - use names compatible with official FindZLIB.cmake
- ZLIB_LIBRARIES, not ZLIB_LIBRARY
- ZLIB_INCLUDE_DIRS, not ZLIB_INCLUDE_DIR

For building libmariadb, ZLIB_LIBRARY/ZLIB_INCLUDE_DIR are still defined
This workaround will be removed later.
2024-05-03 21:48:47 +02:00
Monty
53af3d8c25 Fixed memory leaks in embedded server and mysqltest
This commit fixes the following issues:
- memory leak checking enabled for mysqltest. This cover all cases except
  calls to 'die()' that only happens in case of internal failures in
  mysqltest. die() is not called anymore in the result files differs.
- One can now run mtr --embedded without failures (this crashed or hang
  before)
- cleanup_and_exit() has a new parameter that indicates that it is called
  from die(), in which case we should not do memory leak checks. We now
  always call cleanup_and_exit() instead of exit() to be able to free up
  memory and discover memory leaks.
- Lots of new assert to catch error conditions
- More DBUG statements.
- Fixed that all results are freed in mysqltest (Fixed a memory leak in
  mysqltest when using prepared statements).
- Fixed race condition in do_stmt_close() that caused embedded server
  to not free memory. (Memory leak in mysqltest with embedded server).
- Fixed two memory leaks in embedded server when using prepared statements.
  These memory leaks caused timeout hangs in mtr when server was compiled
  with safemalloc. This issue was not noticed (except as timeouts) as
  memory report checking was done but output of it was disabled.
2024-04-05 12:40:49 +02:00
Monty
33dcf8155b Fixed memory leaks in embedded server and mysqltest
This commit fixes the following issues:
- memory leak checking enabled for mysqltest. This cover all cases except
  calls to 'die()' that only happens in case of internal failures in
  mysqltest. die() is not called anymore in the result files differs.
- One can now run mtr --embedded without failures (this crashed or hang
  before)
- cleanup_and_exit() has a new parameter that indicates that it is called
  from die(), in which case we should not do memory leak checks. We now
  always call cleanup_and_exit() instead of exit() to be able to free up
  memory and discover memory leaks.
- Lots of new assert to catch error conditions
- More DBUG statements.
- Fixed that all results are freed in mysqltest (Fixed a memory leak in
  mysqltest when using prepared statements).
- Fixed race condition in do_stmt_close() that caused embedded server
  to not free memory. (Memory leak in mysqltest with embedded server).
- Fixed two memory leaks in embedded server when using prepared statements.
  These memory leaks caused timeout hangs in mtr when server was compiled
  with safemalloc. This issue was not noticed (except as timeouts) as
  memory report checking was done but output of it was disabled.
2024-03-01 10:15:15 +02:00
Monty
89aae15da2 Fixed crash in connect.misc with embedded server
The problem was that connect tried to recusiverly call
emb_advanced_command(), which was not supported.

Fixed by adding support for recursive calls.
2024-02-27 14:55:47 +02:00
Monty
26c86c39fc Fixed some mtr tests that failed on windows
Most things where wrong in the test suite.
The one thing that was a bug was that table_map_id was in some places
defined as ulong and in other places as ulonglong. On Linux 64 bit this
is not a problem as ulong == ulonglong, but on windows this caused failures.
Fixed by ensuring that all instances of table_map_id are ulonglong.
2024-01-23 13:03:12 +02:00
Sergei Golubchik
3a33ae8601 MDEV-33091 pcre2 headers aren't found on Solaris
use pkg-config to find pcre2, if possible

rename PCRE_INCLUDES to use PKG_CHECK_MODULES naming, PCRE_INCLUDE_DIRS
2024-01-19 20:23:45 +01:00
Yuchen Pei
d06b6de305
Merge branch '10.5' into 10.6 2024-01-11 12:59:22 +11:00
Sergei Golubchik
761d5c8987 MDEV-33092 Undefined reference to concurrency on Solaris
remove thr_setconcurrency()
followup for 8bbcaab160

Fix by Rainer Orth
2024-01-10 10:16:20 +01:00
Sergei Golubchik
e95bba9c58 Merge branch '10.5' into 10.6 2023-12-17 11:20:43 +01:00
Sergei Golubchik
98a39b0c91 Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
Monty
2447172afb Ensure that process "State" is properly cleaned after query execution
In some cases "SHOW PROCESSLIST" could show "Reset for next command"
as State, even if the previous query had finished properly.

Fixed by clearing State after end of command and also setting the State
for the "Connect" command.

Other things:
- Changed usage of 'thd->set_command(COM_SLEEP)' to
  'thd->mark_connection_idle()'.
- Changed thread_state_info() to return "" instead of NULL. This is
  just a safety measurement and in line with the logic of the
  rest of the function.
2023-11-07 10:07:30 +02:00
Alexey Botchkov
f814325105 MDEV-27595 Backport SQL service, introduced by MDEV-19275.
Embedded-server related fixes.
2023-11-05 23:35:32 +04:00
Alexey Botchkov
1fa196a559 MDEV-27595 Backport SQL service, introduced by MDEV-19275.
The SQL SERVICE backported into the 10.4.
2023-11-05 23:35:31 +04:00
Sergei Petrunia
4941ac9192 MDEV-32113: utf8mb3_key_col=utf8mb4_value cannot be used for ref
(Variant#3: Allow cross-charset comparisons, use a special
CHARSET_INFO to create lookup keys. Review input addressed.)

Equalities that compare utf8mb{3,4}_general_ci strings, like:

  WHERE ... utf8mb3_key_col=utf8mb4_value    (MB3-4-CMP)

can now be used to construct ref[const] access and also participate
in multiple-equalities.
This means that utf8mb3_key_col can be used for key-lookups when
compared with an utf8mb4 constant, field or expression using '=' or
'<=>' comparison operators.

This is controlled by optimizer_switch='cset_narrowing=on', which is
OFF by default.

IMPLEMENTATION
Item value comparison in (MB3-4-CMP) is done using utf8mb4_general_ci.
This is valid as any utf8mb3 value is also an utf8mb4 value.

When making index lookup value for utf8mb3_key_col, we do "Charset
Narrowing": characters that are in the Basic Multilingual Plane (=BMP) are
copied as-is, as they can be represented in utf8mb3. Characters that are
outside the BMP cannot be represented in utf8mb3 and are replaced
with U+FFFD, the "Replacement Character".

In utf8mb4_general_ci, the Replacement Character compares as equal to any
character that's not in BMP. Because of this, the constructed lookup value
will find all index records that would be considered equal by the original
condition (MB3-4-CMP).

Approved-by: Monty <monty@mariadb.org>
2023-10-19 17:24:30 +03:00
Marko Mäkelä
60b039a864 Merge 10.5 into 10.6 2023-09-20 08:32:04 +03:00
Monty
8a3a88a758 Fixed compiler failure in lib_sql.cc 2023-09-19 18:41:56 +03:00
Oleksandr Byelkin
6bf8483cac Merge branch '10.5' into 10.6 2023-08-01 15:08:52 +02:00
Oleksandr Byelkin
f52954ef42 Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
Sergei Golubchik
d32fc5b8e0 MDEV-31461 mariadb SIGSEGV when built with -DCLIENT_PLUGIN_DIALOG=STATIC 2023-06-19 12:12:21 +02:00
Marko Mäkelä
bb1d1dc846 Merge 10.5 into 10.6 2023-04-27 09:48:27 +03:00
Marko Mäkelä
902c622215 Merge 10.4 into 10.5 2023-04-27 09:39:53 +03:00
Sergei Petrunia
a72b2c3ffb MDEV-31121: ANALYZE statement produces 0 for all timings in embedded server
Timers require my_timer_init() call.
It was made only in mysqld_main(). Call it also from init_embedded_server().
2023-04-25 13:47:46 +03:00
Marko Mäkelä
5bada1246d Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
Oleksandr Byelkin
ac5a534a4c Merge remote-tracking branch '10.4' into 10.5 2023-03-31 21:32:41 +02:00
Christian Gonzalez
8b0f766c6c Minimize unsafe C functions usage
Replace calls to `sprintf` and `strcpy` by the safer options `snprintf`
and `safe_strcpy` in the following directories:

- libmysqld
- mysys
- sql-common
- strings

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.
2023-03-08 10:36:25 +00:00
Marko Mäkelä
a8a5c8a1b8 Merge 10.5 into 10.6 2022-12-13 16:58:58 +02:00
Marko Mäkelä
1dc2f35598 Merge 10.4 into 10.5 2022-12-13 14:39:18 +02:00
Marko Mäkelä
fdf43b5c78 Merge 10.3 into 10.4 2022-12-13 11:37:33 +02:00
Sergei Golubchik
c7c1461b94 fix embedded startup with no command line arguments
&fake_argv cannot be cast to char***
this causes a crash when resolving
2022-12-02 16:19:13 +01:00
Oleksandr Byelkin
822694bd56 Merge branch '10.5' into 10.6 2022-10-15 23:47:33 +02:00
Marko Mäkelä
66e44afd94 Merge 10.4 into 10.5 2022-10-13 17:05:30 +03:00
Marko Mäkelä
f404911557 Merge 10.3 into 10.4 2022-10-13 16:50:26 +03:00
Marko Mäkelä
1f5615360c Silence clang 13 -Wunused-but-set-variable
WITH_EMBEDDED_SERVER compiles the SQL parsers separately.
Thanks to Vladislav Vaintroub for helping with this.

Fixes up commit e05ab0cfc5
2022-10-13 14:43:35 +03:00
Vladislav Vaintroub
494a75c851 MDEV-28888 : Embedded MariaDB does not build on Windows
Add limited support for building embedded library (DLL only).
2022-07-03 17:11:56 +02:00
Oleksandr Byelkin
f5c5f8e41e Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
Oleksandr Byelkin
cf63eecef4 Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
Sergei Golubchik
66bc8bf09e fix query cache in embedded, enable MARIADB_CLIENT_EXTENDED_METADATA
this fixes plugins.qc_info in --embed

followup for 430d60d1fc MDEV-24487
2022-01-30 18:09:55 +01:00
Sergei Golubchik
9667ec1f53 fix query cache in embedded
this fixes main.partition_cache and main.cache_innodb in --embed

followup for 430d60d1fc MDEV-24487
2022-01-30 13:56:22 +01:00
Oleksandr Byelkin
a576a1cea5 Merge branch '10.3' into 10.4 2022-01-30 09:46:52 +01:00
Oleksandr Byelkin
41a163ac5c Merge branch '10.2' into 10.3 2022-01-29 15:41:05 +01:00
Monty
7045ec27a6 Fixed wrong function call in embedded server
This happens when compiled with HAVE_EMBEDDED_PRIVILEGE_CONTROL.
There is a lot of other problems with the above option that should
be fixed at some point
2022-01-28 16:31:03 +02:00
Vladislav Vaintroub
7acf31783c Add new option NOT_EMBEDDED, for plugins
Means, plugin will not be available in embedded, even if compiled-in
2021-11-09 16:57:27 +02:00
Marko Mäkelä
a49e394399 Merge 10.5 into 10.6 2021-09-30 10:38:44 +03:00
Vladislav Vaintroub
e5a9dcfda2 MDEV-23306 Fix build dependency 2021-09-28 22:26:05 +02:00
Marko Mäkelä
d95361107c Merge 10.5 into 10.6 2021-09-24 14:38:52 +03:00
Marko Mäkelä
7e2b42324c Merge 10.4 into 10.5 2021-09-24 08:42:23 +03:00
Monty
a584117c0c Fixed max length calculation for embedded server
The old code did not take into account unsigned numbers when calculating
max_lengths of fields.
2021-09-21 15:06:22 +03:00
Sergei Golubchik
c8fb911e9c fix main.lock_kill crashes in --ps --embed
when checking whether thd wasn't killed before this
emb_advanced_command(), take into account that it
could've been killed before the *previous*
emb_advanced_command(). That is, the previous one has
already set thd to NULL and this one only wanted a COM_STMT_RESET
after a failure.
2021-06-30 09:34:26 +02:00
Dmitry Shulga
44db6ffc19 MDEV-16708: fixed failure of the test sys_vars.sql_select_limit_func
This test failed in case it was run in PS mode and for embedded server

The reason of test failure was that the following fields
  affected_row, server_status, insert_id
of the structure MYSQL_STMT weren't update on calling
mysql_stmt_next_result() in case combination of binary protocol
and embedded server used.
2021-06-17 19:30:25 +02:00