summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.4 into 10.5Marko Mäkelä2023-02-104-7/+6
|\
| * Apply clang-tidy to remove empty constructors / destructorsVicențiu Ciorbaru2023-02-094-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is the result of running run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' . Code style changes have been done on top. The result of this change leads to the following improvements: 1. Binary size reduction. * For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by ~400kb. * A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb. 2. Compiler can better understand the intent of the code, thus it leads to more optimization possibilities. Additionally it enabled detecting unused variables that had an empty default constructor but not marked so explicitly. Particular change required following this patch in sql/opt_range.cc result_keys, an unused template class Bitmap now correctly issues unused variable warnings. Setting Bitmap template class constructor to default allows the compiler to identify that there are no side-effects when instantiating the class. Previously the compiler could not issue the warning as it assumed Bitmap class (being a template) would not be performing a NO-OP for its default constructor. This prevented the "unused variable warning".
| * Merge branch '10.3' into 10.4Oleksandr Byelkin2023-01-281-0/+38
| |\
* | \ Merge branch '10.4' into 10.5Oleksandr Byelkin2023-01-271-0/+38
|\ \ \
| * \ \ Merge branch '10.3' into 10.4Oleksandr Byelkin2023-01-261-0/+38
| |\ \ \ | | |/ / | |/| / | | |/
| | * Minimize unsafe C functions usage - replace strcat() and strcpy() (and ↵Mikhail Chalov2023-01-201-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strncat() and strncpy()) with custom safe_strcat() and safe_strcpy() functions The MariaDB code base uses strcat() and strcpy() in several places. These are known to have memory safety issues and their usage is discouraged. Common security scanners like Flawfinder flags them. In MariaDB we should start using modern and safer variants on these functions. This is similar to memory issues fixes in 19af1890b56c6c147c296479bb6a4ad00fa59dbb and 9de9f105b5cb88249acc39af73d32af337d6fd5f but now replace use of strcat() and strcpy() with safer options strncat() and strncpy(). However, add '\0' forcefully to make sure the result string is correct since for these two functions it is not guaranteed what new string will be null-terminated. Example: size_t dest_len = sizeof(g->Message); strncpy(g->Message, "Null json tree", dest_len); strncat(g->Message, ":", sizeof(g->Message) - strlen(g->Message)); size_t wrote_sz = strlen(g->Message); size_t cur_len = wrote_sz >= dest_len ? dest_len - 1 : wrote_sz; g->Message[cur_len] = '\0'; 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 -- Reviewer and co-author Vicențiu Ciorbaru <vicentiu@mariadb.org> -- Reviewer additions: * The initial function implementation was flawed. Replaced with a simpler and also correct version. * Simplified code by making use of snprintf instead of chaining strcat. * Simplified code by removing dynamic string construction in the first place and using static strings if possible. See connect storage engine changes.
* | | MDEV-30344: Without wsrep needs wsrep{,_on}.h headersDaniel Black2023-01-061-2/+0
| | | | | | | | | | | | | | | In the Develop package because of their use from sql_class.h which is the main file for THD needed by server plugins.
* | | Merge 10.4 into 10.5Marko Mäkelä2023-01-0322-37/+38
|\ \ \ | |/ /
| * | Merge 10.3 into 10.4Marko Mäkelä2023-01-0320-35/+36
| |\ \ | | |/
| | * MDEV-30102 file missing in development librariesSergei Golubchik2023-01-021-0/+1
| | | | | | | | | | | | | | | move mariadb_capi_rename.h out of private server headers, because it's included by mysql.h which is not private.
| | * header typosmusvaage2022-12-2019-35/+35
| | |
| * | header typosmusvaage2022-12-202-2/+2
| | |
* | | header typomusvaage2022-12-201-1/+1
| | |
* | | Merge 10.4 into 10.5Marko Mäkelä2022-12-138-0/+82
|\ \ \ | |/ /
| * | Merge 10.3 into 10.4Marko Mäkelä2022-12-136-0/+62
| |\ \ | | |/
| | * MDEV-29817: Issues with handling options for SSL CRLs (and some others)Julius Goryavsky2022-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the correct setting of the "--ssl-verify-server-cert" option in the client-side utilities such as mysqlcheck and mysqlslap, as well as the correct setting of the "--ssl-crl" option when executing queries on the slave side, and also add the correct option codes in the "sslopts-logopts.h" file (in the latter case, incorrect values are not a problem right now, but may cause subtle test failures in the future, if the option handling code changes).
| | * MDEV-29473 UBSAN: Signed integer overflow: X * Y cannot be represented in ↵Alexander Barkov2022-11-177-1/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | type 'int' in strings/dtoa.c Fixing a few problems relealed by UBSAN in type_float.test - multiplication overflow in dtoa.c - uninitialized Field::geom_type (and Field::srid as well) - Wrong call-back function types used in combination with SHOW_FUNC. Changes in the mysql_show_var_func data type definition were not properly addressed all around the code by the following commits: b4ff64568c88ab3ce559e7bd39853d9cbf86704a 18feb62feeb833494d003615861b9c78ec008a90 0ee879ff8ac1b80cd9a963015344f5698a81f309 Adding a helper SHOW_FUNC_ENTRY() function and replacing all mysql_show_var_func declarations using SHOW_FUNC to SHOW_FUNC_ENTRY, to catch mysql_show_var_func in the future at compilation time.
| * | MDEV-29817: Issues with handling options for SSL CRLs (and some others)Julius Goryavsky2022-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the correct setting of the "--tls-version" and "--ssl-verify-server-cert" options in the client-side utilities such as mysqltest, mysqlcheck and mysqlslap, as well as the correct setting of the "--ssl-crl" option when executing queries on the slave side, and also the correct option codes in the "sslopts-logopts.h" file (in the latter case, incorrect values are not a problem right now, but may cause subtle test failures in the future, if the option handling code changes).
* | | Merge 10.4 into 10.5Jan Lindström2022-11-301-2/+2
| | |
* | | MDEV-23230 wsrep files installed when built without WSREP (#2334)Daniel Black2022-11-281-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevent wsrep files from being installed if WITH_WSREP=OFF. Reviewed by Daniel Black Additionally excluded #include wsrep files and galera* files along with galera/wsrep tests. mysql-test/include/have_wsrep.inc remainds as its used by a few isolated tests. Co-authored-by: Chris Ross <cross2@cisco.com>
* | | Merge 10.4 into 10.5Marko Mäkelä2022-11-081-1/+4
|\ \ \ | |/ /
| * | Merge 10.3 into 10.4Marko Mäkelä2022-11-081-1/+3
| |\ \ | | |/
| | * Fix warning with signal typedef for *BSDBrad Smith2022-10-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /usr/ports/pobj/mariadb-10.9.3/mariadb-10.9.3/mysys/my_lock.c:183:7: warning: incompatible function pointer types assigning to 'sig_return' (aka 'void (*)(void)') from 'void (*)(int)' [-Wincompatible-function-pointer-types] ALARM_INIT; ^~~~~~~~~~ /usr/ports/pobj/mariadb-10.9.3/mariadb-10.9.3/include/my_alarm.h:43:16: note: expanded from macro 'ALARM_INIT' alarm_signal=signal(SIGALRM,my_set_alarm_variable); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/ports/pobj/mariadb-10.9.3/mariadb-10.9.3/mysys/my_lock.c:189:7: warning: incompatible function pointer types passing 'sig_return' (aka 'void (*)(void)') to parameter of type 'void (*)(int)' [-Wincompatible-function-pointer-types] ALARM_END; ^~~~~~~~~ /usr/ports/pobj/mariadb-10.9.3/mariadb-10.9.3/include/my_alarm.h:44:41: note: expanded from macro 'ALARM_END' ^~~~~~~~~~~~ /usr/include/sys/signal.h:199:27: note: passing argument to parameter here void (*signal(int, void (*)(int)))(int); ^ 2 warnings generated. The prototype is the same for all of the *BSD's. void (*signal(int sigcatch, void (*func)(int sigraised)))(int);
* | | Merge branch '10.4' into 10.5Oleksandr Byelkin2022-10-263-797/+58
|\ \ \ | |/ /
| * | Merge branch '10.3' into 10.4Oleksandr Byelkin2022-10-263-772/+58
| |\ \ | | |/
| | * MDEV-29490 Renaming internally used client API to avoid name conflictsLawrin Novitsky2022-10-253-772/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with C/C. The patch introduces mariadb_capi_rename.h which is included into mysql.h. The hew header contains macro definitions for the names being renamed. In versions 10.6+(i.e. where sql service exists) the renaming condition in the mariadb_capi_rename.h should be added with && !defined(MYSQL_DYNAMIC_PLUGIN) and look like The patch also contains removal of mysql.h from the api check. Disabling false_duper-6543 test for embedded. ha_federated.so uses C API. C API functions are being renamed in the server, but not renamed in embedded, since embedded server library should have proper C API, as expected by programs using it. Thus the same ha_federated.so cannot work both for server and embedded server library. As all federated tests are already disabled for embedded, federated isn't supposed to work for embedded anyway, and thus the test is being disabled.
* | | Merge 10.4 into 10.5Marko Mäkelä2022-10-252-4/+5
|\ \ \ | |/ /
| * | Merge 10.3 into 10.4Marko Mäkelä2022-10-251-2/+3
| |\ \ | | |/
| | * Cleanup the alloca.h header handling to further reduce hardcoded OS lists ↵Brad Smith2022-10-161-2/+3
| | | | | | | | | | | | (#2289)
| * | MDEV-29481 mariadb-upgrade prints confusing statementAlexander Barkov2022-10-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a new version of the patch instead of the reverted: MDEV-28727 ALTER TABLE ALGORITHM=NOCOPY does not work after upgrade Ignore the difference in key packing flags HA_BINARY_PACK_KEY and HA_PACK_KEY during ALTER to allow ALGORITHM=INSTANT and ALGORITHM=NOCOPY in more cases. If for some reasons (e.g. due to a bug fix such as MDEV-20704) these cumulative (over all segments) flags in KEY::flags are different for the old and new table inside compare_keys_but_name(), the difference in HA_BINARY_PACK_KEY and HA_PACK_KEY in KEY::flags is not really important: MyISAM and Aria can handle such cases well: per-segment flags are stored in MYI and MAI files anyway and they are read during ha_myisam::open() ha_maria::open() time. So indexes get opened with correct per-segment flags that were calculated during the table CREATE time, no matter what the old (CREATE time) and new (ALTER TIME) per-index compression flags are, and no matter if they are equal or not. All other engine ignore key compression flags, so this change is safe for other engines as well.
* | | Merge branch '10.4' into 10.5Sergei Golubchik2022-10-021-0/+11
|\ \ \ | |/ /
| * | Merge branch '10.3' into 10.4Sergei Golubchik2022-10-011-0/+11
| |\ \ | | |/
| | * MDEV-17124: mariadb 10.1.34, views and prepared statements: ERROR 1615 ↵Oleksandr Byelkin2022-09-301-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
* | | correctness assertSergei Golubchik2022-09-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 87775402cd0c and was failing the assert with current_thd==0
* | | Merge 10.4 into 10.5Marko Mäkelä2022-09-261-3/+5
|\ \ \ | |/ /
| * | MDEV-29613 Improve WITH_DBUG_TRACE=OFFMarko Mäkelä2022-09-231-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 28325b08633372cc343dfcbc41fe252020cf6e6e 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
* | | Merge 10.4 into 10.5Marko Mäkelä2022-09-201-1/+1
|\ \ \ | |/ /
| * | Merge 10.3 into 10.4Marko Mäkelä2022-09-201-1/+1
| |\ \ | | |/
| | * MDEV-29543 Windows: Unreadable dlerror() message on localized OSVladislav Vaintroub2022-09-151-1/+1
| | | | | | | | | | | | | | | Force using english for error messages (i.e ASCII) to avoid encoding mixup.
* | | Merge 10.4 into 10.5Jan Lindström2022-09-051-41/+37
|\ \ \ | |/ /
| * | Reduce compilation dependencies on wsrep_mysqld.hDaniele Sciascia2022-08-311-31/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making changes to wsrep_mysqld.h causes large parts of server code to be recompiled. The reason is that wsrep_mysqld.h is included by sql_class.h, even tough very little of wsrep_mysqld.h is needed in sql_class.h. This commit introduces a new header file, wsrep_on.h, which is meant to be included from sql_class.h, and contains only macros and variable declarations used to determine whether wsrep is enabled. Also, header wsrep.h should only contain definitions that are also used outside of sql/. Therefore, move WSREP_TO_ISOLATION* and WSREP_SYNC_WAIT macros to wsrep_mysqld.h. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
* | | Merge branch 'merge-perfschema-5.7' into 10.5Oleksandr Byelkin2022-08-0219-17/+46
|\ \ \
| * | | mysql-5.7.39Oleksandr Byelkin2022-07-2919-18/+45
| | | |
* | | | MDEV-25785 Add support for OpenSSL 3.0Vladislav Vaintroub2022-07-042-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of changes - MD_CTX_SIZE is increased - EVP_CIPHER_CTX_buf_noconst(ctx) does not work anymore, points to nobody knows where. The assumption made previously was that (since the function does not seem to be documented) was that it points to the last partial source block. Add own partial block buffer for NOPAD encryption instead - SECLEVEL in CipherString in openssl.cnf had been downgraded to 0, from 1, to make TLSv1.0 and TLSv1.1 possible (according to https://github.com/openssl/openssl/blob/openssl-3.0.0/NEWS.md even though the manual for SSL_CTX_get_security_level claims that it should not be necessary) - Workaround Ssl_cipher_list issue, it now returns TLSv1.3 ciphers, in addition to what was set in --ssl-cipher - ctx_buf buffer now must be aligned to 16 bytes with openssl( previously with WolfSSL only), ot crashes will happen - updated aes-t , to be better debuggable using function, rather than a huge multiline macro added test that does "nopad" encryption piece-wise, to test replacement of EVP_CIPHER_CTX_buf_noconst part of MDEV-29000
* | | | Cleanup: Remove IF_VALGRINDMarko Mäkelä2022-04-251-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge 10.4 into 10.5Marko Mäkelä2022-04-061-1/+4
|\ \ \ \ | | |/ / | |/| |
| * | | Merge 10.3 into 10.4Marko Mäkelä2022-04-061-1/+4
| |\ \ \ | | | |/ | | |/|
| | * | Merge 10.2 into 10.3Marko Mäkelä2022-04-061-1/+4
| | |\ \
| | | * | MDEV-26136: Correct AIX/macOS cast warning (my_time.h)Daniel Black2022-04-041-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tv_usec is a (suseconds_t) so we cast to it. Prevents the AIX(gcc-10) warning: include/my_time.h: In function 'void my_timeval_trunc(timeval*, uint)': include/my_time.h:249:65: warning: conversion from 'long int' to 'suseconds_t' {aka 'int'} may change value [-Wconversion] 249 | tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals); | macOS is: conversion from 'long int' to '__darwin_suseconds_t' {aka 'int'} may change value On Windows suseconds_t isn't defined so we use the existing long return type of my_time_fraction_remainder. Reviewed by Marko Mäkelä Closes: #2079
* | | | | Merge 10.4 into 10.5Marko Mäkelä2022-03-291-17/+1
|\ \ \ \ \ | |/ / / /