Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-33750: Sync configuratons from Debian Salsa #3146

Open
wants to merge 13 commits into
base: 10.11
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions debian/additions/debian-start
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@
# Changes to this file will be preserved when updating the Debian package.
#

# shellcheck source=debian/additions/debian-start.inc.sh
source /usr/share/mysql/debian-start.inc.sh

# Read default/mysql first and then default/mariadb just like the init.d file does
if [ -f /etc/default/mysql ]; then
if [ -f /etc/default/mysql ]
then
# shellcheck source=/dev/null
. /etc/default/mysql
fi

if [ -f /etc/default/mariadb ]; then
if [ -f /etc/default/mariadb ]
then
# shellcheck source=/dev/null
. /etc/default/mariadb
fi

MARIADB="/usr/bin/mariadb --defaults-file=/etc/mysql/debian.cnf"
MYADMIN="/usr/bin/mariadb-admin --defaults-file=/etc/mysql/debian.cnf"
# Don't run full mariadb-upgrade on every server restart, use --version-check to do it only once
MYUPGRADE="/usr/bin/mariadb-upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check --silent"
MYCHECK="/usr/bin/mariadb-check --defaults-file=/etc/mysql/debian.cnf"
MYCHECK_SUBJECT="WARNING: mariadb-check has found corrupt tables"
MYCHECK_PARAMS="--all-databases --fast --silent"
MYCHECK_RCPT="${MYCHECK_RCPT:-root}"

## Checking for corrupt, not cleanly closed (only for MyISAM and Aria engines) and upgrade needing tables.
Expand Down
46 changes: 29 additions & 17 deletions debian/additions/debian-start.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file is included by /etc/mysql/debian-start
#

