Skip to content

Commit

Permalink
Merge branch '11.5' into 11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oceanli-hub committed Apr 9, 2024
2 parents e9cc3dd + 7bec41d commit 7ff6a6d
Show file tree
Hide file tree
Showing 24 changed files with 269 additions and 184 deletions.
52 changes: 16 additions & 36 deletions cmake/ssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
# - "bundled" uses source code in <source dir>/extra/wolfssl
# - "system" (typically) uses headers/libraries in /usr/lib and /usr/lib64
# - a custom installation of openssl can be used like this
# - cmake -DCMAKE_PREFIX_PATH=</path/to/custom/openssl> -DWITH_SSL="system"
# or
# - cmake -DWITH_SSL=</path/to/custom/openssl>
#
# The default value for WITH_SSL is "bundled"
# set in cmake/build_configurations/feature_set.cmake
# - cmake -DOPENSSL_ROOT_DIR=</path/to/custom/openssl>
#
# For custom build/install of openssl, see the accompanying README and
# INSTALL* files. When building with gcc, you must build the shared libraries
Expand All @@ -40,8 +35,7 @@ SET(WITH_SSL_DOC
"${WITH_SSL_DOC}, yes (prefer os library if present, otherwise use bundled)")
SET(WITH_SSL_DOC
"${WITH_SSL_DOC}, system (use os library)")
SET(WITH_SSL_DOC
"${WITH_SSL_DOC}, </path/to/custom/installation>")
SET(WITH_SSL yes CACHE STRING ${WITH_SSL_DOC})

MACRO (CHANGE_SSL_SETTINGS string)
SET(WITH_SSL ${string} CACHE STRING ${WITH_SSL_DOC} FORCE)
Expand Down Expand Up @@ -73,24 +67,21 @@ MACRO (MYSQL_CHECK_SSL)
IF(NOT WITH_SSL)
IF(WIN32)
CHANGE_SSL_SETTINGS("bundled")
ELSE()
SET(WITH_SSL "yes")
ENDIF()
ENDIF()

# See if WITH_SSL is of the form </path/to/custom/installation>
FILE(GLOB WITH_SSL_HEADER ${WITH_SSL}/include/openssl/ssl.h)
IF (WITH_SSL_HEADER)
SET(WITH_SSL_PATH ${WITH_SSL} CACHE PATH "path to custom SSL installation")
IF (NOT WITH_SSL MATCHES "^(yes|system|bundled)$" AND EXISTS "${WITH_SSL}")
IF (CMAKE_VERSION VERSION_LESS 3.24)
# workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/22945
SET(OPENSSL_ROOT_DIR "${WITH_SSL}" "${WITH_SSL}/lib64")
ELSE()
SET(OPENSSL_ROOT_DIR "${WITH_SSL}")
ENDIF()
ENDIF()

IF(WITH_SSL STREQUAL "bundled")
MYSQL_USE_BUNDLED_SSL()
# Reset some variables, in case we switch from /path/to/ssl to "bundled".
IF (WITH_SSL_PATH)
UNSET(WITH_SSL_PATH)
UNSET(WITH_SSL_PATH CACHE)
ENDIF()
IF (OPENSSL_ROOT_DIR)
UNSET(OPENSSL_ROOT_DIR)
UNSET(OPENSSL_ROOT_DIR CACHE)
Expand All @@ -108,28 +99,14 @@ MACRO (MYSQL_CHECK_SSL)
UNSET(OPENSSL_SSL_LIBRARY CACHE)
ENDIF()
ELSEIF(WITH_SSL STREQUAL "system" OR
WITH_SSL STREQUAL "yes" OR
WITH_SSL_PATH
)
IF(NOT OPENSSL_ROOT_DIR)
IF(WITH_SSL_PATH)
# workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/22945
SET(OPENSSL_ROOT_DIR ${WITH_SSL_PATH} ${WITH_SSL_PATH}/lib64)
ENDIF()
ENDIF()
WITH_SSL STREQUAL "yes" OR
OPENSSL_ROOT_DIR)
FIND_PACKAGE(OpenSSL)
SET_PACKAGE_PROPERTIES(OpenSSL PROPERTIES TYPE RECOMMENDED)
IF(OPENSSL_FOUND)
SET(OPENSSL_LIBRARY ${OPENSSL_SSL_LIBRARY})
INCLUDE(CheckSymbolExists)
SET(SSL_SOURCES "")
SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBSOCKET})
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${CMAKE_DL_LIBS})
ENDIF()
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES})

