diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-22 12:47:48 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-22 12:47:48 +0200 |
commit | 507084517fad72346ab631e3c7493154000df0a7 (patch) | |
tree | 748cfc98d117e17c2475d19abc5eddd78b1ebf39 | |
parent | c76bdc57ffb08043e7b509a188d4626d0f3063c9 (diff) | |
parent | 92f79a22e63a3fef71106c64dfd8559ee9bdda4a (diff) | |
download | mariadb-git-507084517fad72346ab631e3c7493154000df0a7.tar.gz |
Merge 10.6 into 10.7
-rw-r--r-- | include/mysql/plugin.h | 4 | ||||
-rw-r--r-- | mysql-test/main/plugin.result | 4 | ||||
-rw-r--r-- | mysql-test/main/plugin.test | 1 | ||||
-rw-r--r-- | sql/item_func.cc | 12 | ||||
-rw-r--r-- | sql/mysqld.cc | 1 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 10 | ||||
-rw-r--r-- | storage/example/ha_example.cc | 5 | ||||
-rw-r--r-- | storage/innobase/include/rw_lock.h | 16 | ||||
-rw-r--r-- | storage/innobase/os/os0file.cc | 2 | ||||
-rw-r--r-- | storage/innobase/sync/srw_lock.cc | 13 |
10 files changed, 47 insertions, 21 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 6bb8e5233cf..6ef0afb980b 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -233,6 +233,7 @@ typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, void *, #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; @@ -286,7 +287,8 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd, #define PLUGIN_VAR_MASK \ (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \ PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \ - PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC) + PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | \ + PLUGIN_VAR_DEPRECATED | PLUGIN_VAR_MEMALLOC) #define MYSQL_PLUGIN_VAR_HEADER \ int flags; \ diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result index 5806b8f5de3..f16b72f0564 100644 --- a/mysql-test/main/plugin.result +++ b/mysql-test/main/plugin.result @@ -40,11 +40,15 @@ a set global example_ulong_var=500; set global example_enum_var= e1; set session example_int_var= -1; +set global example_deprecated_var=1; +Warnings: +Warning 1287 '@@example_deprecated_var' is deprecated and will be removed in a future release show status like 'example%'; Variable_name Value Example_func_example enum_var is 0, ulong_var is 500, int_var is -1, double_var is 8.500000, really show variables like 'example%'; Variable_name Value +example_deprecated_var 0 example_double_thdvar 8.500000 example_double_var 8.500000 example_enum_var e1 diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test index 19199f767f5..60773c3e190 100644 --- a/mysql-test/main/plugin.test +++ b/mysql-test/main/plugin.test @@ -27,6 +27,7 @@ SELECT * FROM t1; set global example_ulong_var=500; set global example_enum_var= e1; set session example_int_var= -1; +set global example_deprecated_var=1; show status like 'example%'; show variables like 'example%'; diff --git a/sql/item_func.cc b/sql/item_func.cc index 5b8a9f1fbfd..511e7f34f3b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB + Copyright (c) 2009, 2022, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1157,14 +1157,10 @@ longlong Item_func_plus::int_op() } } -#ifndef WITH_UBSAN - res= val0 + val1; -#else if (res_unsigned) res= (longlong) ((ulonglong) val0 + (ulonglong) val1); else - res= val0+val1; -#endif /* WITH_UBSAN */ + res= val0 + val1; return check_integer_overflow(res, res_unsigned); @@ -1327,14 +1323,10 @@ longlong Item_func_minus::int_op() goto err; } } -#ifndef WITH_UBSAN - res= val0 - val1; -#else if (res_unsigned) res= (longlong) ((ulonglong) val0 - (ulonglong) val1); else res= val0 - val1; -#endif /* WITH_UBSAN */ return check_integer_overflow(res, res_unsigned); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 96abe83c2c5..3ced6803a77 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2505,6 +2505,7 @@ static void use_systemd_activated_sockets() addr.un.sun_path[0] = '@'; sql_print_information("Using systemd activated unix socket %s%s", addr.un.sun_path, sock.is_extra_port ? " (extra)" : ""); + memset(addr.un.sun_path, 0, sizeof(addr.un.sun_path)); } else { diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 1f12ed1dcf9..2e647712e64 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -311,7 +311,8 @@ public: struct st_mysql_sys_var *plugin_var; sys_var_pluginvar(sys_var_chain *chain, const char *name_arg, - st_plugin_int *p, st_mysql_sys_var *plugin_var_arg); + st_plugin_int *p, st_mysql_sys_var *plugin_var_arg, + const char *substitute); sys_var_pluginvar *cast_pluginvar() { return this; } uchar* real_value_ptr(THD *thd, enum_var_type type) const; TYPELIB* plugin_var_typelib(void) const; @@ -3416,11 +3417,11 @@ static int pluginvar_sysvar_flags(const st_mysql_sys_var *p) } sys_var_pluginvar::sys_var_pluginvar(sys_var_chain *chain, const char *name_arg, - st_plugin_int *p, st_mysql_sys_var *pv) + st_plugin_int *p, st_mysql_sys_var *pv, const char *substitute) : sys_var(chain, name_arg, pv->comment, pluginvar_sysvar_flags(pv), 0, pv->flags & PLUGIN_VAR_NOCMDOPT ? -1 : 0, NO_ARG, pluginvar_show_type(pv), 0, - NULL, VARIABLE_NOT_IN_BINLOG, NULL, NULL, NULL), + NULL, VARIABLE_NOT_IN_BINLOG, NULL, NULL, substitute), plugin(p), plugin_var(pv) { plugin_var->name= name_arg; @@ -4162,7 +4163,8 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, my_casedn_str(&my_charset_latin1, varname); convert_dash_to_underscore(varname, len-1); } - v= new (mem_root) sys_var_pluginvar(&chain, varname, tmp, o); + const char *s= o->flags & PLUGIN_VAR_DEPRECATED ? "" : NULL; + v= new (mem_root) sys_var_pluginvar(&chain, varname, tmp, o, s); v->test_load= (var ? &var->loaded : &static_unload); DBUG_ASSERT(static_unload == FALSE); diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 5f42f657ef3..c66c33a7818 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -1060,12 +1060,17 @@ static MYSQL_THDVAR_DOUBLE( 1000.5, 0); +static MYSQL_THDVAR_INT( + deprecated_var, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, "-1..1", + NULL, NULL, 0, -1, 1, 0); + static struct st_mysql_sys_var* example_system_variables[]= { MYSQL_SYSVAR(enum_var), MYSQL_SYSVAR(ulong_var), MYSQL_SYSVAR(int_var), MYSQL_SYSVAR(double_var), MYSQL_SYSVAR(double_thdvar), + MYSQL_SYSVAR(deprecated_var), MYSQL_SYSVAR(varopt_default), NULL }; diff --git a/storage/innobase/include/rw_lock.h b/storage/innobase/include/rw_lock.h index a9099d10670..70607b979c1 100644 --- a/storage/innobase/include/rw_lock.h +++ b/storage/innobase/include/rw_lock.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2020, 2021, MariaDB Corporation. +Copyright (c) 2020, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -20,9 +20,17 @@ this program; if not, write to the Free Software Foundation, Inc., #include <atomic> #include "my_dbug.h" -#if !(defined __linux__ || defined __OpenBSD__ || defined _WIN32) -# define SUX_LOCK_GENERIC -#elif 0 // defined SAFE_MUTEX +#if defined __linux__ +/* futex(2): FUTEX_WAIT_PRIVATE, FUTEX_WAKE_PRIVATE */ +#elif defined __OpenBSD__ || defined __FreeBSD__ || defined __DragonFly__ +/* system calls similar to Linux futex(2) */ +#elif defined _WIN32 +/* SRWLOCK as well as WaitOnAddress(), WakeByAddressSingle() */ +#else +# define SUX_LOCK_GENERIC /* fall back to generic synchronization primitives */ +#endif + +#if !defined SUX_LOCK_GENERIC && 0 /* defined SAFE_MUTEX */ # define SUX_LOCK_GENERIC /* Use dummy implementation for debugging purposes */ #endif diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index fea1eda17e9..95bac03284b 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -4019,7 +4019,7 @@ static bool is_drive_on_ssd(DWORD nr) sizeof storage_query, &seek_penalty, sizeof seek_penalty, &bytes_written, nullptr)) { - on_ssd= seek_penalty.IncursSeekPenalty; + on_ssd= !seek_penalty.IncursSeekPenalty; } else { diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index 71414e8ddb2..f406b04712a 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2020, 2021, MariaDB Corporation. +Copyright (c) 2020, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -339,6 +339,17 @@ void ssux_lock_impl<spinloop>::wake() { WakeByAddressSingle(&readers); } # include <sys/futex.h> # define SRW_FUTEX(a,op,n) \ futex((volatile uint32_t*) a, FUTEX_ ## op, n, nullptr, nullptr) +# elif defined __FreeBSD__ +# include <sys/types.h> +# include <sys/umtx.h> +# define FUTEX_WAKE UMTX_OP_WAKE_PRIVATE +# define FUTEX_WAIT UMTX_OP_WAIT_UINT_PRIVATE +# define SRW_FUTEX(a,op,n) _umtx_op(a, FUTEX_ ## op, n, nullptr, nullptr) +# elif defined __DragonFly__ +# include <unistd.h> +# define FUTEX_WAKE(a,n) umtx_wakeup(a,n) +# define FUTEX_WAIT(a,n) umtx_sleep(a,n,0) +# define SRW_FUTEX(a,op,n) FUTEX_ ## op((volatile int*) a, int(n)) # else # error "no futex support" # endif |