## Check MyISAM and Aria unclosed tables.
## Is there MyISAM or Aria unclosed tables.
# - Requires the server to be up.
# - Is supposed to run silently in background.
function check_for_crashed_tables() {
Expand All @@ -21,26 +21,37 @@ function check_for_crashed_tables() {
# spaces in the thing to be looped over.

# If a crashed table is encountered, the "mariadb" command will return with a status different from 0
#
# The first query will generate lines like.
# select count(*) into @discard from 'mysql'.'db'
# The second line will load all tables without printing any actual results,
# but may show warnings and definitely is expected to have some error and
# exit code if crashed tables are encountered.
#
# Note that inside single quotes must be quoted with '\'' (to be outside of single quotes).
set +e

LC_ALL=C $MARIADB --skip-column-names --batch -e '
select concat('\''select count(*) into @discard from `'\'',
TABLE_SCHEMA, '\''`.`'\'', TABLE_NAME, '\''`'\'')
from information_schema.TABLES where TABLE_SCHEMA<>'\''INFORMATION_SCHEMA'\'' and TABLE_SCHEMA<>'\''PERFORMANCE_SCHEMA'\'' and ( ENGINE='\''MyISAM'\'' or ENGINE='\''Aria'\'' )' | \
xargs -i ${MARIADB} --skip-column-names --silent --batch \
--force -e "{}" &>"${tempfile}"
# The $MARIADB is intentionally used to expand into a command and arguments
echo '
SELECT CONCAT("select count(*) into @discard from '\''", TABLE_SCHEMA, "'\''.'\''", TABLE_NAME, "'\''")
FROM information_schema.TABLES WHERE TABLE_SCHEMA<>"INFORMATION_SCHEMA" AND TABLE_SCHEMA<>"PERFORMANCE_SCHEMA"
AND (ENGINE="MyISAM" OR ENGINE="Aria")
' | \
LC_ALL=C "$MARIADB" --skip-column-names --batch | \
xargs --no-run-if-empty -i "$MARIADB" --skip-column-names --silent --batch --force -e "{}" &> "${tempfile}"
set -e

if [ -s "$tempfile" ]; then
if [ -s "$tempfile" ]
then
(
/bin/echo -e "\n" \
"Improperly closed tables are also reported if clients are accessing\n" \
"the tables *now*. A list of current connections is below.\n";
$MYADMIN processlist status
"the tables *now*. A list of current connections is below.\n";
$MYADMIN processlist status
) >> "${tempfile}"
# Check for presence as a dependency on mailx would require an MTA.
if [ -x /usr/bin/mailx ]; then
mailx -e -s"$MYCHECK_SUBJECT" $MYCHECK_RCPT < "$tempfile"
if [ -x /usr/bin/mailx ]
then
mailx -e -s"$MYCHECK_SUBJECT" "$MYCHECK_RCPT" < "$tempfile"
fi
(echo "$MYCHECK_SUBJECT"; cat "${tempfile}") | logger -p daemon.warn -i -t"$0"
fi
Expand All @@ -54,13 +65,13 @@ function upgrade_system_tables_if_necessary() {
set -e
set -u

logger -p daemon.info -i -t"$0" "Upgrading MySQL tables if necessary."
logger -p daemon.info -i -t"$0" "Upgrading MariaDB tables if necessary."

# Filter all "duplicate column", "duplicate key" and "unknown column"
# errors as the script is designed to be idempotent.
LC_ALL=C $MYUPGRADE \
2>&1 \
| egrep -v '^(1|@had|ERROR (1051|1054|1060|1061|1146|1347|1348))' \
| grep -E -v '^(1|@had|ERROR (1051|1054|1060|1061|1146|1347|1348))' \
| logger -p daemon.warn -i -t"$0"
}

Expand All @@ -72,8 +83,9 @@ function check_root_accounts() {

logger -p daemon.info -i -t"$0" "Checking for insecure root accounts."

ret=$( echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='' and plugin in ('', 'mysql_native_password', 'mysql_old_password');" | $MARIADB --skip-column-names )
if [ "$ret" -ne "0" ]; then
ret=$(echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='' and password_expired='N' and plugin in ('', 'mysql_native_password', 'mysql_old_password');" | $MARIADB --skip-column-names)
if [ "$ret" -ne "0" ]
then
logger -p daemon.warn -i -t"$0" "WARNING: mysql.user contains $ret root accounts without password!"
fi
}
9 changes: 7 additions & 2 deletions debian/additions/mariadb.conf.d/50-server.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ bind-address = 127.0.0.1
# * Logging and Replication
#

# Note: The configured log file or its directory need to be created
# and be writable by the mysql user, e.g.:
# $ sudo mkdir -m 2750 /var/log/mysql
# $ sudo chown mysql /var/log/mysql

# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# Recommend only changing this at runtime for short testing periods if needed!
Expand All @@ -63,8 +68,8 @@ bind-address = 127.0.0.1
#log_slow_min_examined_row_limit = 1000

# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
# note: if you are setting up a replica, see README.Debian about other
# settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
Expand Down
2 changes: 1 addition & 1 deletion debian/autobake-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ fi

# Use eatmydata is available to build faster with less I/O, skipping fsync()
# during the entire build process (safe because a build can always be restarted)
if which eatmydata > /dev/null
if command -v eatmydata > /dev/null
then
BUILDPACKAGE_DPKGCMD+=("eatmydata")
fi
Expand Down
5 changes: 2 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ Description: MariaDB database development files

Package: libmariadb-dev-compat
Architecture: any
Multi-Arch: same
Section: libdevel
Depends: libmariadb-dev (= ${binary:Version}),
${misc:Depends}
Expand Down Expand Up @@ -206,6 +205,7 @@ Section: libs
Depends: ${misc:Depends},
${shlibs:Depends}
Breaks: libmariadbd-dev (<< ${source:Version})
Conflicts: libmariadbd19t64
Replaces: libmariadbd-dev (<< ${source:Version})
Multi-Arch: same
Description: MariaDB embedded database, shared library
Expand Down Expand Up @@ -839,7 +839,7 @@ Description: Amazon S3 archival storage engine for MariaDB
them accessible in MariaDB in read-only mode.

Package: mariadb-plugin-rocksdb
Architecture: amd64 arm64 mips64el ppc64el
Architecture: amd64 arm64 mips64el ppc64el riscv64
Depends: mariadb-server (= ${server:Version}),
python3:any,
rocksdb-tools,
Expand Down Expand Up @@ -949,7 +949,6 @@ Description: GSSAPI authentication plugin for MariaDB server

Package: mariadb-plugin-gssapi-client
Architecture: any
Multi-Arch: same
Depends: libgssapi-krb5-2,
mariadb-client (= ${binary:Version}),
${misc:Depends},
Expand Down
1 change: 0 additions & 1 deletion debian/copyright
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

== MariaDB ==

The Debian package of MySQL was first debianzed on 1997-04-12 by Christian
Expand Down
2 changes: 1 addition & 1 deletion debian/mariadb-plugin-mroonga.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# Install Mroonga
mysql --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/install.sql || true
mariadb --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/install.sql || true
# Always exit with success instead of leaving dpkg in a broken state


Expand Down
2 changes: 1 addition & 1 deletion debian/mariadb-plugin-mroonga.prerm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# Uninstall Mroonga
mysql --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/uninstall.sql || true
mariadb --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/uninstall.sql || true
# Always exit with success instead of leaving dpkg in a broken state


Expand Down
2 changes: 1 addition & 1 deletion debian/mariadb-server-core.install
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ usr/share/mysql/english
usr/share/mysql/estonian
usr/share/mysql/fill_help_tables.sql
usr/share/mysql/french
usr/share/mysql/german
usr/share/mysql/georgian
usr/share/mysql/german
usr/share/mysql/greek
usr/share/mysql/hindi
usr/share/mysql/hungarian
Expand Down
12 changes: 9 additions & 3 deletions debian/mariadb-server.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

set -e

# shellcheck source=/dev/null
. /usr/share/debconf/confmodule

if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]
then
set -v -x; DEBIAN_SCRIPT_TRACE=1
fi

${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2}

# Beware that there are two ypwhich one of them needs the 2>/dev/null!
if test -n "`which ypwhich 2>/dev/null`" && ypwhich >/dev/null 2>&1; then
if test -n "$(command -v ypwhich 2>/dev/null)" && ypwhich > /dev/null 2>&1
then
db_input high mariadb-server/nis_warning || true
db_go
fi
2 changes: 1 addition & 1 deletion debian/mariadb-server.logcheck.ignore.server
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$
mysqld_safe\[[0-9]+\]: ended$
mysqld_safe\[[0-9]+\]: NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run$
mysqld_safe\[[0-9]+\]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !$
mysqld_safe\[[0-9]+\]: Please report any problems at https://mariadb.org/jira$
mysqld_safe\[[0-9]+\]: Please report any problems at https://jira.mariadb.org$
mysqld_safe\[[0-9]+\]: See the manual for more instructions.$
mysqld_safe\[[0-9]+\]: started$
mysqld_safe\[[0-9]+\]: The latest information about MariaDB is available at$
Expand Down
2 changes: 1 addition & 1 deletion debian/mariadb-server.logcheck.ignore.workstation
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$
mysqld_safe\[[0-9]+\]: ended$
mysqld_safe\[[0-9]+\]: NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run$
mysqld_safe\[[0-9]+\]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !$
mysqld_safe\[[0-9]+\]: Please report any problems at https://mariadb.org/jira$
mysqld_safe\[[0-9]+\]: Please report any problems at https://jira.mariadb.org$
mysqld_safe\[[0-9]+\]: See the manual for more instructions.$
mysqld_safe\[[0-9]+\]: started$
mysqld_safe\[[0-9]+\]: The latest information about MariaDB is available at$
Expand Down