MESSAGE_ONCE(OPENSSL_INCLUDE_DIR "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
MESSAGE_ONCE(OPENSSL_SSL_LIBRARY "OPENSSL_SSL_LIBRARY = ${OPENSSL_SSL_LIBRARY}")
Expand All @@ -150,6 +127,7 @@ MACRO (MYSQL_CHECK_SSL)
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
SET(CMAKE_REQUIRED_LIBRARIES ${SSL_LIBRARIES})
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
INCLUDE(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(ERR_remove_thread_state "openssl/err.h"
HAVE_ERR_remove_thread_state)
CHECK_SYMBOL_EXISTS(EVP_aes_128_ctr "openssl/evp.h"
Expand All @@ -169,7 +147,9 @@ MACRO (MYSQL_CHECK_SSL)
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR
"Wrong option for WITH_SSL. Valid values are: ${WITH_SSL_DOC}")
"Wrong option for WITH_SSL. Valid values are: ${WITH_SSL_DOC}."
"For custom location of OpenSSL library, use OPENSSL_ROOT_DIR pointing to the library."
)
ENDIF()
ENDMACRO()

Expand Down
107 changes: 59 additions & 48 deletions include/mysql/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */

/**
@file
Interfaces for creating server and client plugins.
*/

#ifndef MYSQL_PLUGIN_INCLUDED
#define MYSQL_PLUGIN_INCLUDED

Expand Down Expand Up @@ -73,29 +79,33 @@ typedef struct st_mysql_xid MYSQL_XID;
Plugin API. Common for all plugin types.
*/

/* MySQL plugin interface version */
/** MySQL plugin interface version */
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104

/* MariaDB plugin interface version */
/** MariaDB plugin interface version */
#define MARIA_PLUGIN_INTERFACE_VERSION 0x010f

/*
The allowable types of plugins
*/
#define MYSQL_UDF_PLUGIN 0 /* not implemented */
#define MYSQL_UDF_PLUGIN 0 /**< not implemented */
#define MYSQL_STORAGE_ENGINE_PLUGIN 1
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
#define MYSQL_FTPARSER_PLUGIN 2 /**< Full-text parser plugin */
#define MYSQL_DAEMON_PLUGIN 3
#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4
#define MYSQL_AUDIT_PLUGIN 5
#define MYSQL_REPLICATION_PLUGIN 6
#define MYSQL_AUTHENTICATION_PLUGIN 7
#define MYSQL_MAX_PLUGIN_TYPE_NUM 12 /* The number of plugin types */
#define MYSQL_MAX_PLUGIN_TYPE_NUM 12 /**< The number of plugin types */

/* MariaDB plugin types */
#define MariaDB_PASSWORD_VALIDATION_PLUGIN 8
/** Client and server password validation */
#define MariaDB_PASSWORD_VALIDATION_PLUGIN 8
/**< Encryption and key managment plugins */
#define MariaDB_ENCRYPTION_PLUGIN 9
/**< Plugins for SQL data storage types */
#define MariaDB_DATA_TYPE_PLUGIN 10
/**< Plugins for new native SQL functions */
#define MariaDB_FUNCTION_PLUGIN 11

/* We use the following strings to define licenses for plugins */
Expand Down Expand Up @@ -220,8 +230,8 @@ struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
Constants for plugin flags.
*/

#define PLUGIN_OPT_NO_INSTALL 1UL /* Not dynamically loadable */
#define PLUGIN_OPT_NO_UNINSTALL 2UL /* Not dynamically unloadable */
#define PLUGIN_OPT_NO_INSTALL 1UL /**< Not dynamically loadable */
#define PLUGIN_OPT_NO_UNINSTALL 2UL /**< Not dynamically unloadable */


/*
Expand All @@ -238,20 +248,20 @@ struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
#define PLUGIN_VAR_SET 0x0007
#define PLUGIN_VAR_DOUBLE 0x0008
#define PLUGIN_VAR_UNSIGNED 0x0080
#define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */
#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */
#define PLUGIN_VAR_NOSYSVAR 0x0400 /* Not a server variable */
#define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */
#define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */
#define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */
#define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */
#define PLUGIN_VAR_DEPRECATED 0x4000 /* Server variable is deprecated */
#define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */
#define PLUGIN_VAR_THDLOCAL 0x0100 /**< Variable is per-connection */
#define PLUGIN_VAR_READONLY 0x0200 /**< Server variable is read only */
#define PLUGIN_VAR_NOSYSVAR 0x0400 /**< Not a server variable */
#define PLUGIN_VAR_NOCMDOPT 0x0800 /**< Not a command line option */
#define PLUGIN_VAR_NOCMDARG 0x1000 /**< No argument for cmd line */
#define PLUGIN_VAR_RQCMDARG 0x0000 /**< Argument required for cmd line */
#define PLUGIN_VAR_OPCMDARG 0x2000 /**< Argument optional for cmd line */
#define PLUGIN_VAR_DEPRECATED 0x4000 /**< Server variable is deprecated */
#define PLUGIN_VAR_MEMALLOC 0x8000 /**< String needs memory allocated */

struct st_mysql_sys_var;
struct st_mysql_value;

/*
/**
SYNOPSIS
(*mysql_var_check_func)()
thd thread handle
Expand All @@ -274,7 +284,7 @@ typedef int (*mysql_var_check_func)(MYSQL_THD thd,
struct st_mysql_sys_var *var,
void *save, struct st_mysql_value *value);

/*
/**
SYNOPSIS
(*mysql_var_update_func)()
thd thread handle
Expand Down Expand Up @@ -519,61 +529,61 @@ DECLARE_MYSQL_THDVAR_SIMPLE(name, double) = { \
(*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))


/*
/**
Plugin description structure.
*/

struct st_mysql_plugin
{
int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */
void *info; /* pointer to type-specific plugin descriptor */
const char *name; /* plugin name */
const char *author; /* plugin author (for I_S.PLUGINS) */
const char *descr; /* general descriptive text (for I_S.PLUGINS) */
int license; /* the plugin license (PLUGIN_LICENSE_XXX) */
/*
int type; /**< the plugin type (a MYSQL_XXX_PLUGIN value) */
void *info; /**< pointer to type-specific plugin descriptor */
const char *name; /**< plugin name */
const char *author; /**< plugin author (for I_S.PLUGINS) */
const char *descr; /**< general descriptive text (for I_S.PLUGINS) */
int license; /**< the plugin license (PLUGIN_LICENSE_XXX) */
/**
The function to invoke when plugin is loaded. Plugin
initialisation done here should defer any ALTER TABLE queries to
after the ddl recovery is done, in the signal_ddl_recovery_done()
callback called by ha_signal_ddl_recovery_done().
*/
int (*init)(void *);
int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
unsigned int version; /* plugin version (for I_S.PLUGINS) */
int (*deinit)(void *);/**< the function to invoke when plugin is unloaded */
unsigned int version; /**< plugin version (for I_S.PLUGINS) */
struct st_mysql_show_var *status_vars;
struct st_mysql_sys_var **system_vars;
void * __reserved1; /* reserved for dependency checking */
unsigned long flags; /* flags for plugin */
void * __reserved1; /**< reserved for dependency checking */
unsigned long flags; /**< flags for plugin */
};

/*
/**
MariaDB extension for plugins declaration structure.
It also copy current MySQL plugin fields to have more independency
It also copies current MySQL plugin fields to have more independency
in plugins extension
*/

struct st_maria_plugin
{
int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */
void *info; /* pointer to type-specific plugin descriptor */
const char *name; /* plugin name */
const char *author; /* plugin author (for SHOW PLUGINS) */
const char *descr; /* general descriptive text (for SHOW PLUGINS ) */
int license; /* the plugin license (PLUGIN_LICENSE_XXX) */
/*
int type; /**< the plugin type (a MYSQL_XXX_PLUGIN value) */
void *info; /**< pointer to type-specific plugin descriptor */
const char *name; /**< plugin name */
const char *author; /**< plugin author (for SHOW PLUGINS) */
const char *descr; /**< general descriptive text (for SHOW PLUGINS ) */
int license; /**< the plugin license (PLUGIN_LICENSE_XXX) */
/**
The function to invoke when plugin is loaded. Plugin
initialisation done here should defer any ALTER TABLE queries to
after the ddl recovery is done, in the signal_ddl_recovery_done()
callback called by ha_signal_ddl_recovery_done().
*/
int (*init)(void *);
int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
unsigned int version; /* plugin version (for SHOW PLUGINS) */
int (*deinit)(void *);/**< the function to invoke when plugin is unloaded */
unsigned int version; /**< plugin version (for SHOW PLUGINS) */
struct st_mysql_show_var *status_vars;
struct st_mysql_sys_var **system_vars;
const char *version_info; /* plugin version string */
unsigned int maturity; /* MariaDB_PLUGIN_MATURITY_XXX */
const char *version_info; /**< plugin version string */
unsigned int maturity; /**< MariaDB_PLUGIN_MATURITY_XXX */
};

/*************************************************************************
Expand Down Expand Up @@ -650,6 +660,10 @@ struct handlerton;
int interface_version;
};

#define MYSQL_VALUE_TYPE_STRING 0
#define MYSQL_VALUE_TYPE_REAL 1
#define MYSQL_VALUE_TYPE_INT 2

/*************************************************************************
st_mysql_value struct for reading values from mysqld.
Used by server variables framework to parse user-provided values.
Expand All @@ -660,10 +674,6 @@ struct handlerton;
if you need it to persist.
*/

#define MYSQL_VALUE_TYPE_STRING 0
#define MYSQL_VALUE_TYPE_REAL 1
#define MYSQL_VALUE_TYPE_INT 2

struct st_mysql_value
{
int (*value_type)(struct st_mysql_value *);
Expand Down Expand Up @@ -691,6 +701,7 @@ struct DDL_options_st *thd_ddl_options(const MYSQL_THD thd);
void thd_storage_lock_wait(MYSQL_THD thd, long long value);
int thd_tx_isolation(const MYSQL_THD thd);
int thd_tx_is_read_only(const MYSQL_THD thd);

/**
Create a temporary file.
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/include/ctype_unicode_casefold_bmp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
--source include/have_ucs2.inc
--source include/have_sequence.inc

--disable_view_protocol

EXECUTE IMMEDIATE SFORMAT('
CREATE VIEW v_bmp AS
SELECT
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/main/func_misc.result
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ create table t1 as select uuid(), length(uuid());
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`uuid()` uuid DEFAULT NULL,
`length(uuid())` int(10) DEFAULT NULL
`uuid()` uuid NOT NULL,
`length(uuid())` int(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
select length(`uuid()`) from t1;
length(`uuid()`)
Expand Down
3 changes: 0 additions & 3 deletions mysql-test/main/information_schema-big.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This test uses grants, which can't get tested for embedded server
-- source include/big_test.inc
-- source include/not_embedded.inc
-- source include/have_innodb.inc

# check that CSV engine was compiled in, as the result of the test depends
Expand Down
9 changes: 9 additions & 0 deletions mysql-test/suite/sql_sequence/alter.result
Original file line number Diff line number Diff line change
Expand Up @@ -739,5 +739,14 @@ next value for s
1001
drop sequence s;
#
# MDEV-33739 Assertion `0' failed in Type_handler_typelib::max_display_length_for_field
#
CREATE SEQUENCE s1 ;
ALTER table s1 CHANGE `next_not_cached_value` next_not_cached_value SET('1','2','3','4','5','6','7','8','9','10');
ERROR HY000: Sequence 'test.s1' table structure is invalid (next_not_cached_value)
ALTER table s1 CHANGE `next_not_cached_value` next_not_cached_value bool;
ERROR HY000: Sequence 'test.s1' table structure is invalid (next_not_cached_value)
drop sequence s1;
#
# End of 11.5 test
#
12 changes: 12 additions & 0 deletions mysql-test/suite/sql_sequence/alter.test
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,18 @@ alter sequence s maxvalue 9432738420582397432;
show create sequence s;
select next value for s;
drop sequence s;

--echo #
--echo # MDEV-33739 Assertion `0' failed in Type_handler_typelib::max_display_length_for_field
--echo #

CREATE SEQUENCE s1 ;
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
ALTER table s1 CHANGE `next_not_cached_value` next_not_cached_value SET('1','2','3','4','5','6','7','8','9','10');
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
ALTER table s1 CHANGE `next_not_cached_value` next_not_cached_value bool;
drop sequence s1;

--enable_ps2_protocol

--echo #
Expand Down

0 comments on commit 7ff6a6d

Please sign in to comment.