diff --git a/CVE-2021-27928.patch b/CVE-2021-27928.patch deleted file mode 100644 index a7be8b5e3134fc638aa397e9108d87ab92a16d44..0000000000000000000000000000000000000000 --- a/CVE-2021-27928.patch +++ /dev/null @@ -1,582 +0,0 @@ -diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def -index c3b5e070158..6d9e198271c 100644 ---- a/mysql-test/suite/galera/disabled.def -+++ b/mysql-test/suite/galera/disabled.def -@@ -37,3 +37,4 @@ galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read tr - galera_concurrent_ctas : MDEV-15845 Test failure on galera.galera_concurrent_ctas - pxc-421: Lock timeout exceeded - galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure -+pxc-421: wsrep_provider is read-only for security reasons -diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_load_provider.inc -index aeab7e6ea19..e6ce6411193 100644 ---- a/mysql-test/suite/galera/include/galera_load_provider.inc -+++ b/mysql-test/suite/galera/include/galera_load_provider.inc -@@ -1,7 +1,6 @@ - --echo Loading wsrep provider ... - - --disable_query_log ----eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; - --eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; - --enable_query_log - -diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_unload_provider.inc -index edc7eb31e0e..83438a947f0 100644 ---- a/mysql-test/suite/galera/include/galera_unload_provider.inc -+++ b/mysql-test/suite/galera/include/galera_unload_provider.inc -@@ -1,7 +1,6 @@ - --echo Unloading wsrep provider ... - - --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` ----let $wsrep_provider_orig = `SELECT @@wsrep_provider` - --let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` - --SET GLOBAL wsrep_provider = 'none'; -+SET GLOBAL wsrep_cluster_address = ''; -diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result -index 9c0d78d96e9..16d13ef261f 100644 ---- a/mysql-test/suite/galera/r/galera_ist_rsync.result -+++ b/mysql-test/suite/galera/r/galera_ist_rsync.result -@@ -21,7 +21,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); - INSERT INTO t1 VALUES ('node2_committed_before'); - COMMIT; - Unloading wsrep provider ... --SET GLOBAL wsrep_provider = 'none'; -+SET GLOBAL wsrep_cluster_address = ''; - connection node_1; - SET AUTOCOMMIT=OFF; - START TRANSACTION; -diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result -index 5c530c32ce6..6bdc933a9fc 100644 ---- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result -+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result -@@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); - INSERT INTO t1 VALUES ('node2_committed_before'); - COMMIT; - Unloading wsrep provider ... --SET GLOBAL wsrep_provider = 'none'; -+SET GLOBAL wsrep_cluster_address = ''; - connection node_1; - SET AUTOCOMMIT=OFF; - START TRANSACTION; -diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result -index 6a5251204b9..4cc49c0cf07 100644 ---- a/mysql-test/suite/galera/r/mysql-wsrep#33.result -+++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result -@@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); - INSERT INTO t1 VALUES ('node2_committed_before'); - COMMIT; - Unloading wsrep provider ... --SET GLOBAL wsrep_provider = 'none'; -+SET GLOBAL wsrep_cluster_address = ''; - connection node_1; - SET AUTOCOMMIT=OFF; - START TRANSACTION; -diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result -index db932ae8223..921172920f1 100644 ---- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result -+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result -@@ -335,7 +335,7 @@ NUMERIC_MIN_VALUE NULL - NUMERIC_MAX_VALUE NULL - NUMERIC_BLOCK_SIZE NULL - ENUM_VALUE_LIST NULL --READ_ONLY NO -+READ_ONLY YES - COMMAND_LINE_ARGUMENT REQUIRED - VARIABLE_NAME WSREP_ON - SESSION_VALUE OFF -@@ -391,7 +391,7 @@ NUMERIC_MIN_VALUE NULL - NUMERIC_MAX_VALUE NULL - NUMERIC_BLOCK_SIZE NULL - ENUM_VALUE_LIST NULL --READ_ONLY NO -+READ_ONLY YES - COMMAND_LINE_ARGUMENT REQUIRED - VARIABLE_NAME WSREP_PROVIDER_OPTIONS - SESSION_VALUE NULL -diff --git a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result b/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result -deleted file mode 100644 -index 056ff8c817b..00000000000 ---- a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result -+++ /dev/null -@@ -1,47 +0,0 @@ --# --# wsrep_notify_cmd --# --call mtr.add_suppression("WSREP: Failed to get provider options"); --# save the initial value --SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; --# default --SELECT @@global.wsrep_notify_cmd; --@@global.wsrep_notify_cmd -- -- --# scope --SELECT @@session.wsrep_notify_cmd; --ERROR HY000: Variable 'wsrep_notify_cmd' is a GLOBAL variable --SET @@global.wsrep_notify_cmd='notify_cmd'; --SELECT @@global.wsrep_notify_cmd; --@@global.wsrep_notify_cmd --notify_cmd -- --# valid values --SET @@global.wsrep_notify_cmd='command'; --SELECT @@global.wsrep_notify_cmd; --@@global.wsrep_notify_cmd --command --SET @@global.wsrep_notify_cmd='hyphenated-command'; --SELECT @@global.wsrep_notify_cmd; --@@global.wsrep_notify_cmd --hyphenated-command --SET @@global.wsrep_notify_cmd=default; --SELECT @@global.wsrep_notify_cmd; --@@global.wsrep_notify_cmd -- --SET @@global.wsrep_notify_cmd=NULL; --SELECT @@global.wsrep_notify_cmd; --@@global.wsrep_notify_cmd --NULL -- --# invalid values --SET @@global.wsrep_notify_cmd=1; --ERROR 42000: Incorrect argument type to variable 'wsrep_notify_cmd' --SELECT @@global.wsrep_notify_cmd; --@@global.wsrep_notify_cmd --NULL -- --# restore the initial value --SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; --# End of test -diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result -deleted file mode 100644 -index 3e4ac8ca883..00000000000 ---- a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result -+++ /dev/null -@@ -1,40 +0,0 @@ --# --# wsrep_provider --# --# save the initial value --SET @wsrep_provider_global_saved = @@global.wsrep_provider; --# default --SELECT @@global.wsrep_provider; --@@global.wsrep_provider --none -- --# scope --SELECT @@session.wsrep_provider; --ERROR HY000: Variable 'wsrep_provider' is a GLOBAL variable --SELECT @@global.wsrep_provider; --@@global.wsrep_provider --none -- --# valid values --SET @@global.wsrep_provider=default; --SELECT @@global.wsrep_provider; --@@global.wsrep_provider --none -- --# invalid values --SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; --ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/invalid/libgalera_smm.so' --SET @@global.wsrep_provider=NULL; --ERROR 42000: Variable 'wsrep_provider' can't be set to the value of 'NULL' --SELECT @@global.wsrep_provider; --@@global.wsrep_provider --none --SET @@global.wsrep_provider=1; --ERROR 42000: Incorrect argument type to variable 'wsrep_provider' --SELECT @@global.wsrep_provider; --@@global.wsrep_provider --none -- --# restore the initial value --SET @@global.wsrep_provider = @wsrep_provider_global_saved; --# End of test -diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result -deleted file mode 100644 -index b2e07c55b38..00000000000 ---- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result -+++ /dev/null -@@ -1,49 +0,0 @@ --# --# wsrep_provider_options --# --call mtr.add_suppression("WSREP: Failed to get provider options"); --SET @@global.wsrep_provider = @@global.wsrep_provider; --# save the initial value --SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; --# default --SELECT @@global.wsrep_provider_options; --@@global.wsrep_provider_options -- -- --# scope --SELECT @@session.wsrep_provider_options; --ERROR HY000: Variable 'wsrep_provider_options' is a GLOBAL variable --SET @@global.wsrep_provider_options='option1'; --SELECT @@global.wsrep_provider_options; --@@global.wsrep_provider_options --option1 -- --# valid values --SET @@global.wsrep_provider_options='name1=value1;name2=value2'; --SELECT @@global.wsrep_provider_options; --@@global.wsrep_provider_options --name1=value1;name2=value2 --SET @@global.wsrep_provider_options='hyphenated-name:value'; --SELECT @@global.wsrep_provider_options; --@@global.wsrep_provider_options --hyphenated-name:value --SET @@global.wsrep_provider_options=default; --SELECT @@global.wsrep_provider_options; --@@global.wsrep_provider_options -- -- --# invalid values --SET @@global.wsrep_provider_options=1; --ERROR 42000: Incorrect argument type to variable 'wsrep_provider_options' --SELECT @@global.wsrep_provider_options; --@@global.wsrep_provider_options -- --SET @@global.wsrep_provider_options=NULL; --Got one of the listed errors --SELECT @@global.wsrep_provider_options; --@@global.wsrep_provider_options --NULL -- --# restore the initial value --SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved; --# End of test -diff --git a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test b/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test -deleted file mode 100644 -index 6d1535ba148..00000000000 ---- a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test -+++ /dev/null -@@ -1,43 +0,0 @@ ----source include/have_wsrep.inc -- ----echo # ----echo # wsrep_notify_cmd ----echo # -- --call mtr.add_suppression("WSREP: Failed to get provider options"); -- ----echo # save the initial value --SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; -- ----echo # default --SELECT @@global.wsrep_notify_cmd; -- ----echo ----echo # scope ----error ER_INCORRECT_GLOBAL_LOCAL_VAR --SELECT @@session.wsrep_notify_cmd; --SET @@global.wsrep_notify_cmd='notify_cmd'; --SELECT @@global.wsrep_notify_cmd; -- ----echo ----echo # valid values --SET @@global.wsrep_notify_cmd='command'; --SELECT @@global.wsrep_notify_cmd; --SET @@global.wsrep_notify_cmd='hyphenated-command'; --SELECT @@global.wsrep_notify_cmd; --SET @@global.wsrep_notify_cmd=default; --SELECT @@global.wsrep_notify_cmd; --SET @@global.wsrep_notify_cmd=NULL; --SELECT @@global.wsrep_notify_cmd; -- ----echo ----echo # invalid values ----error ER_WRONG_TYPE_FOR_VAR --SET @@global.wsrep_notify_cmd=1; --SELECT @@global.wsrep_notify_cmd; -- ----echo ----echo # restore the initial value --SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; -- ----echo # End of test -diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test -deleted file mode 100644 -index 1190ab41bb0..00000000000 ---- a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test -+++ /dev/null -@@ -1,39 +0,0 @@ ----source include/have_wsrep.inc -- ----echo # ----echo # wsrep_provider ----echo # -- ----echo # save the initial value --SET @wsrep_provider_global_saved = @@global.wsrep_provider; -- ----echo # default --SELECT @@global.wsrep_provider; -- ----echo ----echo # scope ----error ER_INCORRECT_GLOBAL_LOCAL_VAR --SELECT @@session.wsrep_provider; --SELECT @@global.wsrep_provider; -- ----echo ----echo # valid values --SET @@global.wsrep_provider=default; --SELECT @@global.wsrep_provider; -- ----echo ----echo # invalid values ----error ER_WRONG_VALUE_FOR_VAR --SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; ----error ER_WRONG_VALUE_FOR_VAR --SET @@global.wsrep_provider=NULL; --SELECT @@global.wsrep_provider; ----error ER_WRONG_TYPE_FOR_VAR --SET @@global.wsrep_provider=1; --SELECT @@global.wsrep_provider; -- ----echo ----echo # restore the initial value --SET @@global.wsrep_provider = @wsrep_provider_global_saved; -- ----echo # End of test -diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test -deleted file mode 100644 -index d2ea32a0637..00000000000 ---- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test -+++ /dev/null -@@ -1,51 +0,0 @@ ----source include/have_wsrep.inc -- ----echo # ----echo # wsrep_provider_options ----echo # -- --call mtr.add_suppression("WSREP: Failed to get provider options"); -- --SET @@global.wsrep_provider = @@global.wsrep_provider; -- ----echo # save the initial value --SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; -- ----echo # default --SELECT @@global.wsrep_provider_options; -- ----echo ----echo # scope ----error ER_INCORRECT_GLOBAL_LOCAL_VAR --SELECT @@session.wsrep_provider_options; ----error 0,ER_WRONG_ARGUMENTS --SET @@global.wsrep_provider_options='option1'; --SELECT @@global.wsrep_provider_options; -- ----echo ----echo # valid values ----error 0,ER_WRONG_ARGUMENTS --SET @@global.wsrep_provider_options='name1=value1;name2=value2'; --SELECT @@global.wsrep_provider_options; ----error 0,ER_WRONG_ARGUMENTS --SET @@global.wsrep_provider_options='hyphenated-name:value'; --SELECT @@global.wsrep_provider_options; ----error 0,ER_WRONG_ARGUMENTS --SET @@global.wsrep_provider_options=default; --SELECT @@global.wsrep_provider_options; -- ----echo ----echo # invalid values ----error ER_WRONG_TYPE_FOR_VAR --SET @@global.wsrep_provider_options=1; --SELECT @@global.wsrep_provider_options; ----error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS --SET @@global.wsrep_provider_options=NULL; --SELECT @@global.wsrep_provider_options; -- ----echo ----echo # restore the initial value ----error 0,ER_WRONG_ARGUMENTS --SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved; -- ----echo # End of test -diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def -index c7c8f2c6216..b5304b1c992 100644 ---- a/mysql-test/suite/wsrep/disabled.def -+++ b/mysql-test/suite/wsrep/disabled.def -@@ -1,2 +1,4 @@ - wsrep.foreign_key : Sporadic failure "WSREP has not yet prepared node for application use" - -+ -+mdev_6832: wsrep_provider is read-only for security reasons -diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result -index b6f22828532..c944af8c90d 100644 ---- a/mysql-test/suite/wsrep/r/variables.result -+++ b/mysql-test/suite/wsrep/r/variables.result -@@ -13,7 +13,6 @@ SET SESSION wsrep_replicate_myisam= ON; - ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL - SET GLOBAL wsrep_replicate_myisam= ON; - SET GLOBAL wsrep_replicate_myisam= OFF; --SET GLOBAL wsrep_provider=none; - # - # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of - # variables when using "_" -@@ -134,10 +133,6 @@ wsrep_local_state_comment # - # Should show nothing. - SHOW STATUS LIKE 'x'; - Variable_name Value --SET GLOBAL wsrep_provider=none; --# --# MDEV#6079: xtrabackup SST failing with maria-10.0-galera --# - - SHOW STATUS LIKE 'wsrep_local_state_uuid'; - Variable_name Value -@@ -146,7 +141,6 @@ wsrep_local_state_uuid # - SHOW STATUS LIKE 'wsrep_last_committed'; - Variable_name Value - wsrep_last_committed # --SET GLOBAL wsrep_provider=none; - - # - # MDEV#6206: wsrep_slave_threads subtracts from max_connections -@@ -160,30 +154,29 @@ SELECT @@global.wsrep_slave_threads; - 1 - SELECT @@global.wsrep_cluster_address; - @@global.wsrep_cluster_address -- -+gcomm:// - SHOW STATUS LIKE 'threads_connected'; - Variable_name Value - Threads_connected 1 - SHOW STATUS LIKE 'wsrep_thread_count'; - Variable_name Value --wsrep_thread_count 0 -+wsrep_thread_count 2 - - SELECT @@global.wsrep_provider; - @@global.wsrep_provider - libgalera_smm.so - SELECT @@global.wsrep_cluster_address; - @@global.wsrep_cluster_address -- -+gcomm:// - SHOW STATUS LIKE 'threads_connected'; - Variable_name Value - Threads_connected 1 - SHOW STATUS LIKE 'wsrep_thread_count'; - Variable_name Value --wsrep_thread_count 0 -+wsrep_thread_count 2 - - # Setting wsrep_cluster_address triggers the creation of - # applier/rollbacker threads. --SET GLOBAL wsrep_cluster_address= 'gcomm://'; - # Wait for applier threads to get created. - SELECT @@global.wsrep_provider; - @@global.wsrep_provider -diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test -index 1315f090d5c..867af600817 100644 ---- a/mysql-test/suite/wsrep/t/variables.test -+++ b/mysql-test/suite/wsrep/t/variables.test -@@ -18,7 +18,7 @@ SET GLOBAL wsrep_replicate_myisam= ON; - - # Reset it back. - SET GLOBAL wsrep_replicate_myisam= OFF; --SET GLOBAL wsrep_provider=none; -+#SET GLOBAL wsrep_provider=none; - - --echo # - --echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of -@@ -27,11 +27,9 @@ SET GLOBAL wsrep_provider=none; - - CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*"); - ----disable_query_log --eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ----let $galera_version=25.3.17 -+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; -+--let $galera_version=25.3.24 - source include/check_galera_version.inc; ----enable_query_log - - --replace_column 2 # - SHOW GLOBAL STATUS LIKE 'wsrep%'; -@@ -47,15 +45,13 @@ SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment'; - SHOW STATUS LIKE 'x'; - - # Reset it back. --SET GLOBAL wsrep_provider=none; -+#SET GLOBAL wsrep_provider=none; - - --echo # - --echo # MDEV#6079: xtrabackup SST failing with maria-10.0-galera - --echo # - ----disable_query_log --eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ----enable_query_log -+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; - - # The following 2 variables are used in innobackupex during xtrabackup-based - # SST. -@@ -67,7 +63,7 @@ SHOW STATUS LIKE 'wsrep_local_state_uuid'; - SHOW STATUS LIKE 'wsrep_last_committed'; - - # Reset it back. --SET GLOBAL wsrep_provider=none; -+#SET GLOBAL wsrep_provider=none; - - --echo - --echo # -@@ -75,9 +71,7 @@ SET GLOBAL wsrep_provider=none; - --echo # - call mtr.add_suppression("WSREP: Failed to get provider options"); - ----disable_query_log --eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ----enable_query_log -+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; - - --replace_regex /.*libgalera_smm.*/libgalera_smm.so/ - SELECT @@global.wsrep_provider; -@@ -87,9 +81,7 @@ SHOW STATUS LIKE 'threads_connected'; - SHOW STATUS LIKE 'wsrep_thread_count'; - --echo - ----disable_query_log --eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ----enable_query_log -+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; - - --replace_regex /.*libgalera_smm.*/libgalera_smm.so/ - SELECT @@global.wsrep_provider; -@@ -100,7 +92,7 @@ SHOW STATUS LIKE 'wsrep_thread_count'; - - --echo # Setting wsrep_cluster_address triggers the creation of - --echo # applier/rollbacker threads. --SET GLOBAL wsrep_cluster_address= 'gcomm://'; -+#SET GLOBAL wsrep_cluster_address= 'gcomm://'; - --echo # Wait for applier threads to get created. - sleep 3; - -diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc -index 8858259c863..90ca973052b 100644 ---- a/sql/sys_vars.cc -+++ b/sql/sys_vars.cc -@@ -5236,7 +5236,7 @@ static Sys_var_tz Sys_time_zone( - - static Sys_var_charptr Sys_wsrep_provider( - "wsrep_provider", "Path to replication provider library", -- PREALLOCATED GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG), -+ PREALLOCATED READ_ONLY GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG), - IN_FS_CHARSET, DEFAULT(WSREP_NONE), - NO_MUTEX_GUARD, NOT_IN_BINLOG, - ON_CHECK(wsrep_provider_check), ON_UPDATE(wsrep_provider_update)); -@@ -5406,7 +5406,7 @@ static Sys_var_ulong Sys_wsrep_max_ws_rows ( - - static Sys_var_charptr Sys_wsrep_notify_cmd( - "wsrep_notify_cmd", "", -- GLOBAL_VAR(wsrep_notify_cmd),CMD_LINE(REQUIRED_ARG), -+ READ_ONLY GLOBAL_VAR(wsrep_notify_cmd), CMD_LINE(REQUIRED_ARG), - IN_SYSTEM_CHARSET, DEFAULT("")); - - static Sys_var_mybool Sys_wsrep_certify_nonPK( diff --git a/LICENSE.clustercheck b/LICENSE.clustercheck new file mode 100644 index 0000000000000000000000000000000000000000..609015d07c38f49eb46f97475dbf595240d669ef --- /dev/null +++ b/LICENSE.clustercheck @@ -0,0 +1,27 @@ +Copyright (c) 2012-2014, Olaf van Zandwijk +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.mysql-cnf b/README.mysql-cnf new file mode 100644 index 0000000000000000000000000000000000000000..3700c7f14c9c21da61750b06dd986081306b5e33 --- /dev/null +++ b/README.mysql-cnf @@ -0,0 +1,13 @@ +This directory contains prepared configuration files with .cnf extension, +which provide a configuration for some common MariaDB deployment scenarios. +These configuration files do not include the default configuration of datadir, +log-file and pid-file locations, as specified in the default my.cnf file, +provided in this distribution. + +Thus, it is recommended to use these configuration files as an addition to the +default my.cnf configuration file. + +Since default my.cnf contains `!includedir @INSTALL_SYSCONF2DIR@` directive, it is +recommended to copy required configuration under @INSTALL_SYSCONF2DIR@ directory, +so the default my.cnf specifications will be extended. + diff --git a/README.mysql-docs b/README.mysql-docs new file mode 100644 index 0000000000000000000000000000000000000000..dd894a7b9c01c5c905cf86bb7bb1c239298b3d7d --- /dev/null +++ b/README.mysql-docs @@ -0,0 +1,4 @@ +The official MySQL documentation is not freely redistributable, so we cannot +include it in RHEL or Fedora. You can find it on-line at + +http://dev.mysql.com/doc/ diff --git a/README.mysql-license b/README.mysql-license new file mode 100644 index 0000000000000000000000000000000000000000..ceabbcfe26fa844000a0426ee203f69b9ea47036 --- /dev/null +++ b/README.mysql-license @@ -0,0 +1,9 @@ +MySQL is distributed under GPL v2, but there are some licensing exceptions +that allow the client libraries to be linked with a non-GPL application, +so long as the application is under a license approved by Oracle. +For details see + +http://www.mysql.com/about/legal/licensing/foss-exception/ + +Some innobase code from Percona and Google is under BSD license. +Some code related to test-suite is under LGPLv2. diff --git a/add-install-db-command.patch b/add-install-db-command.patch deleted file mode 100644 index 2a530493d90976e4cef2636c6bdc9b80c3c8f10c..0000000000000000000000000000000000000000 --- a/add-install-db-command.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 22caf578e446809de75555ec8252f09da50c8db1 Mon Sep 17 00:00:00 2001 -From: eulerstorage -Date: Sun, 19 Jan 2020 22:54:38 +0800 -Subject: [PATCH] add mysql install db command - ---- - support-files/mariadb.service.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in -index 8d43b6d..56ccb1a 100644 ---- a/support-files/mariadb.service.in -+++ b/support-files/mariadb.service.in -@@ -73,7 +73,7 @@ ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ - && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1" - - # Needed to create system tables etc. --# ExecStartPre=@scriptdir@/mysql_install_db -u mysql -+ExecStartPre=@scriptdir@/mysql_install_db --user="mysql" --skip-test-db - - # Start main service - # MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf --- -1.8.3.1 - diff --git a/clustercheck.sh b/clustercheck.sh new file mode 100644 index 0000000000000000000000000000000000000000..782dbb6f1eb781098741040bbf725760fc19b6c5 --- /dev/null +++ b/clustercheck.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# +# Script to make a proxy (ie HAProxy) capable of monitoring Galera cluster nodes properly +# +# Author: Olaf van Zandwijk +# Author: Raghavendra Prabhu +# Author: Ryan O'Hara +# +# Documentation and download: https://github.com/olafz/percona-clustercheck +# +# Based on the original script from Unai Rodriguez +# + +if [ -f @INSTALL_SYSCONFDIR@/sysconfig/clustercheck ]; then + . @INSTALL_SYSCONFDIR@/sysconfig/clustercheck +fi + +MYSQL_USERNAME="${MYSQL_USERNAME-clustercheckuser}" +MYSQL_PASSWORD="${MYSQL_PASSWORD-clustercheckpassword!}" +MYSQL_HOST="${MYSQL_HOST:-127.0.0.1}" +MYSQL_PORT="${MYSQL_PORT:-3306}" +ERR_FILE="${ERR_FILE:-/dev/null}" +AVAILABLE_WHEN_DONOR=${AVAILABLE_WHEN_DONOR:-0} +AVAILABLE_WHEN_READONLY=${AVAILABLE_WHEN_READONLY:-1} +DEFAULTS_EXTRA_FILE=${DEFAULTS_EXTRA_FILE:-@INSTALL_SYSCONFDIR@/my.cnf} + +#Timeout exists for instances where mysqld may be hung +TIMEOUT=10 + +if [[ -r $DEFAULTS_EXTRA_FILE ]];then + MYSQL_CMDLINE="mysql --defaults-extra-file=$DEFAULTS_EXTRA_FILE -nNE \ + --connect-timeout=$TIMEOUT \ + --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} \ + --host=${MYSQL_HOST} --port=${MYSQL_PORT}" +else + MYSQL_CMDLINE="mysql -nNE --connect-timeout=$TIMEOUT \ + --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} \ + --host=${MYSQL_HOST} --port=${MYSQL_PORT}" +fi +# +# Perform the query to check the wsrep_local_state +# +WSREP_STATUS=$($MYSQL_CMDLINE -e "SHOW STATUS LIKE 'wsrep_local_state';" \ + 2>${ERR_FILE} | tail -1 2>>${ERR_FILE}) + +if [[ "${WSREP_STATUS}" == "4" ]] || [[ "${WSREP_STATUS}" == "2" && ${AVAILABLE_WHEN_DONOR} == 1 ]] +then + # Check only when set to 0 to avoid latency in response. + if [[ $AVAILABLE_WHEN_READONLY -eq 0 ]];then + READ_ONLY=$($MYSQL_CMDLINE -e "SHOW GLOBAL VARIABLES LIKE 'read_only';" \ + 2>${ERR_FILE} | tail -1 2>>${ERR_FILE}) + + if [[ "${READ_ONLY}" == "ON" ]];then + # Galera cluster node local state is 'Synced', but it is in + # read-only mode. The variable AVAILABLE_WHEN_READONLY is set to 0. + # => return HTTP 503 + # Shell return-code is 1 + echo -en "HTTP/1.1 503 Service Unavailable\r\n" + echo -en "Content-Type: text/plain\r\n" + echo -en "Connection: close\r\n" + echo -en "Content-Length: 35\r\n" + echo -en "\r\n" + echo -en "Galera cluster node is read-only.\r\n" + sleep 0.1 + exit 1 + fi + fi + # Galera cluster node local state is 'Synced' => return HTTP 200 + # Shell return-code is 0 + echo -en "HTTP/1.1 200 OK\r\n" + echo -en "Content-Type: text/plain\r\n" + echo -en "Connection: close\r\n" + echo -en "Content-Length: 32\r\n" + echo -en "\r\n" + echo -en "Galera cluster node is synced.\r\n" + sleep 0.1 + exit 0 +else + # Galera cluster node local state is not 'Synced' => return HTTP 503 + # Shell return-code is 1 + echo -en "HTTP/1.1 503 Service Unavailable\r\n" + echo -en "Content-Type: text/plain\r\n" + echo -en "Connection: close\r\n" + echo -en "Content-Length: 36\r\n" + echo -en "\r\n" + echo -en "Galera cluster node is not synced.\r\n" + sleep 0.1 + exit 1 +fi diff --git a/disable-some-unstable-testcases-2.patch b/disable-some-unstable-testcases-2.patch deleted file mode 100644 index 0a2441717b2af2cc415f6d49cc1d27c0a3198a27..0000000000000000000000000000000000000000 --- a/disable-some-unstable-testcases-2.patch +++ /dev/null @@ -1,38 +0,0 @@ -From bc8fd081680454b6b29cac8feb6774fd60b37eb5 Mon Sep 17 00:00:00 2001 -From: eulerstorage -Date: Tue, 3 Mar 2020 17:24:08 +0800 -Subject: [PATCH] skip some unstable test cases - ---- - mysql-test/unstable-tests | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests -index 9ea0ebc..99a328b 100644 ---- a/mysql-test/unstable-tests -+++ b/mysql-test/unstable-tests -@@ -41,6 +41,7 @@ binlog.binlog_flush_binlogs_delete_domain : MDEV-14431 - binlog.binlog_killed : MDEV-12925 - Wrong result - binlog.binlog_tmp_table_row : Added in 10.1.35, 10.2.17 - binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint -+binlog.binlog_mysqlbinlog2 : Skip on ARM - binlog.load_data_stm_view : MDEV-16948 - Wrong result - binlog_tmp_table_row : Added in 10.3.9 - -@@ -346,11 +347,13 @@ main.events_2 : MDEV-13277 - main.events_bugs : MDEV-12892 - Crash - main.events_restart : MDEV-12236 - Server shutdown problem - main.events_slowlog : MDEV-12821 - Wrong result -+main.events_1 : Skip on ARM - main.explain_slowquerylog : Modified in 10.2.16 - main.func_json : Modified in 10.3.9 - main.func_misc : Modified in 10.3.8 - main.func_time_hires : Modified in 10.3.8 - main.func_time : Modified in 10.3.9 -+main.func_like : Skip on ARM - main.gis : MDEV-13411 - wrong result on P8 - main.grant2 : Modified in 10.3.8 - main.grant : Modified in 10.3.9 --- -1.8.3.1 - diff --git a/disable-some-unstable-testcases.patch b/disable-some-unstable-testcases.patch deleted file mode 100644 index fae887c4c4f6306c0c9f50998780d0f4d91a36af..0000000000000000000000000000000000000000 --- a/disable-some-unstable-testcases.patch +++ /dev/null @@ -1,81 +0,0 @@ -From ea4fbf5f164c60f736a5e987478dd1a4fc976371 Mon Sep 17 00:00:00 2001 -From: eulerstorage -Date: Mon, 13 Jan 2020 17:35:50 +0800 -Subject: [PATCH] Disable some unstable testcase - -Some testcases are unstable, they will fail if the test environment -is not suitable, for example network is broken. ---- - mysql-test/unstable-tests | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests -index 2c28c9a..9ea0ebc 100644 ---- a/mysql-test/unstable-tests -+++ b/mysql-test/unstable-tests -@@ -262,6 +262,7 @@ innodb.truncate_purge_debug : Include fil - innodb.update_time : MDEV-14804 - Wrong result - innodb.undo_log : Include file modified in 10.2.17, 10.3.9 - innodb.xa_recovery : MDEV-15279 - mysqld got exception -+innodb.innodb_defrag_binlog : - - #----------------------------------------------------------------------- - -@@ -389,6 +390,8 @@ main.mysql_upgrade_noengine : MDEV-14355 - main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error - main.olap : Modified in 10.3.8 - main.openssl_1 : MDEV-13492 - Unknown SSL error -+main.openssl_6975 : -+main.ssl_cipher : - main.order_by_optimizer_innodb : MDEV-10683 - Wrong result - main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock - main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings -@@ -418,6 +421,11 @@ main.ssl_ca : MDEV-10895 - main.ssl_cert_verify : MDEV-13735 - Server crash - main.ssl_connect : MDEV-13492 - Unknown SSL error - main.ssl_timeout : MDEV-11244 - Crash -+main.ssl_7937 : -+main.ssl_crl_clients : -+main.ssl_8k_key : -+main.ssl : -+main.ssl_cipher : - main.statistics_close : Added in 10.3.8 - main.statistics : Modified in 10.3.8 - main.stat_tables : Modified in 10.1.35, 10.2.17, 10.3.9 -@@ -523,6 +531,7 @@ parts.partition_exch_qa_10 : MDEV-11765 - parts.partition_innodb_status_file : MDEV-12901 - Valgrind - parts.partition_special_innodb : MDEV-16942 - Timeout - parts.truncate_locked : Added in 10.1.35, 10.2.17, 10.3.9 -+parts.partition_alter4_innodb : - - #----------------------------------------------------------------------- - -@@ -549,6 +558,9 @@ perfschema.stage_mdl_global : MDEV-11803 - perfschema.stage_mdl_procedure : MDEV-11545 - Missing row - perfschema.stage_mdl_table : MDEV-12638 - Wrong result - perfschema.threads_mysql : MDEV-10677 - Wrong result -+perfschema.nesting : -+perfschema.socket_summary_by_instance_func : -+perfschema.cnf_option : - - #----------------------------------------------------------------------- - -@@ -716,6 +728,7 @@ rpl.rpl_temporary_error2 : MDEV-10634 - rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result - - rpl/extra/rpl_tests.* : MDEV-10994 - Not maintained -+rpl.rpl_connection : - - #----------------------------------------------------------------------- - -@@ -769,6 +782,7 @@ sys_vars.slow_query_log_func : MDEV-14273 - sys_vars.sysvars_innodb : Modified in 10.3.8 - sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result - sys_vars.wait_timeout_func : MDEV-12896 - Wrong result -+sys_vars.slave_parallel_threads_basic : - - #----------------------------------------------------------------------- - --- -1.8.3.1 - diff --git a/mariadb-10.3.9.tar.gz b/mariadb-10.3.34.tar.gz similarity index 82% rename from mariadb-10.3.9.tar.gz rename to mariadb-10.3.34.tar.gz index d12c13bcc252ffdf442ebf0c2ec5dcdfed803559..69ca485a9840fcea3975cec28bb151acb09eec3f 100644 Binary files a/mariadb-10.3.9.tar.gz and b/mariadb-10.3.34.tar.gz differ diff --git a/mariadb-server-galera.te b/mariadb-server-galera.te new file mode 100644 index 0000000000000000000000000000000000000000..bdce127cfa563899b581cd13ded36fd068026bd4 --- /dev/null +++ b/mariadb-server-galera.te @@ -0,0 +1,23 @@ + +module mariadb-server-galera 1.0; + +require { + type mysqld_t; + type rsync_exec_t; + type anon_inodefs_t; + type proc_net_t; + type kerberos_port_t; + class file { read execute execute_no_trans getattr open }; + class tcp_socket { name_bind name_connect }; + class process { setpgid siginh rlimitinh noatsecure }; +} + +# allow mysqld to run rsyncd +allow mysqld_t self:process setpgid; +allow mysqld_t rsync_exec_t:file { read execute execute_no_trans getattr open }; +allow mysqld_t anon_inodefs_t:file getattr; +allow mysqld_t proc_net_t:file { read open }; + +# allow rsyncd to listen on port 4444 +allow mysqld_t kerberos_port_t:tcp_socket { name_bind name_connect }; + diff --git a/mariadb.rpmlintrc b/mariadb.rpmlintrc new file mode 100644 index 0000000000000000000000000000000000000000..b0c90778143f288e2312b445cf82c7252577d768 --- /dev/null +++ b/mariadb.rpmlintrc @@ -0,0 +1,65 @@ +# THIS FILE SERVES FOR WHITELISTING RPMLINT ERRORS AND WARNINGS IN TASKOTRON +# https://fedoraproject.org/wiki/Taskotron/Tasks/dist.rpmlint#Whitelisting_errors + +# (same file in python3 package served as a great example) + + + +# Spelling errors +addFilter(r'spelling-error .* en_US (cnf|mysqld|benchmarking|pam|passwordless|subpackage|libmariadb) ') + +# Debugsource +addFilter(r'^mariadb.*debugsource\.[^:]+: (E|W): no-documentation') +# Debuginfo +addFilter(r'^mariadb.*debuginfo\.[^:]+: (E|W): useless-provides debuginfo\(build-id\)') +# Debug symlinks +addFilter(r'dangling-relative-symlink /usr/lib/.build-id') + +# Testsuite +# Some expected tests results are zero-length files +addFilter(r'(zero-length|pem-certificate) /usr/share/mysql-test/*') + +# Chroot function +# False positive; checked by upstream +addFilter(r'missing-call-to-chdir-with-chroot') + +# Missing documentation +# I don't think that's on the upstream priority list +addFilter(r'no-documentation') +addFilter(r'no-manual-page-for-binary') + +# Obsoleted not provided +# Obsoleting upstream packages, not providing them is expected to not mix them up +addFilter(r'obsolete-not-provided MySQL') +# Provided by mariadb-connector-c +addFilter(r'obsolete-not-provided mariadb-libs') + +# Config file without noreplace flag +# Don't replace logs that may contain old entries +addFilter(r'conffile-without-noreplace-flag /var/log/mariadb/mariadb.log') + +# Log rotation +# MariaDB log rotation script is commented out, because it is still not ready for big industry usage. +# Let the user decide, if they want to enable it (uncomment it) +addFilter(r'incoherent-logrotate-file /etc/logrotate.d/mariadb') + +# Permissions +# wsrep_sst_common +# It contains a parser of arguments for other sst scripts. +# It is meant to be sourced, not to be executed alone. +# So it correctly does not have shebang nor executable bit. +addFilter(r'non-executable-in-bin /usr/bin/wsrep_sst_common 644') +addFilter(r'script-without-shebang /usr/bin/wsrep_sst_common') +addFilter(r'non-executable-script /usr/bin/wsrep_sst_common 644 None') +# mysql-scripts-common has a simmilar issue +addFilter(r'non-executable-script /usr/libexec/mysql-scripts-common 644 /bin/sh') +# Seems pretty standard to me ... +addFilter(r'non-standard-dir-perm /var/log/mariadb 750') + +# Unversioned bundles +# RocksDB has so rapid developement, it it not compatible through versions. +# That means we need to stick to the exact verison upstream use. +addFilter(r'unversioned-explicit-provides bundled(rocksdb)') + +# Testsuite errors +addFilter(r'non-executable-script /usr/share/mysql-test') diff --git a/mariadb.spec b/mariadb.spec index d1ef5167144290ea3aac9efbb7aeeb021dea4937..efaa576f6936b7cc0fa6ccb065348925dc9731e4 100644 --- a/mariadb.spec +++ b/mariadb.spec @@ -1,441 +1,1067 @@ -%global runtest 0 +%global __cmake_in_source_build 1 +%global pkg_name %{name} +%global pkgnamepatch mariadb +%{!?runselftest:%global runselftest 1} +%global ignore_testsuite_result 0 +%global last_tested_version 10.3.34 +%global force_run_testsuite 0 +%global require_mysql_selinux 1 +%global _pkgdocdirname %{pkg_name}%{!?_pkgdocdir:-%{version}} +%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{pkg_name}-%{version}} +%global _default_patch_flags --no-backup-if-mismatch + +%ifarch x86_64 +%bcond_with tokudb +%bcond_with mroonga +%bcond_with rocksdb +%endif + +%bcond_without oqgraph + +# plugins +%bcond_with cracklib +%bcond_with connect +%bcond_with sphinx + +%bcond_without gssapi + +%bcond_with clibrary + +%bcond_without embedded +%bcond_without devel +%bcond_without client +%bcond_without common +%bcond_without errmsg +%bcond_without test +%bcond_without galera +%bcond_without backup +%bcond_without bench + +%bcond_with config +%bcond_with debug +%bcond_without lz4 + +%bcond_with unbundled_pcre +%global pcre_bundled_version 8.45 + +%global python_path /usr/bin/python3 + +%global daemon_name %{name} +%global daemon_no_prefix %{pkg_name} +%global mysqld_pid_dir mariadb + +%global logrotateddir %{_sysconfdir}/logrotate.d +%global logfiledir %{_localstatedir}/log/%{daemon_name} +%global logfile %{logfiledir}/%{daemon_name}.log +%global pidfiledir %{_rundir}/%{mysqld_pid_dir} +%global dbdatadir %{_localstatedir}/lib/mysql +%global mysqluserhome /var/lib/mysql + +%bcond_without mysql_names +%bcond_without conflicts + +%global sameevr %{epoch}:%{version}-%{release} Name: mariadb -Version: 10.3.9 -Release: 12 +Version: 10.3.34 +Release: 1 Epoch: 3 -Summary: One of the most popular database servers -License: GPLv2 with exceptions and LGPLv2 and BSD -URL: http://mariadb.org -Source0: https://downloads.mariadb.com/MariaDB/mariadb-%{version}/source/mariadb-%{version}.tar.gz - -Patch0001: disable-some-unstable-testcases.patch -Patch0002: add-install-db-command.patch -Patch0003: disable-some-unstable-testcases-2.patch -Patch0004: CVE-2021-27928.patch +Summary: A very fast and robust SQL database server +URL: http://mariadb.org +# Exceptions allow client libraries to be linked with most open source SW, not only GPL code. See README.mysql-license +License: GPLv2 with exceptions and LGPLv2 and BSD -BuildRequires: selinux-policy-devel, cmake, gcc-c++ -BuildRequires: systemd, systemd-devel -BuildRequires: zlib-devel, lz4-devel, libaio-devel, libedit-devel, ncurses-devel -BuildRequires: systemtap-sdt-devel, bison, bison-devel, pam-devel -BuildRequires: pcre-devel >= 8.35 pkgconf -BuildRequires: perl-interpreter, perl-generators -BuildRequires: python3, time, procps +#Source0: https://downloads.mariadb.org/interstitial/mariadb-%{version}/source/mariadb-%{version}.tar.gz +Source0: mariadb-%{version}.tar.gz +Source2: mysql_config_multilib.sh +Source3: my.cnf.in +Source5: README.mysql-cnf +Source6: README.mysql-docs +Source7: README.mysql-license +Source10: mysql.tmpfiles.d.in +Source11: mysql.service.in +Source12: mysql-prepare-db-dir.sh +Source14: mysql-check-socket.sh +Source15: mysql-scripts-common.sh +Source16: mysql-check-upgrade.sh +Source18: mysql@.service.in +Source50: skipped-tests-base.list +Source51: skipped-tests-arm.list +Source70: clustercheck.sh +Source71: LICENSE.clustercheck +Source72: mariadb-server-galera.te + +BuildRequires: cmake gcc-c++ +BuildRequires: multilib-rpm-config +BuildRequires: selinux-policy-devel +BuildRequires: systemd systemd-devel + +# Page compression algorithms for InnoDB & XtraDB +BuildRequires: zlib-devel +%{?with_lz4:BuildRequires: lz4-devel} + +# asynchornous operations stuff; needed also for wsrep API +BuildRequires: libaio-devel +# commands history features +BuildRequires: libedit-devel +# CLI graphic; needed also for wsrep API +BuildRequires: ncurses-devel +# debugging stuff +BuildRequires: systemtap-sdt-devel +# Bison SQL parser; needed also for wsrep API +BuildRequires: bison bison-devel + +%{?with_debug:BuildRequires: valgrind-devel} + +# auth_pam.so plugin will be build if pam-devel is installed +BuildRequires: pam-devel +# use either new enough version of pcre or provide bundles(pcre) +%{?with_unbundled_pcre:BuildRequires: pcre-devel >= 8.35 pkgconf} +%{!?with_unbundled_pcre:Provides: bundled(pcre) = %{pcre_bundled_version}} +# Few utilities needs Perl +BuildRequires: perl-interpreter +BuildRequires: perl-generators +# Some tests requires python +BuildRequires: python3 +# Tests requires time and ps and some perl modules +BuildRequires: procps +BuildRequires: time +BuildRequires: perl(base) +BuildRequires: perl(Cwd) +BuildRequires: perl(Data::Dumper) +BuildRequires: perl(English) +BuildRequires: perl(Env) +BuildRequires: perl(Errno) +BuildRequires: perl(Exporter) +BuildRequires: perl(Fcntl) +BuildRequires: perl(File::Basename) +BuildRequires: perl(File::Copy) +BuildRequires: perl(File::Find) +BuildRequires: perl(File::Spec) +BuildRequires: perl(File::Spec::Functions) +BuildRequires: perl(File::Temp) +BuildRequires: perl(Getopt::Long) +BuildRequires: perl(IO::File) +BuildRequires: perl(IO::Handle) +BuildRequires: perl(IO::Select) +BuildRequires: perl(IO::Socket) +BuildRequires: perl(IO::Socket::INET) +BuildRequires: perl(IPC::Open3) +BuildRequires: perl(lib) +BuildRequires: perl(Memoize) +BuildRequires: perl(POSIX) +BuildRequires: perl(Socket) +BuildRequires: perl(strict) +BuildRequires: perl(Symbol) +BuildRequires: perl(Sys::Hostname) +BuildRequires: perl(Term::ANSIColor) +BuildRequires: perl(Test::More) +BuildRequires: perl(Time::HiRes) +BuildRequires: perl(Time::localtime) +BuildRequires: perl(warnings) BuildRequires: openssl openssl-devel -BuildRequires: perl(File::Temp), perl(Data::Dumper), perl(Getopt::Long) -BuildRequires: perl(Env), perl(Exporter), perl(Fcntl) -BuildRequires: perl(IPC::Open3), perl(Memoize), perl(Socket) -BuildRequires: perl(Sys::Hostname), perl(Test::More), perl(Time::HiRes), perl(Symbol) +Requires: bash coreutils grep -Requires: grep, bash, coreutils -Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} +Requires: %{name}-common%{?_isa} = %{sameevr} + +%if %{with clibrary} +Requires: %{name}-libs%{?_isa} = %{sameevr} +%else +# If not built with client library in this package, use connector-c Requires: mariadb-connector-c >= 3.0 -Suggests: %{name}-server%{?_isa} = %{epoch}:%{version}-%{release} -Provides: mariadb-galera = %{epoch}:%{version}-%{release} +%endif + +%if %{with mysql_names} +Provides: mysql = %{sameevr} +Provides: mysql%{?_isa} = %{sameevr} +Provides: mysql-compat-client = %{sameevr} +Provides: mysql-compat-client%{?_isa} = %{sameevr} +%endif + +Suggests: %{name}-server%{?_isa} = %{sameevr} + +# MySQL (with caps) is upstream's spelling of their own RPMs for mysql +%{?with_conflicts:Conflicts: mysql} %global __requires_exclude ^perl\\((hostnames|lib::mtr|lib::v1|mtr_|My::) +%global __provides_exclude_from ^(%{_datadir}/(mysql|mysql-test)/.*|%{_libdir}/%{pkg_name}/plugin/.*\\.so)$ -%description -MariaDB turns data into structured information in a wide array of applications, -ranging from banking to websites. It is an enhanced, drop-in replacement for MySQL. -MariaDB is used because it is fast, scalable and robust, with a rich ecosystem of storage -engines, plugins and many other tools make it very versatile for a wide variety of use cases. +# Define license macro if not present +%{!?_licensedir:%global license %doc} -%package common -Summary: It including share config files used by client and server -Provides: mariadb-galera-common = %{epoch}:%{version}-%{release} -Obsoletes: %{name}-libs <= %{epoch}:%{version}-%{release} +%description +MariaDB is a community developed branch of MySQL - a multi-user, multi-threaded +SQL database server. It is a client/server implementation consisting of +a server daemon (mysqld) and many different client programs and libraries. +The base package contains the standard MariaDB/MySQL client programs and +generic MySQL files. + + +%if %{with clibrary} +%package libs +Summary: The shared libraries required for MariaDB/MySQL clients +Requires: %{name}-common%{?_isa} = %{sameevr} +%if %{with mysql_names} +Provides: mysql-libs = %{sameevr} +Provides: mysql-libs%{?_isa} = %{sameevr} +%endif -%description common -It including share config files used by client and server, -It must install first. +%description libs +The mariadb-libs package provides the essential shared libraries for any +MariaDB/MySQL client program or interface. You will need to install this +package to use any other MariaDB package or any clients that need to connect +to a MariaDB/MySQL server. +%endif -%package errmessage -Summary: It including the error messages files -Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} -Provides: errmsg errmsg%{?_isa} -Obsoletes: errmsg -%description errmessage -The package provides error messages files for other packages. +%if %{with config} +%package config +Summary: The config files required by server and client +%description config +The package provides the config file my.cnf and my.cnf.d directory used by any +MariaDB or MySQL program. You will need to install this package to use any +other MariaDB or MySQL package if the config files are not provided in the +package itself. +%endif -%package server -Summary: The MariaDB server -Requires: %{name}%{?_isa} -Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} -Requires: %{name}-errmessage%{?_isa} = %{epoch}:%{version}-%{release} -Requires: perl(DBI) perl(DBD::mysql) -Recommends: %{name}-backup%{?_isa} = %{epoch}:%{version}-%{release} -Recommends: %{name}-gssapi-server%{?_isa} = %{epoch}:%{version}-%{release} -Provides: server_utils server_utils%{?_isa} -Obsoletes: server-utils +%if %{with common} +%package common +Summary: The shared files required by server and client Requires: %{_sysconfdir}/my.cnf -Requires: %{_sysconfdir}/my.cnf.d -Requires: coreutils, iproute, psmisc -Suggests: logrotate -Requires: systemd -Requires(pre): /usr/sbin/useradd -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd -%description server -MariaDB Server is one of the most popular database servers in the world. +# obsoletion of mariadb-galera-common +Provides: mariadb-galera-common = %{sameevr} + +%if %{without clibrary} +Obsoletes: %{name}-libs <= %{sameevr} +%endif + +%description common +The package provides the essential shared files for any MariaDB program. +You will need to install this package to use any other MariaDB package. +%endif +%if %{with errmsg} +%package errmsg +Summary: The error messages files required by server and embedded +Requires: %{name}-common%{?_isa} = %{sameevr} + +%description errmsg +The package provides error messages files for the MariaDB daemon and the +embedded server. You will need to install this package to use any of those +MariaDB packages. +%endif + + +%if %{with galera} %package server-galera -Summary: MariaDB Galera Cluster is a synchronous multi-master cluster for MariaDB -Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} -Requires: %{name}-server%{?_isa} = %{epoch}:%{version}-%{release} +Summary: The configuration files and scripts for galera replication +Requires: %{name}-common%{?_isa} = %{sameevr} +Requires: %{name}-server%{?_isa} = %{sameevr} Requires: galera >= 25.3.3 Requires(post): libselinux-utils Requires(post): policycoreutils-python-utils -Requires: lsof, rsync -Provides: mariadb-galera-server = %{epoch}:%{version}-%{release} +# wsrep requirements +Requires: lsof +# Default wsrep_sst_method +Requires: rsync + +# obsoletion of mariadb-galera-server +Provides: mariadb-galera-server = %{sameevr} %description server-galera -MariaDB Galera Cluster is a synchronous multi-master cluster for MariaDB. +MariaDB is a multi-user, multi-threaded SQL database server. It is a +client/server implementation consisting of a server daemon (mysqld) +and many different client programs and libraries. This package contains +the MariaDB server and some accompanying files and directories. +MariaDB is a community developed branch of MySQL. +%endif -%package gssapi-server -Summary: The gssapi authentication plugin -BuildRequires: krb5-devel -Requires: %{name}-server%{?_isa} = %{epoch}:%{version}-%{release} +%package server +Summary: The MariaDB server and related files -%description gssapi-server -The gssapi authentication plugin allows the user to authenticate with services. +%if %{with mysql_names} +Requires: mysql-compat-client%{?_isa} +Requires: mysql%{?_isa} +Recommends: %{name}%{?_isa} +%else +Requires: %{name}%{?_isa} +%endif +Requires: %{name}-common%{?_isa} = %{sameevr} +Requires: %{name}-errmsg%{?_isa} = %{sameevr} +Recommends: %{name}-server-utils%{?_isa} = %{sameevr} +Recommends: %{name}-backup%{?_isa} = %{sameevr} +%{?with_cracklib:Recommends: %{name}-cracklib-password-check%{?_isa} = %{sameevr}} +%{?with_gssapi:Recommends: %{name}-gssapi-server%{?_isa} = %{sameevr}} +%{?with_rocksdb:Suggests: %{name}-rocksdb-engine%{?_isa} = %{sameevr}} +%{?with_tokudb:Suggests: %{name}-tokudb-engine%{?_isa} = %{sameevr}} +%{?with_sphinx:Suggests: %{name}-sphinx-engine%{?_isa} = %{sameevr}} +%{?with_oqgraph:Suggests: %{name}-oqgraph-engine%{?_isa} = %{sameevr}} +%{?with_connect:Suggests: %{name}-connect-engine%{?_isa} = %{sameevr}} + +Suggests: mytop +Suggests: logrotate +Requires: %{_sysconfdir}/my.cnf +Requires: %{_sysconfdir}/my.cnf.d -%package devel -Summary: Including header files and library for the developing of mariadb -Requires: openssl-devel -Requires: mariadb-connector-c-devel >= 3.0 +%if %require_mysql_selinux +Requires: (mysql-selinux if selinux-policy-targeted) +%endif -%description devel -This contains dynamic libraries and header files for the developing of mariadb. +# for fuser in mysql-check-socket +Requires: psmisc +Requires: coreutils +Requires(pre): /usr/sbin/useradd +# We require this to be present for %%{_tmpfilesdir} +Requires: systemd +# Make sure it's there when scriptlets run, too +%{?systemd_requires} +Requires: iproute +%if %{with mysql_names} +Provides: mysql-server = %{sameevr} +Provides: mysql-server%{?_isa} = %{sameevr} +Provides: mysql-compat-server = %{sameevr} +Provides: mysql-compat-server%{?_isa} = %{sameevr} +%endif +%{?with_conflicts:Conflicts: mysql-server} +%description server +MariaDB is a multi-user, multi-threaded SQL database server. It is a +client/server implementation consisting of a server daemon (mysqld) +and many different client programs and libraries. This package contains +the MariaDB server and some accompanying files and directories. +MariaDB is a community developed branch of MySQL. + + +%if %{with oqgraph} %package oqgraph-engine -Summary: The Open Query GRAPH computation engine +Summary: The Open Query GRAPH engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} +# boost and Judy required for oograph BuildRequires: boost-devel Judy-devel -Requires: %{name}-server%{?_isa} = %{epoch}:%{version}-%{release} %description oqgraph-engine -The Open Query GRAPH computation engine, or OQGRAPH as the engine itself is called, -allows you to handle hierarchies (tree structures) and complex graphs (nodes having -many connections in several directions). +The package provides Open Query GRAPH engine (OQGRAPH) as plugin for MariaDB +database server. OQGRAPH is a computation engine allowing hierarchies and more +complex graph structures to be handled in a relational fashion. In a nutshell, +tree structures and friend-of-a-friend style searches can now be done using +standard SQL syntax, and results joined onto other tables. +%endif + + +%if %{with connect} +%package connect-engine +Summary: The CONNECT storage engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} +BuildRequires: libxml2-devel +%description connect-engine +The CONNECT storage engine enables MariaDB to access external local or +remote data (MED). This is done by defining tables based on different data +types, in particular files in various formats, data extracted from other DBMS +or products (such as Excel), or data retrieved from the environment +(for example DIR, WMI, and MAC tables). +%endif + + +%if %{with backup} %package backup -Summary: MariaDB physical online backups of InnoDB, Aria and MyISAM tables +Summary: The mariabackup tool for physical online backups +Requires: %{name}-server%{?_isa} = %{sameevr} BuildRequires: libarchive-devel -Requires: %{name}-server%{?_isa} = %{epoch}:%{version}-%{release} %description backup -Mariabackup is an open source tool provided by MariaDB for performing physical -online backups of InnoDB, Aria and MyISAM tables. For InnoDB, “hot online” backups -are possible. It was originally forked from Percona XtraBackup 2.3.8. It is available -on Linux and Windows. +MariaDB Backup is an open source tool provided by MariaDB for performing +physical online backups of InnoDB, Aria and MyISAM tables. +For InnoDB, "hot online" backups are possible. +%endif + +%if %{with rocksdb} +%package rocksdb-engine +Summary: The RocksDB storage engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} +Provides: bundled(rocksdb) -%package cracklib -Summary: A password validation plugin +%description rocksdb-engine +The RocksDB storage engine is used for high performance servers on SSD drives. +%endif + + +%if %{with tokudb} +%package tokudb-engine +Summary: The TokuDB storage engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} +BuildRequires: jemalloc-devel +Requires: jemalloc + +%description tokudb-engine +The TokuDB storage engine from Percona. +%endif + + +%if %{with cracklib} +%package cracklib-password-check +Summary: The password strength checking plugin +Requires: %{name}-server%{?_isa} = %{sameevr} BuildRequires: cracklib-dicts cracklib-devel -Requires: %{name}-server%{?_isa} = %{epoch}:%{version}-%{release} Requires: cracklib-dicts -Provides: cracklib-password-check cracklib-password-check%{?_isa} -Obsoletes: cracklib-password-check -%description cracklib -cracklib_password_check is a password validation plugin. It uses the CrackLib library -to check the strength of new passwords. CrackLib is installed by default in many Linux -distributions, since the system's Pluggable Authentication Module (PAM) authentication -framework is usually configured to check the strength of new passwords with the pam_cracklib -PAM module. +%description cracklib-password-check +CrackLib is a password strength checking library. It is installed by default +in many Linux distributions and is invoked automatically (by pam_cracklib.so) +whenever the user login password is modified. +Now, with the cracklib_password_check password validation plugin, one can +also use it to check MariaDB account passwords. +%endif + +%if %{with gssapi} +%package gssapi-server +Summary: GSSAPI authentication plugin for server +Requires: %{name}-server%{?_isa} = %{sameevr} +BuildRequires: krb5-devel +%description gssapi-server +GSSAPI authentication server-side plugin for MariaDB for passwordless login. +This plugin includes support for Kerberos on Unix. +%endif + + +%if %{with sphinx} +%package sphinx-engine +Summary: The Sphinx storage engine for MariaDB +Requires: %{name}-server%{?_isa} = %{sameevr} +BuildRequires: sphinx libsphinxclient libsphinxclient-devel +Requires: sphinx libsphinxclient + +%description sphinx-engine +The Sphinx storage engine for MariaDB. +%endif + + +%package server-utils +Summary: Non-essential server utilities for MariaDB/MySQL applications +Requires: %{name}-server%{?_isa} = %{sameevr} +%if %{with mysql_names} +Provides: mysql-perl = %{sameevr} +%endif +Requires: perl(DBI) perl(DBD::mysql) + +%description server-utils +This package contains all non-essential server utilities and scripts for +managing databases. It also contains all utilities requiring Perl and it is +the only MariaDB sub-package, except test subpackage, that depends on Perl. + + +%if %{with devel} +%package devel +Summary: Files for development of MariaDB/MySQL applications +%{?with_clibrary:Requires: %{name}-libs%{?_isa} = %{sameevr}} +Requires: openssl-devel +%if %{without clibrary} +Requires: mariadb-connector-c-devel >= 3.0 +%endif +%if %{with mysql_names} +Provides: mysql-devel = %{sameevr} +Provides: mysql-devel%{?_isa} = %{sameevr} +%endif +%{?with_conflicts:Conflicts: mysql-devel} + +%description devel +MariaDB is a multi-user, multi-threaded SQL database server. +MariaDB is a community developed branch of MySQL. +%if %{with clibrary} +This package contains everything needed for developing MariaDB/MySQL client +and server applications. +%else +This package contains everything needed for developing MariaDB/MySQL server +applications. For developing client applications, use mariadb-connector-c +package. +%endif +%endif + + +%if %{with embedded} %package embedded -Summary: The embedded MariaDB server -Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} -Requires: %{name}-errmessage%{?_isa} = %{epoch}:%{version}-%{release} +Summary: MariaDB as an embeddable library +Requires: %{name}-common%{?_isa} = %{sameevr} +Requires: %{name}-errmsg%{?_isa} = %{sameevr} +%if %{with mysql_names} +Provides: mysql-embedded = %{sameevr} +Provides: mysql-embedded%{?_isa} = %{sameevr} +%endif %description embedded -The embedded MariaDB server, libmysqld has the identical interface as the C client -librarylibmysqclient. +MariaDB is a multi-user, multi-threaded SQL database server. This +package contains a version of the MariaDB server that can be embedded +into a client application instead of running as a separate process. +MariaDB is a community developed branch of MySQL. + %package embedded-devel -Summary: Including header files and library for the developing of embedded MariaDB -Requires: %{name}-embedded%{?_isa} = %{epoch}:%{version}-%{release} -Requires: %{name}-devel%{?_isa} = %{epoch}:%{version}-%{release} +Summary: Development files for MariaDB as an embeddable library +Requires: %{name}-embedded%{?_isa} = %{sameevr} +Requires: %{name}-devel%{?_isa} = %{sameevr} Requires: libaio-devel +%if %{with mysql_names} +Provides: mysql-embedded-devel = %{sameevr} +Provides: mysql-embedded-devel%{?_isa} = %{sameevr} +%endif +%{?with_conflicts:Conflicts: mysql-embedded-devel} %description embedded-devel -This contains dynamic libraries and header files for the developing of embedded MariaDB. +MariaDB is a multi-user, multi-threaded SQL database server. +MariaDB is a community developed branch of MySQL. +This package contains files needed for developing and testing with +the embedded version of the MariaDB server. +%endif +%if %{with bench} +%package bench +Summary: MariaDB benchmark scripts and data +Requires: %{name}%{?_isa} = %{sameevr} +%if %{with mysql_names} +Provides: mysql-bench = %{sameevr} +Provides: mysql-bench%{?_isa} = %{sameevr} +%endif +%{?with_conflicts:Conflicts: mysql-bench} + +%description bench +MariaDB is a multi-user, multi-threaded SQL database server. +MariaDB is a community developed branch of MySQL. +This package contains benchmark scripts and data for use when benchmarking +MariaDB. +%endif + + +%if %{with test} %package test -Summary: The test suite of MariaDB -Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} -Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release} -Requires: %{name}-server%{?_isa} = %{epoch}:%{version}-%{release} -Requires: perl(Env), perl(Fcntl), perl(Exporter) -Requires: perl(File::Temp), perl(Data::Dumper), perl(Getopt::Long) -Requires: perl(IPC::Open3), perl(Socket), perl(Sys::Hostname) -Requires: perl(Test::More), perl(Time::HiRes) +Summary: The test suite distributed with MariaDB +Requires: %{name}%{?_isa} = %{sameevr} +Requires: %{name}-common%{?_isa} = %{sameevr} +Requires: %{name}-server%{?_isa} = %{sameevr} +Requires: perl(Env) +Requires: perl(Exporter) +Requires: perl(Fcntl) +Requires: perl(File::Temp) +Requires: perl(Data::Dumper) +Requires: perl(Getopt::Long) +Requires: perl(IPC::Open3) +Requires: perl(Socket) +Requires: perl(Sys::Hostname) +Requires: perl(Test::More) +Requires: perl(Time::HiRes) +%{?with_conflicts:Conflicts: mysql-test} +%if %{with mysql_names} +Provides: mysql-test = %{sameevr} +Provides: mysql-test%{?_isa} = %{sameevr} +%endif %description test -This contains test suitte for the developing of MariaDB. +MariaDB is a multi-user, multi-threaded SQL database server. +MariaDB is a community developed branch of MySQL. +This package contains the regression test suite distributed with the MariaDB +sources. +%endif %prep -%autosetup -n %{name}-%{version} -p1 +%setup -q -n mariadb-%{version} + +# Remove JAR files that upstream puts into tarball find . -name "*.jar" -type f -exec rm --verbose -f {} \; +# generate a list of tests that fail, but are not disabled by upstream +cat %{SOURCE50} | tee -a mysql-test/unstable-tests + +# disable some tests failing on different architectures +%ifarch %{arm} aarch64 +cat %{SOURCE51} | tee -a mysql-test/unstable-tests +%endif + +cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \ + %{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE18} %{SOURCE70} scripts + +%if %{with galera} +# prepare selinux policy +mkdir selinux +sed 's/mariadb-server-galera/%{name}-server-galera/' %{SOURCE72} > selinux/%{name}-server-galera.te +%endif + + +# Get version of PCRE, that upstream use pcre_maj=`grep '^m4_define(pcre_major' pcre/configure.ac | sed -r 's/^m4_define\(pcre_major, \[([0-9]+)\]\)/\1/'` pcre_min=`grep '^m4_define(pcre_minor' pcre/configure.ac | sed -r 's/^m4_define\(pcre_minor, \[([0-9]+)\]\)/\1/'` +%if %{without unbundled_pcre} +# Check if the PCRE version in macro 'pcre_bundled_version', used in Provides: bundled(...), is the same version as upstream actually bundles +if [ %{pcre_bundled_version} != "$pcre_maj.$pcre_min" ] +then + echo "\n Error: Bundled PCRE version is not correct. \n\tBundled version number:%{pcre_bundled_version} \n\tUpstream version number: $pcre_maj.$pcre_min\n" + exit 1 +fi +%else +# Check if the PCRE version that upstream use, is the same as the one present in system pcre_system_version=`pkgconf %{_libdir}/pkgconfig/libpcre.pc --modversion 2>/dev/null ` if [ "$pcre_system_version" != "$pcre_maj.$pcre_min" ] then echo "\n Warning: Error: Bundled PCRE version is not correct. \n\tSystem version number:$pcre_system_version \n\tUpstream version number: $pcre_maj.$pcre_min\n" fi +%endif +%if %{without rocksdb} rm -r storage/rocksdb/ +%endif +# Remove python scripts remains from tokudb upstream (those files are not used anyway) rm -r storage/tokudb/mysql-test/tokudb/t/*.py %build +%{set_build_flags} -%if %runtest +# fail quickly and obviously if user tries to build as root +%if %runselftest if [ x"$(id -u)" = "x0" ]; then - echo "mysql can't run test as root" + echo "mysql's regression tests fail if run as root." + echo "If you really need to build the RPM as root, use" + echo "--nocheck to skip the regression tests." exit 1 fi %endif -CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" -CFLAGS="$CFLAGS -fPIC" +CFLAGS="$CFLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" + +%if %{with debug} +# Override all optimization flags when making a debug build +# -D_FORTIFY_SOURCE requires optimizations enabled. Disable the fortify. +CFLAGS=`echo "$CFLAGS" | sed -r 's/-D_FORTIFY_SOURCE=[012]/-D_FORTIFY_SOURCE=0/'` +CFLAGS=`echo "$CFLAGS" | sed -r 's/-O[0123]//'` + +CFLAGS="$CFLAGS -O0 -g -D_FORTIFY_SOURCE=0" + +%endif # debug + CXXFLAGS="$CFLAGS" -export CFLAGS CXXFLAGS +CPPFLAGS="$CFLAGS" +export CFLAGS CXXFLAGS CPPFLAGS + +# The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX +# so we can't use %%{_datadir} and so forth here. %cmake . \ -DBUILD_CONFIG=mysql_release \ -DFEATURE_SET="community" \ -DINSTALL_LAYOUT=RPM \ - -DDAEMON_NAME="%{name}" \ - -DDAEMON_NO_PREFIX="%{name}" \ - -DLOG_LOCATION="%{_localstatedir}/log/%{name}/%{name}.log" \ - -DPID_FILE_DIR="%{_rundir}/%{name}" \ + -DDAEMON_NAME="%{daemon_name}" \ + -DDAEMON_NO_PREFIX="%{daemon_no_prefix}" \ + -DLOG_LOCATION="%{logfile}" \ + -DPID_FILE_DIR="%{pidfiledir}" \ -DNICE_PROJECT_NAME="MariaDB" \ -DRPM="openeuler1" \ -DCMAKE_INSTALL_PREFIX="%{_prefix}" \ - -DMYSQL_DATADIR="%{_localstatedir}/lib/mysql" \ - -DMYSQL_UNIX_ADDR="%{_sharedstatedir}/mysql/mysql.sock" \ - -DTMPDIR=%{_tmppath} \ - -DENABLED_LOCAL_INFILE=ON \ - -DENABLE_DTRACE=ON \ - -DSECURITY_HARDENED=ON \ - -DWITH_EMBEDDED_SERVER=ON \ - -DWITH_MARIABACKUP=ON \ - -DWITH_UNIT_TESTS=ON \ - -DCONC_WITH_SSL=NO \ - -DWITH_SSL=system \ - -DWITH_ZLIB=system \ - -DWITH_JEMALLOC=NO \ - -DLZ4_LIBS=%{_libdir}/liblz4.so \ - -DWITH_INNODB_LZ4=ON \ - -DPLUGIN_MROONGA=NO \ - -DPLUGIN_OQGRAPH=DYNAMIC \ - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=DYNAMIC \ - -DPLUGIN_ROCKSDB=NO \ - -DPLUGIN_SPHINX=NO \ - -DPLUGIN_TOKUDB=NO \ - -DPLUGIN_CONNECT=NO \ - -DWITH_CASSANDRA=FALSE \ - -DPLUGIN_AWS_KEY_MANAGEMENT=NO \ - -DCONNECT_WITH_MONGO=OFF \ - -DCONNECT_WITH_JDBC=OFF \ -DINSTALL_SYSCONFDIR="%{_sysconfdir}" \ -DINSTALL_SYSCONF2DIR="%{_sysconfdir}/my.cnf.d" \ - -DINSTALL_DOCDIR="share/doc/%{name}" \ - -DINSTALL_DOCREADMEDIR="share/doc/%{name}" \ + -DINSTALL_DOCDIR="share/doc/%{_pkgdocdirname}" \ + -DINSTALL_DOCREADMEDIR="share/doc/%{_pkgdocdirname}" \ -DINSTALL_INCLUDEDIR=include/mysql \ -DINSTALL_INFODIR=share/info \ -DINSTALL_LIBDIR="%{_lib}" \ -DINSTALL_MANDIR=share/man \ - -DINSTALL_MYSQLSHAREDIR=share/%{name} \ - -DINSTALL_MYSQLTESTDIR=share/mysql-test \ - -DINSTALL_PLUGINDIR="%{_lib}/%{name}/plugin" \ + -DINSTALL_MYSQLSHAREDIR=share/%{pkg_name} \ + -DINSTALL_MYSQLTESTDIR=%{?with_test:share/mysql-test}%{!?with_test:} \ + -DINSTALL_PLUGINDIR="%{_lib}/%{pkg_name}/plugin" \ -DINSTALL_SBINDIR=libexec \ -DINSTALL_SCRIPTDIR=bin \ -DINSTALL_SQLBENCHDIR=share \ - -DINSTALL_SUPPORTFILESDIR=share/%{name} \ + -DINSTALL_SUPPORTFILESDIR=share/%{pkg_name} \ + -DINSTALL_PCDIR=%{_lib}/pkgconfig \ + -DMYSQL_DATADIR="%{dbdatadir}" \ + -DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \ + -DTMPDIR=/var/tmp \ + -DGRN_DATA_DIR=share/%{name}-server/groonga \ + -DGROONGA_NORMALIZER_MYSQL_PROJECT_NAME=%{name}-server/groonga-normalizer-mysql \ + -DENABLED_LOCAL_INFILE=ON \ + -DENABLE_DTRACE=ON \ + -DSECURITY_HARDENED=ON \ + -DWITH_WSREP=%{?with_galera:ON}%{!?with_galera:OFF} \ + -DWITH_INNODB_DISALLOW_WRITES=%{?with_galera:ON}%{!?with_galera:OFF} \ + -DWITH_EMBEDDED_SERVER=%{?with_embedded:ON}%{!?with_embedded:OFF} \ + -DWITH_MARIABACKUP=%{?with_backup:ON}%{!?with_backup:NO} \ + -DWITH_UNIT_TESTS=%{?with_test:ON}%{!?with_test:NO} \ + -DCONC_WITH_SSL=%{?with_clibrary:ON}%{!?with_clibrary:NO} \ + -DWITH_SSL=system \ + -DWITH_ZLIB=system \ + -DWITH_JEMALLOC=%{?with_tokudb:yes}%{!?with_tokudb:no} \ + -DLZ4_LIBS=%{_libdir}/liblz4.so \ + -DLZ4_LIBS=%{?with_lz4:%{_libdir}/liblz4.so}%{!?with_lz4:} \ + -DWITH_INNODB_LZ4=%{?with_lz4:ON}%{!?with_lz4:OFF} \ + -DWITH_ROCKSDB_LZ4=%{?with_lz4:ON}%{!?with_lz4:OFF} \ + -DPLUGIN_MROONGA=%{?with_mroonga:DYNAMIC}%{!?with_mroonga:NO} \ + -DPLUGIN_OQGRAPH=%{?with_oqgraph:DYNAMIC}%{!?with_oqgraph:NO} \ + -DPLUGIN_CRACKLIB_PASSWORD_CHECK=%{?with_cracklib:DYNAMIC}%{!?with_cracklib:NO} \ + -DPLUGIN_ROCKSDB=%{?with_rocksdb:DYNAMIC}%{!?with_rocksdb:NO} \ + -DPLUGIN_SPHINX=%{?with_sphinx:DYNAMIC}%{!?with_sphinx:NO} \ + -DPLUGIN_TOKUDB=%{?with_tokudb:DYNAMIC}%{!?with_tokudb:NO} \ + -DPLUGIN_CONNECT=%{?with_connect:DYNAMIC}%{!?with_connect:NO} \ + -DPLUGIN_CLIENT_ED25519=OFF \ + -DPYTHON_SHEBANG=%{python_path} \ + -DPLUGIN_CACHING_SHA2_PASSWORD=%{?with_clibrary:DYNAMIC}%{!?with_clibrary:OFF} \ + -DPLUGIN_AWS_KEY_MANAGEMENT=NO \ + -DCONNECT_WITH_MONGO=OFF \ + -DCONNECT_WITH_JDBC=OFF \ +%{?with_debug: -DCMAKE_BUILD_TYPE=Debug -DWITH_ASAN=OFF -DWITH_INNODB_EXTRA_DEBUG=ON -DWITH_VALGRIND=ON} -cmake -L +cmake ./ -L -%make_build VERBOSE=1 %{?_smp_mflags} +%make_build VERBOSE=1 +# build selinux policy +%if %{with galera} +pushd selinux +make -f /usr/share/selinux/devel/Makefile %{name}-server-galera.pp +%endif + %install %make_install +for header in mysql/server/my_config.h mysql/server/private/config.h; do +%multilib_fix_c_header --file %{_includedir}/$header +done + ln -s mysql_config.1.gz %{buildroot}%{_mandir}/man1/mariadb_config.1.gz -mkdir -p %{buildroot}/%{_libdir}/pkgconfig -mv %{buildroot}/%{_datadir}/pkgconfig/*.pc %{buildroot}/%{_libdir}/pkgconfig +if [ %multilib_capable ] +then +mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_bindir}/mysql_config-%{__isa_bits} +ln -s mysql_config.1 %{buildroot}%{_mandir}/man1/mysql_config-%{__isa_bits}.1 +fi + +%if %{without clibrary} +# Client part should be included in package 'mariadb-connector-c' +rm %{buildroot}%{_libdir}/pkgconfig/libmariadb.pc +%endif + +# install INFO_SRC, INFO_BIN into libdir (upstream thinks these are doc files, +# but that's pretty wacko --- see also %%{name}-file-contents.patch) +install -p -m 644 Docs/INFO_SRC %{buildroot}%{_libdir}/%{pkg_name}/ +install -p -m 644 Docs/INFO_BIN %{buildroot}%{_libdir}/%{pkg_name}/ +rm -r %{buildroot}%{_datadir}/doc/%{_pkgdocdirname}/MariaDB-server-%{version}/ -install -p -m 644 Docs/INFO_SRC %{buildroot}%{_libdir}/%{name}/ -install -p -m 644 Docs/INFO_BIN %{buildroot}%{_libdir}/%{name}/ -rm -r %{buildroot}%{_datadir}/doc/%{name}/MariaDB-server-%{version}/ +# Logfile creation +mkdir -p %{buildroot}%{logfiledir} +chmod 0750 %{buildroot}%{logfiledir} +touch %{buildroot}%{logfile} -mkdir -p %{buildroot}%{_localstatedir}/log/%{name} -chmod 0750 %{buildroot}%{_localstatedir}/log/%{name} -touch %{buildroot}%{_localstatedir}/log/%{name} +mkdir -p %{buildroot}%{pidfiledir} +install -p -m 0755 -d %{buildroot}%{dbdatadir} -mkdir -p %{buildroot}%{_rundir}/%{name} -install -p -m 0755 -d %{buildroot}%{_localstatedir}/lib/mysql +%if %{with config} +install -D -p -m 0644 scripts/my.cnf %{buildroot}%{_sysconfdir}/my.cnf +%else +rm scripts/my.cnf.in +%endif -mv %{buildroot}%{_sysconfdir}/my.cnf.d/server.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/%{name}-server.cnf -mv %{buildroot}%{_sysusersdir}/sysusers.conf %{buildroot}%{_sysusersdir}/%{name}.conf +# use different config file name for each variant of server (mariadb / mysql) +mv %{buildroot}%{_sysconfdir}/my.cnf.d/server.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf +# remove SysV init script and a symlink to that, we use systemd rm %{buildroot}%{_sysconfdir}/init.d/mysql rm %{buildroot}%{_libexecdir}/rcmysql -rm %{buildroot}%{_tmpfilesdir}/tmpfiles.conf -echo "d %{_rundir}/%{name} 0755 mysql mysql -" >>%{buildroot}%{_tmpfilesdir}/%{name}.conf +# install systemd unit files and scripts for handling server startup +install -D -p -m 644 scripts/mysql.service.in %{buildroot}%{_unitdir}/%{daemon_name}.service +install -D -p -m 644 scripts/mysql@.service.in %{buildroot}%{_unitdir}/%{daemon_name}@.service +# Remove the upstream version +rm %{buildroot}%{_tmpfilesdir}/mariadb.conf +# Install downstream version +install -D -p -m 0644 scripts/mysql.tmpfiles.d.in %{buildroot}%{_tmpfilesdir}/%{name}.conf +%if 0%{?mysqld_pid_dir:1} +echo "d %{pidfiledir} 0755 mysql mysql -" >>%{buildroot}%{_tmpfilesdir}/%{name}.conf +%endif + +# helper scripts for service starting +install -p -m 755 scripts/mysql-prepare-db-dir.sh %{buildroot}%{_libexecdir}/mysql-prepare-db-dir +install -p -m 755 scripts/mysql-check-socket.sh %{buildroot}%{_libexecdir}/mysql-check-socket +install -p -m 755 scripts/mysql-check-upgrade.sh %{buildroot}%{_libexecdir}/mysql-check-upgrade +install -p -m 644 scripts/mysql-scripts-common.sh %{buildroot}%{_libexecdir}/mysql-scripts-common +# install aditional galera selinux policy +%if %{with galera} +install -p -m 644 -D selinux/%{name}-server-galera.pp %{buildroot}%{_datadir}/selinux/packages/%{name}/%{name}-server-galera.pp +%endif + +%if %{with test} mv %{buildroot}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process %{buildroot}%{_bindir} ln -s ../../../../../bin/my_safe_process %{buildroot}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process +ln -s unstable-tests %{buildroot}%{_datadir}/mysql-test/rh-skipped-tests.list +%endif -rm %{buildroot}%{_bindir}/mysql_embedded -rm %{buildroot}%{_libdir}/*.a -rm %{buildroot}%{_datadir}/%{name}/{magic,binary-configure} - -rm %{buildroot}%{_datadir}/%{name}/{mysql.server,mysqld_multi.server} +%{?with_embedded:rm %{buildroot}%{_bindir}/mysql_embedded} +rm %{buildroot}%{_mandir}/man1/mysql_embedded.1* +rm %{buildroot}%{_libdir}/*.a +rm %{buildroot}%{_datadir}/%{pkg_name}/binary-configure +rm %{buildroot}%{_datadir}/%{pkg_name}/magic +rm %{buildroot}%{_datadir}/%{pkg_name}/mysql.server +rm %{buildroot}%{_datadir}/%{pkg_name}/mysqld_multi.server rm %{buildroot}%{_bindir}/mytop -mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d -mv %{buildroot}%{_datadir}/%{name}/mysql-log-rotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -chmod 644 %{buildroot}%{_sysconfdir}/logrotate.d/%{name} +# put logrotate script where it needs to be +mkdir -p %{buildroot}%{logrotateddir} +mv %{buildroot}%{_datadir}/%{pkg_name}/mysql-log-rotate %{buildroot}%{logrotateddir}/%{daemon_name} +chmod 644 %{buildroot}%{logrotateddir}/%{daemon_name} +# copy additional docs into build tree so %%doc will find them +install -p -m 0644 %{SOURCE5} %{basename:%{SOURCE5}} +install -p -m 0644 %{SOURCE6} %{basename:%{SOURCE6}} +install -p -m 0644 %{SOURCE7} %{basename:%{SOURCE7}} +install -p -m 0644 %{SOURCE16} %{basename:%{SOURCE16}} +install -p -m 0644 %{SOURCE71} %{basename:%{SOURCE71}} +# install galera config file sed -i -r 's|^wsrep_provider=none|wsrep_provider=%{_libdir}/galera/libgalera_smm.so|' support-files/wsrep.cnf install -p -m 0644 support-files/wsrep.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/galera.cnf -install -D -p -m 0644 support-files/rpm/my.cnf %{buildroot}%{_sysconfdir}/my.cnf +# install the clustercheck script mkdir -p %{buildroot}%{_sysconfdir}/sysconfig touch %{buildroot}%{_sysconfdir}/sysconfig/clustercheck +install -p -m 0755 scripts/clustercheck.sh %{buildroot}%{_bindir}/clustercheck -rm %{buildroot}%{_sysconfdir}/logrotate.d/mysql -rm -r %{buildroot}%{_datadir}/%{name}/policy/apparmor +# remove duplicate logrotate script +rm %{buildroot}%{logrotateddir}/mysql +# Remove AppArmor files +rm -r %{buildroot}%{_datadir}/%{pkg_name}/policy/apparmor -chmod -x %{buildroot}%{_datadir}/sql-bench/myisam.cnf +# Buildroot does not have symlink /lib --> /usr/lib +mv %{buildroot}/%{_lib}/security %{buildroot}%{_libdir} + +# Disable plugins +%if %{with gssapi} +sed -i 's/^plugin-load-add/#plugin-load-add/' %{buildroot}%{_sysconfdir}/my.cnf.d/auth_gssapi.cnf +%endif +%if %{with cracklib} +sed -i 's/^plugin-load-add/#plugin-load-add/' %{buildroot}%{_sysconfdir}/my.cnf.d/cracklib_password_check.cnf +%endif + +%if %{without embedded} +rm %{buildroot}%{_mandir}/man1/{mysql_client_test_embedded,mysqltest_embedded}.1* +%endif +%if %{without clibrary} rm %{buildroot}%{_sysconfdir}/my.cnf.d/client.cnf +# Client library and links rm %{buildroot}%{_libdir}/libmariadb.so.* unlink %{buildroot}%{_libdir}/libmysqlclient.so unlink %{buildroot}%{_libdir}/libmysqlclient_r.so unlink %{buildroot}%{_libdir}/libmariadb.so -rm %{buildroot}%{_libdir}/%{name}/plugin/{dialog.so,mysql_clear_password.so,sha256_password.so,auth_gssapi_client.so} +# Client plugins +rm %{buildroot}%{_libdir}/%{pkg_name}/plugin/{dialog.so,mysql_clear_password.so,sha256_password.so} +%if %{with gssapi} +rm %{buildroot}%{_libdir}/%{pkg_name}/plugin/auth_gssapi_client.so +%endif +%endif -rm %{buildroot}%{_bindir}/{mariadb_config,mysql_config*} +%if %{without clibrary} || %{without devel} +rm %{buildroot}%{_bindir}/mysql_config* +rm %{buildroot}%{_bindir}/mariadb_config rm %{buildroot}%{_mandir}/man1/mysql_config*.1* unlink %{buildroot}%{_mandir}/man1/mariadb_config.1* +%endif -rm %{buildroot}%{_includedir}/mysql/{mysql_version.h,errmsg.h,ma_list.h,ma_pvio.h,mariadb_com.h,\ -mariadb_ctype.h,mariadb_dyncol.h,mariadb_stmt.h,mariadb_version.h,ma_tls.h,mysqld_error.h,mysql.h} +%if %{without clibrary} && %{with devel} +# This files are already included in mariadb-connector-c +rm %{buildroot}%{_includedir}/mysql/mysql_version.h +rm %{buildroot}%{_includedir}/mysql/{errmsg.h,ma_list.h,ma_pvio.h,mariadb_com.h,\ +mariadb_ctype.h,mariadb_dyncol.h,mariadb_stmt.h,mariadb_version.h,ma_tls.h,mysqld_error.h,mysql.h,mariadb_rpl.h} rm -r %{buildroot}%{_includedir}/mysql/{mariadb,mysql} +%endif +%if %{without devel} +rm -r %{buildroot}%{_includedir}/mysql +rm %{buildroot}%{_datadir}/aclocal/mysql.m4 +rm %{buildroot}%{_libdir}/pkgconfig/mariadb.pc +%if %{with clibrary} +rm %{buildroot}%{_libdir}/libmariadb*.so +unlink %{buildroot}%{_libdir}/libmysqlclient.so +unlink %{buildroot}%{_libdir}/libmysqlclient_r.so +%endif +%endif -rm %{buildroot}%{_mandir}/man1/tokuft* -rm -r %{buildroot}%{_datadir}/sql-bench +%if %{without client} +rm %{buildroot}%{_bindir}/{msql2mysql,mysql,mysql_find_rows,\ +mysql_plugin,mysql_waitpid,mysqlaccess,mysqladmin,mysqlbinlog,mysqlcheck,\ +mysqldump,mysqlimport,mysqlshow,mysqlslap} +rm %{buildroot}%{_mandir}/man1/{msql2mysql,mysql,mysql_find_rows,\ +mysql_plugin,mysql_waitpid,mysqlaccess,mysqladmin,mysqlbinlog,mysqlcheck,\ +mysqldump,mysqlimport,mysqlshow,mysqlslap}.1* +rm %{buildroot}%{_sysconfdir}/my.cnf.d/mysql-clients.cnf +%endif + +%if %{with tokudb} +# Move the upstream file to the correct location +mkdir -p %{buildroot}%{_unitdir}/mariadb.service.d +mv %{buildroot}/etc/systemd/system/mariadb.service.d/tokudb.conf %{buildroot}%{_unitdir}/mariadb.service.d/tokudb.conf +%endif +%if %{without config} +rm %{buildroot}%{_sysconfdir}/my.cnf +%endif +%if %{without common} +rm -r %{buildroot}%{_datadir}/%{pkg_name}/charsets +%endif + +%if %{without errmsg} +rm %{buildroot}%{_datadir}/%{pkg_name}/errmsg-utf8.txt +rm -r %{buildroot}%{_datadir}/%{pkg_name}/{english,czech,danish,dutch,estonian,\ +french,german,greek,hungarian,italian,japanese,korean,norwegian,norwegian-ny,\ +polish,portuguese,romanian,russian,serbian,slovak,spanish,swedish,ukrainian,hindi} +%endif + +%if %{without test} +%if %{with embedded} +rm %{buildroot}%{_bindir}/{mysqltest_embedded,mysql_client_test_embedded} +rm %{buildroot}%{_mandir}/man1/{mysqltest_embedded,mysql_client_test_embedded}.1* +%endif +rm %{buildroot}%{_bindir}/test-connect-t +rm %{buildroot}%{_bindir}/{mysql_client_test,mysqltest} +rm %{buildroot}%{_mandir}/man1/{mysql_client_test,my_safe_process,mysqltest}.1* +rm %{buildroot}%{_mandir}/man1/{mysql-test-run,mysql-stress-test}.pl.1* +%endif + +%if %{without galera} +rm %{buildroot}%{_sysconfdir}/my.cnf.d/galera.cnf +rm %{buildroot}%{_sysconfdir}/sysconfig/clustercheck +rm %{buildroot}%{_bindir}/{clustercheck,galera_new_cluster} +rm %{buildroot}%{_bindir}/galera_recovery +rm %{buildroot}%{_datadir}/%{pkg_name}/systemd/use_galera_new_cluster.conf +%endif + +%if %{without bench} +rm -r %{buildroot}%{_datadir}/sql-bench +%else +chmod -x %{buildroot}%{_datadir}/sql-bench/myisam.cnf +%endif + +%if %{without rocksdb} +rm %{buildroot}%{_mandir}/man1/mysql_ldb.1* +%endif %check -%if %runtest +%if %{with test} +%if %runselftest export MTR_PARALLEL=1 export MTR_BUILD_THREAD=%{__isa_bits} - ( set -ex - cd mysql-test - perl ./mysql-test-run.pl --parallel=auto --force --retry=1 --ssl \ - --suite-timeout=900 --testcase-timeout=30 \ - --mysqld=--binlog-format=mixed --force-restart \ - --shutdown-timeout=60 --max-test-fail=5 --big-test \ - --skip-test=spider \ - --skip-test-list=unstable-tests - - perl ./mysql-test-run.pl --parallel=auto --force --retry=1 \ - --suite-timeout=60 --testcase-timeout=10 \ - --mysqld=--binlog-format=mixed --force-restart \ - --shutdown-timeout=60 --max-test-fail=0 --big-test \ - --skip-ssl --suite=spider,spider/bg \ + + export common_testsuite_arguments=" --parallel=auto --force --retry=2 --suite-timeout=900 --testcase-timeout=30 --mysqld=--binlog-format=mixed --force-restart --shutdown-timeout=60 --max-test-fail=5 " + + # If full testsuite has already been run on this version and we don't explicitly want the full testsuite to be run + if [[ "%{last_tested_version}" == "%{version}" ]] && [[ %{force_run_testsuite} -eq 0 ]] + then + # in further rebuilds only run the basic "main" suite (~800 tests) + echo "running only base testsuite" + perl ./mysql-test-run.pl $common_testsuite_arguments --ssl --suite=main --mem --skip-test-list=unstable-tests + fi + + # If either this version wasn't marked as tested yet or I explicitly want to run the testsuite, run everything we have (~4000 test) + if [[ "%{last_tested_version}" != "%{version}" ]] || [[ %{force_run_testsuite} -ne 0 ]] + then + echo "running advanced testsuite" + perl ./mysql-test-run.pl $common_testsuite_arguments --ssl --big-test --skip-test=spider \ + %if %{ignore_testsuite_result} + --max-test-fail=9999 || : + %else + --skip-test-list=unstable-tests + %endif + # Second run for the SPIDER suites that fail with SCA (ssl self signed certificate) + perl ./mysql-test-run.pl $common_testsuite_arguments --skip-ssl --big-test --mem --suite=spider,spider/bg,spider/bugfix,spider/handler \ + %if %{ignore_testsuite_result} + --max-test-fail=999 || : + %endif + # blank line + fi ) +# NOTE: the Spider SE has 2 more hidden testsuites "oracle" and "oracle2". +# however, all of the tests fail with: "failed: 12521: Can't use wrapper 'oracle' for SQL connection" + +%endif %endif %pre server -/usr/sbin/groupadd -g 27 -o -r mysql &> /dev/null || : -/usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /sbin/nologin \ - -c "MySQL Server" -u 27 mysql &> /dev/null || : - - -%ldconfig_scriptlets embedded +/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || : +/usr/sbin/useradd -M -N -g mysql -o -r -d %{mysqluserhome} -s /sbin/nologin \ + -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || : +%if %{with galera} %post server-galera -semanage port -a -t mysqld_port_t -p tcp 4568 &> /dev/null || : -semanage port -a -t mysqld_port_t -p tcp 4567 &> /dev/null || : -semanage port -a -t mysqld_port_t -p udp 4567 &> /dev/null || : +# Do what README at support-files/policy/selinux/README and upstream page +# http://galeracluster.com/documentation-webpages/firewallsettings.html recommend: +semanage port -a -t mysqld_port_t -p tcp 4568 >/dev/null 2>&1 || : +semanage port -a -t mysqld_port_t -p tcp 4567 >/dev/null 2>&1 || : +semanage port -a -t mysqld_port_t -p udp 4567 >/dev/null 2>&1 || : +semodule -i %{_datadir}/selinux/packages/%{name}/%{name}-server-galera.pp >/dev/null 2>&1 || : +%endif %post server -%systemd_post %{name}.service +%systemd_post %{daemon_name}.service %preun server -%systemd_preun %{name}.service +%systemd_preun %{daemon_name}.service +%if %{with galera} %postun server-galera if [ $1 -eq 0 ]; then semodule -r %{name}-server-galera 2>/dev/null || : fi +%endif %postun server -%systemd_postun_with_restart %{name}.service +%systemd_postun_with_restart %{daemon_name}.service +%if %{with client} %files -%config(noreplace) %{_sysconfdir}/my.cnf.d/mysql-clients.cnf +%{_bindir}/msql2mysql %{_bindir}/mysql %{_bindir}/mysql_find_rows -%{_bindir}/mysqlbinlog -%{_bindir}/mysqlcheck -%{_bindir}/mysqldump - +%{_bindir}/mysql_plugin %{_bindir}/mysql_waitpid %{_bindir}/mysqlaccess %{_bindir}/mysqladmin - +%{_bindir}/mysqlbinlog +%{_bindir}/mysqlcheck +%{_bindir}/mysqldump %{_bindir}/mysqlimport -%{_bindir}/mysql_plugin - %{_bindir}/mysqlshow %{_bindir}/mysqlslap -%{_bindir}/msql2mysql +%{_mandir}/man1/msql2mysql.1* %{_mandir}/man1/mysql.1* +%{_mandir}/man1/mysql_find_rows.1* +%{_mandir}/man1/mysql_plugin.1* +%{_mandir}/man1/mysql_waitpid.1* %{_mandir}/man1/mysqlaccess.1* %{_mandir}/man1/mysqladmin.1* %{_mandir}/man1/mysqlbinlog.1* @@ -444,63 +1070,139 @@ fi %{_mandir}/man1/mysqlimport.1* %{_mandir}/man1/mysqlshow.1* %{_mandir}/man1/mysqlslap.1* -%{_mandir}/man1/msql2mysql.1* -%{_mandir}/man1/mysql_find_rows.1* -%{_mandir}/man1/mysql_plugin.1* -%{_mandir}/man1/mysql_waitpid.1* +%config(noreplace) %{_sysconfdir}/my.cnf.d/mysql-clients.cnf +%endif +%if %{with clibrary} +%files libs +%{_libdir}/libmariadb.so.* +%config(noreplace) %{_sysconfdir}/my.cnf.d/client.cnf +%endif +%if %{with config} +%files config +%dir %{_sysconfdir}/my.cnf.d +%config(noreplace) %{_sysconfdir}/my.cnf +%endif +%if %{with common} %files common -%doc %{_defaultdocdir}/%{name} -%dir %{_datadir}/%{name} -%config(noreplace) %{_sysconfdir}/my.cnf -%{_datadir}/%{name}/charsets +%doc %{_datadir}/doc/%{_pkgdocdirname} +%dir %{_datadir}/%{pkg_name} +%{_datadir}/%{pkg_name}/charsets +%if %{with clibrary} +%{_libdir}/%{pkg_name}/plugin/dialog.so +%{_libdir}/%{pkg_name}/plugin/mysql_clear_password.so +%endif +%endif -%files errmessage -%{_datadir}/%{name}/errmsg-utf8.txt -%{_datadir}/%{name}/*/errmsg.sys +%if %{with errmsg} +%files errmsg +%{_datadir}/%{pkg_name}/errmsg-utf8.txt +%{_datadir}/%{pkg_name}/english +%lang(cs) %{_datadir}/%{pkg_name}/czech +%lang(da) %{_datadir}/%{pkg_name}/danish +%lang(nl) %{_datadir}/%{pkg_name}/dutch +%lang(et) %{_datadir}/%{pkg_name}/estonian +%lang(fr) %{_datadir}/%{pkg_name}/french +%lang(de) %{_datadir}/%{pkg_name}/german +%lang(el) %{_datadir}/%{pkg_name}/greek +%lang(hi) %{_datadir}/%{pkg_name}/hindi +%lang(hu) %{_datadir}/%{pkg_name}/hungarian +%lang(it) %{_datadir}/%{pkg_name}/italian +%lang(ja) %{_datadir}/%{pkg_name}/japanese +%lang(ko) %{_datadir}/%{pkg_name}/korean +%lang(no) %{_datadir}/%{pkg_name}/norwegian +%lang(no) %{_datadir}/%{pkg_name}/norwegian-ny +%lang(pl) %{_datadir}/%{pkg_name}/polish +%lang(pt) %{_datadir}/%{pkg_name}/portuguese +%lang(ro) %{_datadir}/%{pkg_name}/romanian +%lang(ru) %{_datadir}/%{pkg_name}/russian +%lang(sr) %{_datadir}/%{pkg_name}/serbian +%lang(sk) %{_datadir}/%{pkg_name}/slovak +%lang(es) %{_datadir}/%{pkg_name}/spanish +%lang(sv) %{_datadir}/%{pkg_name}/swedish +%lang(uk) %{_datadir}/%{pkg_name}/ukrainian +%endif +%if %{with galera} +%files server-galera +%doc Docs/README-wsrep +%license LICENSE.clustercheck +%{_bindir}/clustercheck +%{_bindir}/galera_new_cluster +%{_bindir}/galera_recovery +%{_datadir}/%{pkg_name}/systemd/use_galera_new_cluster.conf +%config(noreplace) %{_sysconfdir}/my.cnf.d/galera.cnf +%attr(0640,root,root) %ghost %config(noreplace) %{_sysconfdir}/sysconfig/clustercheck +%{_datadir}/selinux/packages/%{name}/%{name}-server-galera.pp +%endif %files server -%{_tmpfilesdir}/%{name}.conf -%{_sysusersdir}/%{name}.conf -%config(noreplace) %{_sysconfdir}/my.cnf.d/%{name}-server.cnf -%config(noreplace) %{_sysconfdir}/my.cnf.d/enable_encryption.preset +%doc README.mysql-cnf -%{_bindir}/aria* +%{_bindir}/aria_chk +%{_bindir}/aria_dump_log +%{_bindir}/aria_ftdump +%{_bindir}/aria_pack +%{_bindir}/aria_read_log %{_bindir}/mariadb-service-convert -%{_bindir}/myisam* +%{_bindir}/myisamchk +%{_bindir}/myisam_ftdump +%{_bindir}/myisamlog +%{_bindir}/myisampack %{_bindir}/my_print_defaults %{_bindir}/mysql_install_db %{_bindir}/mysql_secure_installation %{_bindir}/mysql_tzinfo_to_sql %{_bindir}/mysqld_safe -%{_bindir}/mysql_convert_table_format -%{_bindir}/mysql_fix_extensions -%{_bindir}/mysql_setpermission -%{_bindir}/mysqldumpslow -%{_bindir}/mysqld_multi -%{_bindir}/mysqlhotcopy -%{_bindir}/mysql_upgrade %{_bindir}/mysqld_safe_helper -%{_bindir}/perror %{_bindir}/innochecksum %{_bindir}/replace -%{_bindir}/resolve* +%{_bindir}/resolve_stack_dump +%{_bindir}/resolveip %{_bindir}/wsrep_* +%config(noreplace) %{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf +%config(noreplace) %{_sysconfdir}/my.cnf.d/enable_encryption.preset + %{_libexecdir}/mysqld -%dir %{_libdir}/%{name} -%dir %{_libdir}/%{name}/plugin -%{_libdir}/%{name}/plugin/* -%{_libdir}/%{name}/INFO_* -%exclude %{_libdir}/%{name}/plugin/ha_oqgraph.so - -%{_mandir}/man1/aria* -%{_mandir}/man1/galera* + +%{_libdir}/%{pkg_name}/INFO_SRC +%{_libdir}/%{pkg_name}/INFO_BIN +%if %{without common} +%dir %{_datadir}/%{pkg_name} +%endif + +%dir %{_libdir}/%{pkg_name} +%dir %{_libdir}/%{pkg_name}/plugin +%{_libdir}/security/pam_user_map.so +%{_sysconfdir}/security/user_map.conf +%{_libdir}/%{pkg_name}/plugin/* +%{?with_oqgraph:%exclude %{_libdir}/%{pkg_name}/plugin/ha_oqgraph.so} +%{?with_connect:%exclude %{_libdir}/%{pkg_name}/plugin/ha_connect.so} +%{?with_cracklib:%exclude %{_libdir}/%{pkg_name}/plugin/cracklib_password_check.so} +%{?with_rocksdb:%exclude %{_libdir}/%{pkg_name}/plugin/ha_rocksdb.so} +%{?with_tokudb:%exclude %{_libdir}/%{pkg_name}/plugin/ha_tokudb.so} +%{?with_gssapi:%exclude %{_libdir}/%{pkg_name}/plugin/auth_gssapi.so} +%{?with_sphinx:%exclude %{_libdir}/%{pkg_name}/plugin/ha_sphinx.so} +%if %{with clibrary} +%exclude %{_libdir}/%{pkg_name}/plugin/dialog.so +%exclude %{_libdir}/%{pkg_name}/plugin/mysql_clear_password.so +%endif + +%{_mandir}/man1/aria_chk.1* +%{_mandir}/man1/aria_dump_log.1* +%{_mandir}/man1/aria_ftdump.1* +%{_mandir}/man1/aria_pack.1* +%{_mandir}/man1/aria_read_log.1* +%{_mandir}/man1/galera_new_cluster.1* +%{_mandir}/man1/galera_recovery.1* %{_mandir}/man1/mariadb-service-convert.1* -%{_mandir}/man1/myisam* +%{_mandir}/man1/myisamchk.1* +%{_mandir}/man1/myisamlog.1* +%{_mandir}/man1/myisampack.1* +%{_mandir}/man1/myisam_ftdump.1* %{_mandir}/man1/my_print_defaults.1* %{_mandir}/man1/mysql.server.1* %{_mandir}/man1/mysql_install_db.1* @@ -508,98 +1210,207 @@ fi %{_mandir}/man1/mysql_tzinfo_to_sql.1* %{_mandir}/man1/mysqld_safe.1* %{_mandir}/man1/mysqld_safe_helper.1* -%{_mandir}/man1/mysql_convert_table_format.1* -%{_mandir}/man1/mysql_fix_extensions.1* -%{_mandir}/man1/mysqldumpslow.1* -%{_mandir}/man1/mysqld_multi.1* -%{_mandir}/man1/mysqlhotcopy.1* -%{_mandir}/man1/mysql_setpermission.1* -%{_mandir}/man1/mysql_upgrade.1* -%{_mandir}/man1/perror.1* %{_mandir}/man1/innochecksum.1* %{_mandir}/man1/replace.1* -%{_mandir}/man1/resolve* -%{_mandir}/man1/wsrep_*.1* +%{_mandir}/man1/resolveip.1* +%{_mandir}/man1/resolve_stack_dump.1* %{_mandir}/man8/mysqld.8* +%{_mandir}/man1/wsrep_*.1* -%{_datadir}/%{name}/*.sql -%{_datadir}/%{name}/wsrep.cnf -%{_datadir}/%{name}/wsrep_notify -%dir %{_datadir}/%{name}/policy -%dir %{_datadir}/%{name}/policy/selinux -%{_datadir}/%{name}/policy/selinux/* -%{_datadir}/%{name}/systemd/*.service +%{_datadir}/%{pkg_name}/fill_help_tables.sql +%{_datadir}/%{pkg_name}/install_spider.sql +%{_datadir}/%{pkg_name}/maria_add_gis_sp.sql +%{_datadir}/%{pkg_name}/maria_add_gis_sp_bootstrap.sql +%{_datadir}/%{pkg_name}/mysql_system_tables.sql +%{_datadir}/%{pkg_name}/mysql_system_tables_data.sql +%{_datadir}/%{pkg_name}/mysql_test_data_timezone.sql +#%{_datadir}/%{pkg_name}/mysql_to_mariadb.sql +%{_datadir}/%{pkg_name}/mysql_performance_tables.sql +%{_datadir}/%{pkg_name}/mysql_test_db.sql +%if %{with mroonga} +%{_datadir}/%{pkg_name}/mroonga/install.sql +%{_datadir}/%{pkg_name}/mroonga/uninstall.sql +%license %{_datadir}/%{pkg_name}/mroonga/COPYING +%license %{_datadir}/%{pkg_name}/mroonga/AUTHORS +%license %{_datadir}/%{name}-server/groonga-normalizer-mysql/lgpl-2.0.txt +%license %{_datadir}/%{name}-server/groonga/COPYING +%doc %{_datadir}/%{name}-server/groonga-normalizer-mysql/README.md +%doc %{_datadir}/%{name}-server/groonga/README.md +%endif +%{_datadir}/%{pkg_name}/wsrep.cnf +%{_datadir}/%{pkg_name}/wsrep_notify +%dir %{_datadir}/%{pkg_name}/policy +%dir %{_datadir}/%{pkg_name}/policy/selinux +%{_datadir}/%{pkg_name}/policy/selinux/README +%{_datadir}/%{pkg_name}/policy/selinux/mariadb-server.* +%{_datadir}/%{pkg_name}/policy/selinux/mariadb.* +%{_datadir}/%{pkg_name}/systemd/mariadb.service +# mariadb@ is installed only when we have cmake newer than 3.3 +%{_datadir}/%{pkg_name}/systemd/mariadb@.service + +%{_unitdir}/%{daemon_name}* +%{?with_tokudb:%exclude %{_unitdir}/mariadb.service.d/tokudb.conf} + +%{_libexecdir}/mysql-prepare-db-dir +%{_libexecdir}/mysql-check-socket +%{_libexecdir}/mysql-check-upgrade +%{_libexecdir}/mysql-scripts-common + +%attr(0755,mysql,mysql) %dir %{pidfiledir} +%attr(0755,mysql,mysql) %dir %{dbdatadir} +%attr(0750,mysql,mysql) %dir %{logfiledir} +%attr(0640,mysql,mysql) %config %ghost %verify(not md5 size mtime) %{logfile} +%config(noreplace) %{logrotateddir}/%{daemon_name} -%{_unitdir}/%{name}* +%{_tmpfilesdir}/%{name}.conf +%{_sysusersdir}/%{name}.conf -%attr(0755,mysql,mysql) %dir %{_rundir}/%{name} -%attr(0755,mysql,mysql) %dir %{_localstatedir}/lib/mysql -%attr(0750,mysql,mysql) %dir %{_localstatedir}/log/%{name} -%attr(0640,mysql,mysql) %config %ghost %verify(not md5 size mtime) %{_localstatedir}/log/%{name}/%{name}.log -%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%if %{with cracklib} +%files cracklib-password-check +%config(noreplace) %{_sysconfdir}/my.cnf.d/cracklib_password_check.cnf +%{_libdir}/%{pkg_name}/plugin/cracklib_password_check.so +%endif +%if %{with backup} +%files backup +%{_bindir}/mariabackup +%{_bindir}/mbstream +%{_mandir}/man1/mariabackup.1* +%{_mandir}/man1/mbstream.1* +%endif -%files server-galera -%doc Docs/README-wsrep -%config(noreplace) %{_sysconfdir}/my.cnf.d/galera.cnf -%attr(0640,root,root) %ghost %config(noreplace) %{_sysconfdir}/sysconfig/clustercheck -%{_bindir}/galera_new_cluster -%{_bindir}/galera_recovery -%{_datadir}/%{name}/systemd/use_galera_new_cluster.conf +%if %{with rocksdb} +%files rocksdb-engine +%config(noreplace) %{_sysconfdir}/my.cnf.d/rocksdb.cnf +%{_bindir}/myrocks_hotbackup +%{_bindir}/mysql_ldb +%{_bindir}/sst_dump +%{_libdir}/%{pkg_name}/plugin/ha_rocksdb.so +%{_mandir}/man1/mysql_ldb.1* +%endif + +%if %{with tokudb} +%files tokudb-engine +%{_bindir}/tokuftdump +%{_bindir}/tokuft_logprint +%{_mandir}/man1/tokuftdump.1* +%{_mandir}/man1/tokuft_logprint.1* +%config(noreplace) %{_sysconfdir}/my.cnf.d/tokudb.cnf +%{_libdir}/%{pkg_name}/plugin/ha_tokudb.so +%{_unitdir}/mariadb.service.d/tokudb.conf +%endif +%if %{with gssapi} %files gssapi-server +%{_libdir}/%{pkg_name}/plugin/auth_gssapi.so %config(noreplace) %{_sysconfdir}/my.cnf.d/auth_gssapi.cnf -%{_libdir}/%{name}/plugin/auth_gssapi.so - - -%files devel -%{_includedir}/* -%{_datadir}/aclocal/mysql.m4 -%{_libdir}/pkgconfig/mariadb.pc +%endif +%if %{with sphinx} +%files sphinx-engine +%{_libdir}/%{pkg_name}/plugin/ha_sphinx.so +%endif +%if %{with oqgraph} %files oqgraph-engine %config(noreplace) %{_sysconfdir}/my.cnf.d/oqgraph.cnf -%{_libdir}/%{name}/plugin/ha_oqgraph.so - - -%files backup -%{_bindir}/mariabackup -%{_bindir}/mbstream +%{_libdir}/%{pkg_name}/plugin/ha_oqgraph.so +%endif +%if %{with connect} +%files connect-engine +%config(noreplace) %{_sysconfdir}/my.cnf.d/connect.cnf +%{_libdir}/%{pkg_name}/plugin/ha_connect.so +%endif -%files cracklib -%config(noreplace) %{_sysconfdir}/my.cnf.d/cracklib_password_check.cnf -%{_libdir}/%{name}/plugin/cracklib_password_check.so +%files server-utils +# Perl utilities +%{_bindir}/mysql_convert_table_format +%{_bindir}/mysql_fix_extensions +%{_bindir}/mysql_setpermission +%{_bindir}/mysqldumpslow +%{_bindir}/mysqld_multi +%{_bindir}/mysqlhotcopy +%{_mandir}/man1/mysql_convert_table_format.1* +%{_mandir}/man1/mysql_fix_extensions.1* +%{_mandir}/man1/mysqldumpslow.1* +%{_mandir}/man1/mysqld_multi.1* +%{_mandir}/man1/mysqlhotcopy.1* +%{_mandir}/man1/mysql_setpermission.1* +# Utilities that can be used remotely +%{_bindir}/mysql_upgrade +%{_bindir}/perror +%{_mandir}/man1/mysql_upgrade.1* +%{_mandir}/man1/perror.1* +%if %{with devel} +%files devel +%{_includedir}/* +%{_datadir}/aclocal/mysql.m4 +%{_libdir}/pkgconfig/mariadb.pc +%if %{with clibrary} +%{_libdir}/{libmysqlclient.so.18,libmariadb.so,libmysqlclient.so,libmysqlclient_r.so} +%{_bindir}/mysql_config* +%{_bindir}/mariadb_config* +%{_libdir}/libmariadb.so +%{_libdir}/libmysqlclient.so +%{_libdir}/libmysqlclient_r.so +%{_mandir}/man1/mysql_config* +%{_mandir}/man1/mariadb_config* +%endif +%endif +%if %{with embedded} %files embedded %{_libdir}/libmariadbd.so.* - %files embedded-devel %{_libdir}/libmysqld.so %{_libdir}/libmariadbd.so +%endif +%if %{with bench} +%files bench +%{_datadir}/sql-bench +%doc %{_datadir}/sql-bench/README +%endif +%if %{with test} %files test -%{_bindir}/mysqltest -%{_bindir}/mysql_client_test +%if %{with embedded} %{_bindir}/test-connect-t %{_bindir}/mysql_client_test_embedded %{_bindir}/mysqltest_embedded +%{_mandir}/man1/mysql_client_test_embedded.1* +%{_mandir}/man1/mysqltest_embedded.1* +%endif +%{_bindir}/mysql_client_test %{_bindir}/my_safe_process +%{_bindir}/mysqltest +%attr(-,mysql,mysql) %{_datadir}/mysql-test %{_mandir}/man1/mysql_client_test.1* %{_mandir}/man1/my_safe_process.1* %{_mandir}/man1/mysqltest.1* -%{_mandir}/man1/mysql_client_test_embedded.1* -%{_mandir}/man1/mysqltest_embedded.1* %{_mandir}/man1/mysql-stress-test.pl.1* %{_mandir}/man1/mysql-test-run.pl.1* -%attr(-,mysql,mysql) %{_datadir}/mysql-test - +%endif %changelog +* Wed Fed 23 2022 bzhaoop - 3:10.3.34-1 +- Bump version to latest 10.3.34 version +- For resolving the CVEs, which includes: +- CVE-2021-46659 +- CVE-2021-46664 +- CVE-2021-46665 +- CVE-2021-46663 +- CVE-2021-46662 +- CVE-2021-46666 +- CVE-2021-46667 +- CVE-2021-46661 +- CVE-2021-46669 +- CVE-2021-46657 +- Above all CVEs needs to bump to the latest version for resolve. + * Tue Jul 27 2021 bzhaoop -3:10.3.9-12 - Increase the build speed diff --git a/my.cnf.in b/my.cnf.in new file mode 100644 index 0000000000000000000000000000000000000000..247e12d8e31678188fe96495defbfe99a0464aef --- /dev/null +++ b/my.cnf.in @@ -0,0 +1,18 @@ +# +# This group is read both both by the client and the server +# use it for options that affect everything +# +[client-server] + +# +# This group is read by the server +# +[mysqld] +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 + +# +# include all files from the config directory +# +!includedir @INSTALL_SYSCONF2DIR@ + diff --git a/mysql-check-socket.sh b/mysql-check-socket.sh new file mode 100644 index 0000000000000000000000000000000000000000..407523fd594846e799cceaf2c56bd3c27bad0519 --- /dev/null +++ b/mysql-check-socket.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# We check if there is already a process using the socket file, +# since otherwise the systemd service file could report false +# positive result when starting and mysqld_safe could remove +# a socket file, which is actually being used by a different daemon. + +source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common" + +if test -e "$socketfile" ; then + echo "Socket file $socketfile exists." >&2 + + # no write permissions + if ! test -w "$socketfile" ; then + echo "Not enough permission to write to the socket file $socketfile, which is suspicious." >&2 + echo "Please, remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # not a socket file + if ! test -S "$socketfile" ; then + echo "The file $socketfile is not a socket file, which is suspicious." >&2 + echo "Please, remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # some process uses the socket file + response=`@bindir@/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER --connect-timeout="${CHECKSOCKETTIMEOUT:-10}" ping 2>&1` + if [ $? -eq 0 ] || echo "$response" | grep -q "Access denied for user" ; then + echo "Is another MySQL daemon already running with the same unix socket?" >&2 + echo "Please, stop the process using the socket $socketfile or remove the file manually to start the service." >&2 + exit 1 + fi + + # socket file is a garbage + echo "No process is using $socketfile, which means it is a garbage, so it will be removed automatically." >&2 +fi + +exit 0 diff --git a/mysql-check-upgrade.sh b/mysql-check-upgrade.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bfd3bc6ae8a5bc0ffcddf1753fcf663df5f893c --- /dev/null +++ b/mysql-check-upgrade.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common" + +upgrade_info_file="$datadir/mysql_upgrade_info" +version=0 +# get version as integer from mysql_upgrade_info file +if [ -f "$upgrade_info_file" ] && [ -r "$upgrade_info_file" ] ; then + version_major=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\1/') + version_minor=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\2/') + if [[ $version_major =~ ^[0-9]+$ ]] && [[ $version_minor =~ ^[0-9]+$ ]] ; then + version=$((version_major*100+version_minor)) + fi +fi + +# compute current version as integer +thisversion=$((@MAJOR_VERSION@*100+@MINOR_VERSION@)) + +# provide warning in cases we should run mysql_upgrade +if [ $version -ne $thisversion ] ; then + + # give extra warning if some version seems to be skipped + if [ $version -gt 0 ] && [ $version -lt 505 ] ; then + echo "The datadir located at $datadir seems to be older than of a version 5.5. Please, mind that as a general rule, to upgrade from one release series to another, go to the next series rather than skipping a series." >&2 + fi + + cat <&2 +The datadir located at $datadir needs to be upgraded using 'mysql_upgrade' tool. This can be done using the following steps: + + 1. Back-up your data before with 'mysql_upgrade' + 2. Start the database daemon using 'service @DAEMON_NAME@ start' + 3. Run 'mysql_upgrade' with a database user that has sufficient privileges + +Read more about 'mysql_upgrade' usage at: +https://mariadb.com/kb/en/mariadb/documentation/sql-commands/table-commands/mysql_upgrade/ +EOF +fi + +exit 0 diff --git a/mysql-prepare-db-dir.sh b/mysql-prepare-db-dir.sh new file mode 100644 index 0000000000000000000000000000000000000000..a82479f4842f54e7e133f3b3a36b9b5ce5bc356f --- /dev/null +++ b/mysql-prepare-db-dir.sh @@ -0,0 +1,137 @@ +#!/bin/sh + +# This script creates the mysql data directory during first service start. +# In subsequent starts, it does nothing much. + +source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common" + +export LC_ALL=C + +# Returns content of the specified directory +# If listing files fails, fake-file is returned so which means +# we'll behave like there was some data initialized +# Some files or directories are fine to be there, so those are +# explicitly removed from the listing +# @param datadir +list_datadir () +{ + ( ls -1A "$1" 2>/dev/null || echo "fake-file" ) | grep -v \ + -e '^lost+found$' \ + -e '\.err$' \ + -e '^.bash_history$' +} + +# Checks whether datadir should be initialized +# @param datadir +should_initialize () +{ + test -z "$(list_datadir "$1")" +} + +# If two args given first is user, second is group +# otherwise the arg is the systemd service file +if [ "$#" -eq 2 ] +then + myuser="$1" + mygroup="$2" +else + # Absorb configuration settings from the specified systemd service file, + # or the default service if not specified + SERVICE_NAME="$1" + if [ x"$SERVICE_NAME" = x ] + then + SERVICE_NAME=@DAEMON_NAME@.service + fi + + myuser=`systemctl show -p User "${SERVICE_NAME}" | + sed 's/^User=//'` + if [ x"$myuser" = x ] + then + myuser=mysql + fi + + mygroup=`systemctl show -p Group "${SERVICE_NAME}" | + sed 's/^Group=//'` + if [ x"$mygroup" = x ] + then + mygroup=mysql + fi +fi + +# Set up the errlogfile with appropriate permissions +if [ ! -e "$errlogfile" -a ! -h "$errlogfile" -a x$(dirname "$errlogfile") = "x/var/log" ]; then + case $(basename "$errlogfile") in + mysql*.log|mariadb*.log) install /dev/null -m0640 -o$myuser -g$mygroup "$errlogfile" ;; + *) ;; + esac +else + # Provide some advice if the log file cannot be created by this script + errlogdir=$(dirname "$errlogfile") + if ! [ -d "$errlogdir" ] ; then + echo "The directory $errlogdir does not exist." >&2 + exit 1 + elif [ -e "$errlogfile" -a ! -w "$errlogfile" ] ; then + echo "The log file $errlogfile cannot be written, please, fix its permissions." >&2 + echo "The daemon will be run under $myuser:$mygroup" >&2 + exit 1 + fi +fi + +# Make the data directory if doesn't exist or empty +if should_initialize "$datadir" ; then + # First, make sure $datadir is there with correct permissions + # (note: if it's not, and we're not root, this'll fail ...) + if [ ! -e "$datadir" -a ! -h "$datadir" ] + then + mkdir -p "$datadir" || exit 1 + fi + chown "$myuser:$mygroup" "$datadir" + chmod 0755 "$datadir" + [ -x /sbin/restorecon ] && /sbin/restorecon "$datadir" + + # Now create the database + echo "Initializing @NICE_PROJECT_NAME@ database" >&2 + # Avoiding deletion of files not created by mysql_install_db is + # guarded by time check and sleep should help work-arounded + # potential issues on systems with 1 second resolution timestamps + # https://bugzilla.redhat.com/show_bug.cgi?id=1335849#c19 + INITDB_TIMESTAMP=`LANG=C date -u` + sleep 1 + @bindir@/mysql_install_db --rpm --datadir="$datadir" --user="$myuser" --skip-test-db >&2 + ret=$? + if [ $ret -ne 0 ] ; then + echo "Initialization of @NICE_PROJECT_NAME@ database failed." >&2 + echo "Perhaps @sysconfdir@/my.cnf is misconfigured or there is some problem with permissions of $datadir." >&2 + # Clean up any partially-created database files + if [ ! -e "$datadir/mysql/user.frm" ] && [ -d "$datadir" ] ; then + echo "Initialization of @NICE_PROJECT_NAME@ database was not finished successfully." >&2 + echo "Files created so far will be removed." >&2 + find "$datadir" -mindepth 1 -maxdepth 1 -newermt "$INITDB_TIMESTAMP" \ + -not -name "lost+found" -exec rm -rf {} + + if [ $? -ne 0 ] ; then + echo "Removing of created files was not successfull." >&2 + echo "Please, clean directory $datadir manually." >&2 + fi + else + echo "However, part of data has been initialized and those will not be removed." >&2 + echo "Please, clean directory $datadir manually." >&2 + fi + exit $ret + fi + # upgrade does not need to be run on a fresh datadir + echo "@VERSION@-MariaDB" >"$datadir/mysql_upgrade_info" +else + if [ -d "$datadir/mysql/" ] ; then + # mysql dir exists, it seems data are initialized properly + echo "Database @NICE_PROJECT_NAME@ is probably initialized in $datadir already, nothing is done." + echo "If this is not the case, make sure the $datadir is empty before running `basename $0`." + else + # if the directory is not empty but mysql/ directory is missing, then + # print error and let user to initialize manually or empty the directory + echo "Database @NICE_PROJECT_NAME@ is not initialized, but the directory $datadir is not empty, so initialization cannot be done." >&2 + echo "Make sure the $datadir is empty before running `basename $0`." >&2 + exit 1 + fi +fi + +exit 0 diff --git a/mysql-scripts-common.sh b/mysql-scripts-common.sh new file mode 100644 index 0000000000000000000000000000000000000000..e270433360f57b31973933e1062a8925deed042f --- /dev/null +++ b/mysql-scripts-common.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# Some useful functions used in other MySQL helper scripts +# This scripts defines variables datadir, errlogfile, socketfile + +export LC_ALL=C + +# extract value of a MySQL option from config files +# Usage: get_mysql_option VARNAME DEFAULT SECTION [ SECTION, ... ] +# result is returned in $result +# We use my_print_defaults which prints all options from multiple files, +# with the more specific ones later; hence take the last match. +get_mysql_option(){ + if [ $# -ne 3 ] ; then + echo "get_mysql_option requires 3 arguments: section option default_value" + return + fi + sections="$1" + option_name="$2" + default_value="$3" + result=`@bindir@/my_print_defaults $my_print_defaults_extra_args $sections | sed -n "s/^--${option_name}=//p" | tail -n 1` + if [ -z "$result" ]; then + # not found, use default + result="${default_value}" + fi +} + +# For the case of running more instances via systemd, scrits that source +# this file can get --default-group-suffix or similar option as the first +# argument. The utility my_print_defaults needs to use it as well, so the +# scripts sourcing this file work with the same options as the daemon. +my_print_defaults_extra_args='' +while echo "$1" | grep -q '^--defaults' ; do + my_print_defaults_extra_args="${my_print_defaults_extra_args} $1" + shift +done + +# Defaults here had better match what mysqld_safe will default to +# The option values are generally defined on three important places +# on the default installation: +# 1) default values are hardcoded in the code of mysqld daemon or +# mysqld_safe script +# 2) configurable values are defined in @sysconfdir@/my.cnf +# 3) default values for helper scripts are specified bellow +# So, in case values are defined in my.cnf, we need to get that value. +# In case they are not defined in my.cnf, we need to get the same value +# in the daemon, as in the helper scripts. Thus, default values here +# must correspond with values defined in mysqld_safe script and source +# code itself. + +server_sections="mysqld_safe mysqld server mysqld-@MAJOR_VERSION@.@MINOR_VERSION@ mariadb mariadb-@MAJOR_VERSION@.@MINOR_VERSION@ client-server" + +get_mysql_option "$server_sections" datadir "@MYSQL_DATADIR@" +datadir="$result" + +# if there is log_error in the my.cnf, my_print_defaults still +# returns log-error +# log-error might be defined in mysqld_safe and mysqld sections, +# the former has bigger priority +get_mysql_option "$server_sections" log-error "$datadir/`uname -n`.err" +errlogfile="$result" + +get_mysql_option "$server_sections" socket "@MYSQL_UNIX_ADDR@" +socketfile="$result" + +get_mysql_option "$server_sections" pid-file "$datadir/`uname -n`.pid" +pidfile="$result" + diff --git a/mysql.service.in b/mysql.service.in new file mode 100644 index 0000000000000000000000000000000000000000..6f84dd3cad317b0134975a2b3960f46fc8b7f85d --- /dev/null +++ b/mysql.service.in @@ -0,0 +1,73 @@ +# It's not recommended to modify this file in-place, because it will be +# overwritten during package upgrades. If you want to customize, the +# best way is to create a file "/etc/systemd/system/@DAEMON_NAME@.service", +# containing +# .include /usr/lib/systemd/system/@DAEMON_NAME@.service +# ...make your changes here... +# or create a file "/etc/systemd/system/@DAEMON_NAME@.service.d/foo.conf", +# which doesn't need to include ".include" call and which will be parsed +# after the file @DAEMON_NAME@.service itself is parsed. +# +# For more info about custom unit files, see systemd.unit(5) or +# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F + +# For example, if you want to increase mysql's open-files-limit to 10000, +# you need to increase systemd's LimitNOFILE setting, so create a file named +# "/etc/systemd/system/@DAEMON_NAME@.service.d/limits.conf" containing: +# [Service] +# LimitNOFILE=10000 + +# Note: /usr/lib/... is recommended in the .include line though /lib/... +# still works. +# Don't forget to reload systemd daemon after you change unit configuration: +# root> systemctl --system daemon-reload + +# Use [mysqld.INSTANCENAME] as sections in my.cnf to configure this instance. + +[Unit] +Description=@NICE_PROJECT_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@ database server +Documentation=man:mysqld(8) +Documentation=https://mariadb.com/kb/en/library/systemd/ +After=network.target + +[Install] +WantedBy=multi-user.target +Alias=mysql.service +Alias=mysqld.service + +[Service] +Type=notify +User=mysql +Group=mysql + +ExecStartPre=@libexecdir@/mysql-check-socket +# '%n' expands to 'Full unit name'; man systemd.unit +ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n +# MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf +# Note: we set --basedir to prevent probes that might trigger SELinux alarms, +# per bug #547485 +ExecStart=@libexecdir@/mysqld --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER +ExecStartPost=@libexecdir@/mysql-check-upgrade + +# Setting this to true can break replication and the Type=notify settings +# See also bind-address mysqld option. +PrivateNetwork=false + +KillMode=process +KillSignal=SIGTERM + +# Don't want to see an automated SIGKILL ever +SendSIGKILL=no + +# Restart crashed server only, on-failure would also restart, for example, when +# my.cnf contains unknown option +Restart=on-abort +RestartSec=5s + +UMask=007 + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=300 + +# Place temp files in a secure directory, not /tmp +PrivateTmp=true diff --git a/mysql.tmpfiles.d.in b/mysql.tmpfiles.d.in new file mode 100644 index 0000000000000000000000000000000000000000..9e6b6e8bf58dc532bbd1c3d8280fd591d292f46a --- /dev/null +++ b/mysql.tmpfiles.d.in @@ -0,0 +1,3 @@ +# Do not edit this file. +# To override this, put /etc/tmpfiles.d/mariadb.conf instead. +d @PID_FILE_DIR@ 0755 mysql mysql - diff --git a/mysql@.service.in b/mysql@.service.in new file mode 100644 index 0000000000000000000000000000000000000000..b36ce6d80715091786d1f5c2918dd8ee364e2ae2 --- /dev/null +++ b/mysql@.service.in @@ -0,0 +1,79 @@ +# Multi instance version of mariadb. For if you run mutiple verions at once. +# Also used for @DAEMON_NAME@@bootstrap to bootstrap Galera. +# +# To use multi instance variant, use [mysqld.INSTANCENAME] as sections in my.cnf +# and start the service via: +# systemctl start @DAEMON_NAME@@{instancename}.server +# +# It's not recommended to modify this file in-place, because it will be +# overwritten during package upgrades. If you want to customize, the +# best way is to create a file "/etc/systemd/system/@DAEMON_NAME@.service", +# containing +# .include /usr/lib/systemd/system/@DAEMON_NAME@.service +# ...make your changes here... +# or create a file "/etc/systemd/system/@DAEMON_NAME@.service.d/foo.conf", +# which doesn't need to include ".include" call and which will be parsed +# after the file @DAEMON_NAME@.service itself is parsed. +# +# For more info about custom unit files, see systemd.unit(5) or +# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F + +# For example, if you want to increase mysql's open-files-limit to 10000, +# you need to increase systemd's LimitNOFILE setting, so create a file named +# "/etc/systemd/system/@DAEMON_NAME@.service.d/limits.conf" containing: +# [Service] +# LimitNOFILE=10000 + +# Note: /usr/lib/... is recommended in the .include line though /lib/... +# still works. +# Don't forget to reload systemd daemon after you change unit configuration: +# root> systemctl --system daemon-reload + +# Use [mysqld.INSTANCENAME] as sections in my.cnf to configure this instance. + +[Unit] +Description=@NICE_PROJECT_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@ database server +Documentation=man:mysqld(8) +Documentation=https://mariadb.com/kb/en/library/systemd/ +After=network.target + +[Install] +WantedBy=multi-user.target +Alias=mysql.service +Alias=mysqld.service + +[Service] +Type=notify +User=mysql +Group=mysql + +ExecStartPre=@libexecdir@/mysql-check-socket --defaults-group-suffix=.%I +ExecStartPre=@libexecdir@/mysql-prepare-db-dir --defaults-group-suffix=.%I %n +# MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf +# Note: we set --basedir to prevent probes that might trigger SELinux alarms, +# per bug #547485 +ExecStart=@libexecdir@/mysqld --defaults-group-suffix=.%I --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER +ExecStartPost=@libexecdir@/mysql-check-upgrade --defaults-group-suffix=.%I + +# Setting this to true can break replication and the Type=notify settings +# See also bind-address mysqld option. +PrivateNetwork=false + +KillMode=process +KillSignal=SIGTERM + +# Don't want to see an automated SIGKILL ever +SendSIGKILL=no + +# Restart crashed server only, on-failure would also restart, for example, when +# my.cnf contains unknown option +Restart=on-abort +RestartSec=5s + +UMask=007 + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=300 + +# Place temp files in a secure directory, not /tmp +PrivateTmp=true diff --git a/mysql_config_multilib.sh b/mysql_config_multilib.sh new file mode 100644 index 0000000000000000000000000000000000000000..06c2a2b45dc2cd3ec4c58a5fad43543873954bfa --- /dev/null +++ b/mysql_config_multilib.sh @@ -0,0 +1,26 @@ +#! /bin/sh +# +# Wrapper script for mysql_config to support multilib +# +# This command respects setarch + +bits=$(rpm --eval %__isa_bits) + +case $bits in + 32|64) status=known ;; + *) status=unknown ;; +esac + +if [ "$status" = "unknown" ] ; then + echo "$0: error: command 'rpm --eval %__isa_bits' returned unknown value: $bits" + exit 1 +fi + + +if [ -x @bindir@/mysql_config-$bits ] ; then + @bindir@/mysql_config-$bits "$@" +else + echo "$0: error: needed binary: @bindir@/mysql_config-$bits is missing" + exit 1 +fi + diff --git a/skipped-tests-arm.list b/skipped-tests-arm.list new file mode 100644 index 0000000000000000000000000000000000000000..f77486d209c4dda527608c64637b05430af42cb9 --- /dev/null +++ b/skipped-tests-arm.list @@ -0,0 +1,47 @@ +# Fails since 10.3.25 on aarch64 +encryption.create_or_replace : + +# Fails since 10.3.8, only on armv7hl +versioning.auto_increment : +versioning.commit_id : +versioning.delete : +versioning.foreign : +versioning.insert : +versioning.insert2 : +versioning.select2 : +versioning.update : +# Fails since 10.3.9, only on armv7hl +versioning.alter : +versioning.replace : +versioning.select : +versioning.truncate : +versioning.trx_id : +# Fails since 10.3.17, only on armv7hl +versioning.online : +versioning.partition : +versioning.replace : +# Fails since 10.3.22, only on armv7hl +versioning.delete_history : +# Fails since 10.3.23, only on armv7hl +versioning.view : + +# Fails since 10.3.9, only on armv7hl +federated.federatedx_versioning : + +# Fails from 10.3.17 only on armv7hl +mariabackup.system_versioning : + +# Fail since 10.3.26 only on armv7hl +versioning.partition_rotation : + +# Fails from 10.3.28 only on armv7hl on F33 +# error "memory exhausted" +main.execution_constants : + +# Fails from 10.3.28 only on armv7hl on F34 +# error "Table './mysql/user' is marked as crashed and should be repaired" +main.plugin_innodb : +main.plugin_auth : +main.plugin_loaderr : +main.bootstrap_innodb : +main.plugin_not_embedded : diff --git a/skipped-tests-base.list b/skipped-tests-base.list new file mode 100644 index 0000000000000000000000000000000000000000..314d4c1f1824072b9b36be40a35a835f20ba2ffe --- /dev/null +++ b/skipped-tests-base.list @@ -0,0 +1,39 @@ +# The SSL test are failing correctly. For more explanation, see: +# https://jira.mariadb.org/browse/MDEV-8404?focusedCommentId=84275&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-84275 +main.ssl_7937 : #1399847 +main.ssl_8k_key : +main.ssl_crl : #1399847 +main.ssl_system_ca : + +perfschema.nesting : #1399847 +perfschema.socket_summary_by_instance_func : #1399847 +perfschema.socket_summary_by_event_name_func : + +# ------------------------------ +# Tests that fails because of 'Self Signed Certificate in the Certificate Chain' +perfschema.cnf_option : + +rpl.rpl_row_img_blobs : +rpl.rpl_row_img_eng_min : +rpl.rpl_row_img_eng_noblob : + +sys_vars.slave_parallel_threads_basic : + +# ------------------------------ +# Fails since 10.1.12 +innodb.innodb_defrag_binlog : + +# Fails everywhere since 10.2.15 +main.userstat : + +# ------------------------------ +# Expected to fail, the plugin is not build with server, but 'mariadb-connector-c' instead +plugins.auth_ed25519 : + +# ------------------------------ +# Fails on x86_64 and i686 since 10.3.25 +disks.disks : +disks.disks_notembedded : + +# Since 10.3.26 produces a warning to the test logfile which causes the test to fail +plugins.feedback_plugin_load : \ No newline at end of file