* Sun Apr 20 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-14.sme
- set innodb_page_size=64k [SME: 12982] breaking change, needs backup and restore of mariadb databases - convert mysql* bins call to mariadb-* [SME: 12983] - revert [SME: 12591]
This commit is contained in:
		@@ -18,12 +18,12 @@ onfailure () {
 | 
			
		||||
	echo $message | /usr/bin/mail -s "error on backup of $db MariaDB database" admin
 | 
			
		||||
    fi
 | 
			
		||||
    message="$message \nThere was an error trying to dump database $db, please check for table errors in this db. Forcing a backup of the corrupted DB."
 | 
			
		||||
    mysqldump --force --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db"-failed.dump || message="$message \nFailed to force backup of corrupted db $db as $db-failed.dump" >&2
 | 
			
		||||
    mariadb-dump --force --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db"-failed.dump || message="$message \nFailed to force backup of corrupted db $db as $db-failed.dump" >&2
 | 
			
		||||
    if [ "$fixtables" = "enabled" ]; then
 | 
			
		||||
	repair="failure"
 | 
			
		||||
	message="$message \nTrying to auto-repair the db and do a backup after..."
 | 
			
		||||
	mysqlcheck -s --auto-repair -c "$db"  &&  \
 | 
			
		||||
   	mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump && repair="success"
 | 
			
		||||
	mariadb-check -s --auto-repair -c "$db"  &&  \
 | 
			
		||||
   	mariadb-dump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump && repair="success"
 | 
			
		||||
	message="$message \n => $repair"
 | 
			
		||||
    fi
 | 
			
		||||
    echo $message
 | 
			
		||||
@@ -37,17 +37,18 @@ then
 | 
			
		||||
fi
 | 
			
		||||
for db in $(mysql -BNre "show databases;"|egrep -vi "^information_schema$|^performance_schema$") 
 | 
			
		||||
do
 | 
			
		||||
    mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump || onfailure $db
 | 
			
		||||
    mariadb-dump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump || onfailure $db
 | 
			
		||||
done
 | 
			
		||||
# double usage as already in mysql.dump
 | 
			
		||||
# dump user privileges
 | 
			
		||||
mysqldump --system=users --insert-ignore > /home/e-smith/db/mysql/mysql.privileges.dump
 | 
			
		||||
#mariadb-dump --system=users --insert-ignore > /home/e-smith/db/mysql/mysql.privileges.dump
 | 
			
		||||
# dump plugins
 | 
			
		||||
mysqldump --system=plugins --insert-ignore > /home/e-smith/db/mysql/mysql.plugins.dump
 | 
			
		||||
#mariadb-dump --system=plugins --insert-ignore > /home/e-smith/db/mysql/mysql.plugins.dump
 | 
			
		||||
# dump udfs
 | 
			
		||||
mysqldump --system=udfs --insert-ignore > /home/e-smith/db/mysql/mysql.udfs.dump
 | 
			
		||||
#mariadb-dump --system=udfs --insert-ignore > /home/e-smith/db/mysql/mysql.udfs.dump
 | 
			
		||||
# dump servers
 | 
			
		||||
mysqldump --system=servers --insert-ignore > /home/e-smith/db/mysql/mysql.servers.dump
 | 
			
		||||
#mariadb-dump --system=servers --insert-ignore > /home/e-smith/db/mysql/mysql.servers.dump
 | 
			
		||||
# dump stats
 | 
			
		||||
mysqldump --system=stats --insert-ignore > /home/e-smith/db/mysql/mysql.stats.dump
 | 
			
		||||
#mariadb-dump --system=stats --insert-ignore > /home/e-smith/db/mysql/mysql.stats.dump
 | 
			
		||||
# dump timezones
 | 
			
		||||
mysqldump --system=timezones --insert-ignore > /home/e-smith/db/mysql/mysql.timezones.dump
 | 
			
		||||
#mariadb-dump --system=timezones --insert-ignore > /home/e-smith/db/mysql/mysql.timezones.dump
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +5,8 @@
 | 
			
		||||
# non RH ocmpiled version of mariadb limits MyISAM index to 1000 bytes, newer mysql db use Aria as engine for those tables
 | 
			
		||||
( /usr/bin/mysql_filter_user_table /home/e-smith/db/mysql/mysql.dump |sed -e 's/ENGINE=MyISAM/ENGINE=Aria/';
 | 
			
		||||
  [ -f /home/e-smith/db/mysql/mysql.privileges.dump ] && cat /home/e-smith/db/mysql/mysql.privileges.dump;
 | 
			
		||||
  cat /var/lib/mysql.private/set.password ) | mysql || exit 1
 | 
			
		||||
/usr/bin/mysql_upgrade
 | 
			
		||||
  cat /var/lib/mysql.private/set.password ) | mariadb || exit 1
 | 
			
		||||
/usr/bin/mariadb-upgrade
 | 
			
		||||
/bin/rm /run/mariadb/mariadb.pid
 | 
			
		||||
/usr/bin/systemctl restart mariadb.service
 | 
			
		||||
for i in $(seq 1 20);
 | 
			
		||||
@@ -17,8 +17,8 @@ do
 | 
			
		||||
      [ -f /home/e-smith/db/mysql/mysql.privileges.dump ] /bin/rm /home/e-smith/db/mysql/mysql.privileges.dump
 | 
			
		||||
      exit 0
 | 
			
		||||
  fi
 | 
			
		||||
  echo waiting for mysqld to restart
 | 
			
		||||
  echo waiting for mariadb to restart
 | 
			
		||||
  sleep 1
 | 
			
		||||
done
 | 
			
		||||
echo mysqld failed to restart
 | 
			
		||||
echo mariadb failed to restart
 | 
			
		||||
exit 1
 | 
			
		||||
 
 | 
			
		||||
@@ -2,4 +2,9 @@
 | 
			
		||||
#innodb
 | 
			
		||||
{# enabled is already the default
 | 
			
		||||
}innodb_file_per_table={ $mariadb{'innodb_file_per_table'}||'1' }
 | 
			
		||||
# innodb_strict_mode = 0
 | 
			
		||||
# higher size see SME 12982
 | 
			
		||||
innodb_page_size=64k
 | 
			
		||||
innodb_log_buffer_size={ $mariadb{'innodb_log_buffer_size='}||'32M' }
 | 
			
		||||
innodb_buffer_pool_size={ $mariadb{'innodb_buffer_pool_size'}||'512M' }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -41,8 +41,8 @@ if ( ($runlevel ne 'multi-user.target' &&  $runlevel ne "sme-server.target") ||
 | 
			
		||||
	{
 | 
			
		||||
	    # Find our mysqld binary
 | 
			
		||||
	    my $mysqld = "/usr/libexec/mysqld";
 | 
			
		||||
	    if (-f "/usr/sbin/mysqld") {
 | 
			
		||||
		$mysqld = "/usr/sbin/mysqld";
 | 
			
		||||
	    if (-f "/usr/sbin/mariadbd") {
 | 
			
		||||
		$mysqld = "/usr/sbin/mariadbd";
 | 
			
		||||
	    }
 | 
			
		||||
	    # Hard-code user, since it is set in mysqld_safe currently.
 | 
			
		||||
	    # See http://bugs.mysql.com/2163
 | 
			
		||||
 
 | 
			
		||||
@@ -46,13 +46,13 @@ do
 | 
			
		||||
	    F=$(basename $link | sed 's/S\?[0-9][0-9]_\?//')
 | 
			
		||||
	    case $F in
 | 
			
		||||
		*.sql)
 | 
			
		||||
                action "Loading $F into mysql" perl -e '
 | 
			
		||||
                action "Loading $F into mariadb" perl -e '
 | 
			
		||||
                     open (STDERR, "|/usr/bin/logger -p local1.info -t mysql.init");
 | 
			
		||||
                     open (STDOUT, ">&STDERR");
 | 
			
		||||
                     exec "/usr/bin/mysql";' < $link && /bin/rm $link
 | 
			
		||||
                     exec "/usr/bin/mariadb";' < $link && /bin/rm $link
 | 
			
		||||
                ;;
 | 
			
		||||
		*)
 | 
			
		||||
                action "Loading $F into mysql" perl -e '
 | 
			
		||||
                action "Loading $F into mariadb" perl -e '
 | 
			
		||||
                     open (STDERR, "|/usr/bin/logger -p local1.info -t mysql.init");
 | 
			
		||||
                     open (STDOUT, ">&STDERR");
 | 
			
		||||
                     exec shift; ' $link && /bin/rm $link
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,6 @@ ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
 | 
			
		||||
 && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"
 | 
			
		||||
 | 
			
		||||
#ours : we need root user as + and ! are not yet supported
 | 
			
		||||
#ExecStartPre=/usr/libexec/mysql-check-socket
 | 
			
		||||
ExecStartPre=-/sbin/e-smith/service-status mariadb
 | 
			
		||||
ExecStartPre=-/sbin/e-smith/expand-template /var/lib/mysql.private/set.password
 | 
			
		||||
ExecStartPre=-/sbin/e-smith/expand-template /root/.my.cnf
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ Summary: Koozali SME Server specific mysql configuration and templates.
 | 
			
		||||
%define name smeserver-mysql
 | 
			
		||||
Name: %{name}
 | 
			
		||||
%define version 11.0.0
 | 
			
		||||
%define release 13
 | 
			
		||||
%define release 14
 | 
			
		||||
Version: %{version}
 | 
			
		||||
Release: %{release}%{?dist}
 | 
			
		||||
License: GPL
 | 
			
		||||
@@ -79,6 +79,12 @@ rm -rf $RPM_BUILD_ROOT
 | 
			
		||||
%defattr(-,root,root)
 | 
			
		||||
 | 
			
		||||
%changelog
 | 
			
		||||
* Sun Apr 20 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-14.sme
 | 
			
		||||
- set innodb_page_size=64k [SME: 12982]
 | 
			
		||||
  breaking change, needs backup and restore of mariadb databases
 | 
			
		||||
- convert mysql* bins call to mariadb-* [SME: 12983]
 | 
			
		||||
- revert [SME: 12591]
 | 
			
		||||
 | 
			
		||||
* Sun Apr 06 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-13.sme
 | 
			
		||||
- fix Specified key was too long with older mysql db tables [SME: 12980]
 | 
			
		||||
  added back mysql_upgrade in 00_restore_dumped_dbs
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user